Class | SeleniumOnRails::TestBuilder |
In: |
lib/selenium_on_rails/test_builder.rb
|
Parent: | Object |
Builds Selenium test table using a high-level Ruby interface. Normally invoked through SeleniumOnRails::RSelenese.
See SeleniumOnRails::TestBuilderActions for the available actions and SeleniumOnRails::TestBuilderAccessors for the available checks.
For more information on the commands supported by TestBuilder, see the Selenium Commands Documentation at release.openqa.org/selenium-core/nightly/reference.html.
Create a new TestBuilder for view.
# File lib/selenium_on_rails/test_builder.rb, line 26 26: def initialize view 27: @view = view 28: @output = '' 29: @xml = Builder::XmlMarkup.new :indent => 2, :target => @output 30: end
Convert str to a Selenium command name.
# File lib/selenium_on_rails/test_builder.rb, line 15 15: def self.selenize str 16: str.camelize.gsub(/^[A-Z]/) {|s| s.downcase } 17: end
Add a new test command using cmd, target and value.
# File lib/selenium_on_rails/test_builder.rb, line 41 41: def command cmd, target=nil, value=nil 42: @xml.tr do 43: _tdata cmd 44: _tdata target 45: _tdata value 46: end 47: end
Same as command but add AndWait to the name of cmd.
# File lib/selenium_on_rails/test_builder.rb, line 52 52: def command_and_wait cmd, target=nil, value=nil 53: command_verbatim cmd.to_s + 'AndWait', target, value 54: end
Prepends pattern with ‘exact:’ if it would be considered containing string-match pattern otherwise.
# File lib/selenium_on_rails/test_builder.rb, line 21 21: def exactize pattern 22: pattern.include?(':') ? "exact:#{pattern}" : pattern 23: end
Re routes commands in the provided block to command_and_wait instead of command.
# File lib/selenium_on_rails/test_builder.rb, line 58 58: def make_command_waiting 59: self.class.send :alias_method, :command, :command_and_wait 60: yield 61: self.class.send :alias_method, :command, :command_verbatim 62: end