Class: SeleniumToCapybara::Minitest
- Defined in:
- lib/selenium_to_capybara/minitest.rb
Overview
This class holds the translations for minitest.
To add a translation you need to do the following steps:
-
Open the .side file and find the command you want to add
-
Define a method in the Minitest class with the command as name. The command name must be translated to the ruby version of the name.
assertText=>assert_text -
Define the translation
The properties of the whole .side command object are accessible through ruby methods.
-
targetis the preferred target selector of Selenium IDE -
targetsholds all possible target selectors identified by Selenium IDE -
selector_typeidentifies the type of the preferred target selector (e.g css, xpath) -
selectoris the selector of the preferred target selector itself. (e.g ‘body .header .title’) -
valuee.g. the value that a text field should get -
commandthe command name itself likeassertTextorclick -
commenta optional comment for that command -
idthe internal id generated by Selenium IDE
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#command, #comment, #id, #initialize, #selector, #selector_type, #target, #targets, #translate, #value
Constructor Details
This class inherits a constructor from SeleniumToCapybara::Base
Instance Method Details
#assert_text ⇒ Object
53 54 55 |
# File 'lib/selenium_to_capybara/minitest.rb', line 53 def assert_text "assert_selector('#{selector}', text: '#{value}')" end |
#click ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/selenium_to_capybara/minitest.rb', line 38 def click case selector_type when 'css' "find('#{selector}').click" when 'id' "find('##{selector}').click" when 'xpath' "find('#{selector}').click" when 'name' "find('[name=\"#{selector}\"]').click" when 'linkText' "click_link_or_button('#{selector}')" end end |
#double_click ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/selenium_to_capybara/minitest.rb', line 25 def double_click case selector_type when 'css' "find('#{selector}').double_click" when 'id' "find('##{selector}').double_click" when 'xpath' "find('#{selector}').double_click" when 'name' "find('[name=\"#{selector}\"]').double_click" end end |
#open ⇒ Object
21 22 23 |
# File 'lib/selenium_to_capybara/minitest.rb', line 21 def open "visit('#{target}')" end |