Module: Superbara::CapybaraMonkey::Result::Includes
- Included in:
- Capybara::Result
- Defined in:
- lib/capybara_monkey.rb
Instance Method Summary collapse
- #click_random(show: false, once: true) ⇒ Object
- #eight ⇒ Object
- #fifth ⇒ Object
- #fourth ⇒ Object
- #middle ⇒ Object
- #ninth ⇒ Object
-
#random ⇒ Object
also.
- #second ⇒ Object
- #seventh ⇒ Object
- #show(styles = nil) ⇒ Object
-
#sixth ⇒ Object
active support stops herew.
- #tenth ⇒ Object
- #third ⇒ Object
Instance Method Details
#click_random(show: false, once: true) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/capybara_monkey.rb', line 117 def click_random(show: false, once: true) unless self.any? return false end index = if once @__superbara_clicked ||= [] if @__superbara_clicked.size == self.size return false end selected_index = nil possible_index = nil loop do possible_index = rand(self.size) next if @__superbara_clicked.include? possible_index selected_index = possible_index @__superbara_clicked << selected_index break end selected_index else rand(self.size) end element = self[index] element.show if show element.click end |
#eight ⇒ Object
93 94 95 |
# File 'lib/capybara_monkey.rb', line 93 def eight self[7] end |
#fifth ⇒ Object
83 84 85 |
# File 'lib/capybara_monkey.rb', line 83 def fifth self[4] end |
#fourth ⇒ Object
80 81 82 |
# File 'lib/capybara_monkey.rb', line 80 def fourth self[3] end |
#middle ⇒ Object
106 107 108 |
# File 'lib/capybara_monkey.rb', line 106 def middle self[self.size/2] end |
#ninth ⇒ Object
96 97 98 |
# File 'lib/capybara_monkey.rb', line 96 def ninth self[8] end |
#random ⇒ Object
also
103 104 105 |
# File 'lib/capybara_monkey.rb', line 103 def random self[rand(self.size)] end |
#second ⇒ Object
74 75 76 |
# File 'lib/capybara_monkey.rb', line 74 def second self[1] end |
#seventh ⇒ Object
90 91 92 |
# File 'lib/capybara_monkey.rb', line 90 def seventh self[6] end |
#show(styles = nil) ⇒ Object
110 111 112 113 114 115 |
# File 'lib/capybara_monkey.rb', line 110 def show(styles=nil) for e in self e.show styles end self end |
#sixth ⇒ Object
active support stops herew
87 88 89 |
# File 'lib/capybara_monkey.rb', line 87 def sixth self[5] end |
#tenth ⇒ Object
99 100 101 |
# File 'lib/capybara_monkey.rb', line 99 def tenth self[9] end |
#third ⇒ Object
77 78 79 |
# File 'lib/capybara_monkey.rb', line 77 def third self[2] end |