page-object 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/ChangeLog +7 -0
- data/cucumber.yml +2 -2
- data/features/html/static_elements.html +19 -4
- data/features/link.feature +4 -0
- data/features/radio_button_group.feature +29 -0
- data/features/step_definitions/file_field_steps.rb +1 -1
- data/features/step_definitions/link_steps.rb +10 -2
- data/features/step_definitions/radio_button_group_steps.rb +36 -0
- data/features/step_definitions/table_steps.rb +5 -0
- data/features/support/page.rb +4 -2
- data/features/table.feature +12 -14
- data/lib/page-object/accessors.rb +57 -3
- data/lib/page-object/elements/link.rb +6 -1
- data/lib/page-object/locator_generator.rb +1 -1
- data/lib/page-object/platforms/selenium_webdriver/link.rb +8 -1
- data/lib/page-object/platforms/watir_webdriver/link.rb +15 -0
- data/lib/page-object/platforms/watir_webdriver/select_list.rb +2 -8
- data/lib/page-object/version.rb +1 -1
- data/page-object.gemspec +4 -4
- metadata +16 -11
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 5b60613a20247f2e26ec7fe5df521f0622035c18
         | 
| 4 | 
            +
              data.tar.gz: bc07cf9b7590f3077227ed25750494c527b36892
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c150363a5db1f94851f6b680de80b2f2b2fac5172071ce799b18f2ed1c01280c2ff83837026abf21f1ce31efcb7ebe7a776e1cf49b70f4a54e6bba4a5330d36b
         | 
| 7 | 
            +
              data.tar.gz: 2871e1bbe2d0a64441bc722fc45db5e72175e685f691642c04024193b20b0cc9e614aebae9f68becd11048d2e8966fc75471d617909e7b8d8a71525e4a324f5a
         | 
    
        data/.ruby-version
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            ruby-2.0.0- | 
| 1 | 
            +
            ruby-2.0.0-p353
         | 
    
        data/ChangeLog
    CHANGED
    
    | @@ -1,3 +1,10 @@ | |
| 1 | 
            +
            === Version 0.9.5 / 2014-1-22
         | 
| 2 | 
            +
            * Enhancements
         | 
| 3 | 
            +
              * Updated to use the latest selenium-webdriver 2.39.0
         | 
| 4 | 
            +
              * Added href method to Link
         | 
| 5 | 
            +
              * Added generation of plural version of basic types on class
         | 
| 6 | 
            +
              * Added new accessors for radio button group (Thanks Travis Fillmore)
         | 
| 7 | 
            +
             | 
| 1 8 | 
             
            === Version 0.9.4 / 2013-11-29
         | 
| 2 9 | 
             
            * Enhancements
         | 
| 3 10 | 
             
              * Added ability for execute_scripts to accept arguments (Thanks Justin Ko)
         | 
    
        data/cucumber.yml
    CHANGED
    
    | @@ -5,6 +5,6 @@ std_opts = "--no-source --color --format pretty" # Cucumber::Formatter::Fuubar" | |
| 5 5 | 
             
            default: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
         | 
| 6 6 | 
             
            watir_webdriver: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
         | 
| 7 7 | 
             
            selenium_webdriver: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            focus:  DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only --tags @focus
         | 
| 8 | 
            +
            focus: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only --tags @focus
         | 
| 9 | 
            +
            #focus:  DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only --tags @focus
         | 
| 10 10 |  | 
| @@ -69,6 +69,13 @@ | |
| 69 69 | 
             
                <input type="radio" id="milk_id" name="milk_name" class="milk_class" value="Milk"> Milk <br/>
         | 
| 70 70 | 
             
                <input type="radio" id="butter_id" name="butter_name" class="butter_class" value="Butter">Butter
         | 
| 71 71 |  | 
| 72 | 
            +
                <br/>
         | 
| 73 | 
            +
                <label>Radio Button Group</label>
         | 
| 74 | 
            +
                <input type="radio" name="fav_cheese" value="ched">Cheddar</input>
         | 
| 75 | 
            +
                <input type="radio" name="fav_cheese" value="emmen">Emmental</input>
         | 
| 76 | 
            +
                <input type="radio" name="fav_cheese" value="muen">Muenster</input>
         | 
| 77 | 
            +
                <br/>
         | 
| 78 | 
            +
             | 
| 72 79 | 
             
                <div id="div_id" name="div_name" class="div_class" title="div_title">
         | 
| 73 80 | 
             
                    page-object rocks!
         | 
| 74 81 | 
             
                </div>
         | 
| @@ -85,14 +92,22 @@ | |
| 85 92 | 
             
                </label>
         | 
| 86 93 |  | 
| 87 94 | 
             
                <table id='table_id' name='table_name' class='table_class' border='1'>
         | 
| 95 | 
            +
                  <thead>
         | 
| 96 | 
            +
                    <tr>
         | 
| 97 | 
            +
                      <th>Table</th>
         | 
| 98 | 
            +
                      <th>Header</th>
         | 
| 99 | 
            +
                    </tr>
         | 
| 100 | 
            +
                  </thead>
         | 
| 101 | 
            +
                  <tbody>
         | 
| 88 102 | 
             
                    <tr>
         | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 103 | 
            +
                      <td>Data1</td>
         | 
| 104 | 
            +
                      <td>Data2</td>
         | 
| 91 105 | 
             
                    </tr>
         | 
| 92 106 | 
             
                    <tr>
         | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 107 | 
            +
                      <td>Data3</td>
         | 
| 108 | 
            +
                      <td id='cell_id' name='cell_name' class='cell_class'>Data4</td>
         | 
| 95 109 | 
             
                    </tr>
         | 
| 110 | 
            +
                  </tbody>
         | 
| 96 111 | 
             
                </table>
         | 
| 97 112 |  | 
| 98 113 | 
             
                <table id='table_with_thead_id' border='1'>
         | 
    
        data/features/link.feature
    CHANGED
    
    | @@ -42,3 +42,7 @@ Feature: Links | |
| 42 42 | 
             
              Scenario: Finding a link dynamically
         | 
| 43 43 | 
             
                When I select a link while the script is executing
         | 
| 44 44 | 
             
                And the page should contain the text "Success"
         | 
| 45 | 
            +
             | 
| 46 | 
            +
              Scenario: Getting the href for a link
         | 
| 47 | 
            +
                When I get the href for the link
         | 
| 48 | 
            +
                Then I should know it was "success.html"
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            Feature: Radio Button Groups
         | 
| 2 | 
            +
              In order to interact with radio button groups
         | 
| 3 | 
            +
              Testers will need access and interrogation ability
         | 
| 4 | 
            +
             | 
| 5 | 
            +
             | 
| 6 | 
            +
              Background:
         | 
| 7 | 
            +
                Given I am on the static elements page
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              Scenario: Confirm existence of a radio button group
         | 
| 10 | 
            +
                Then I should see that the radio button group exists
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              Scenario: No radio buttons in the group have been selected
         | 
| 13 | 
            +
                When no radio buttons have been selected
         | 
| 14 | 
            +
                Then no radio buttons should be selected in the group
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              Scenario: Selecting grouped radio buttons by value
         | 
| 17 | 
            +
                When I select the "ched" radio button in the group
         | 
| 18 | 
            +
                Then the "ched" radio button should be selected in the group
         | 
| 19 | 
            +
                Then the "emmen" radio button should not be selected
         | 
| 20 | 
            +
                Then the "muen" radio button should not be selected
         | 
| 21 | 
            +
                When I select the "muen" radio button in the group
         | 
| 22 | 
            +
                Then the "ched" radio button should not be selected
         | 
| 23 | 
            +
                Then the "emmen" radio button should not be selected
         | 
| 24 | 
            +
                Then the "muen" radio button should be selected in the group
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              Scenario: Getting an array of elements for each radio button in the group
         | 
| 27 | 
            +
                When I ask for the elements of a radio button group
         | 
| 28 | 
            +
                Then I should have an array with elements for each radio button
         | 
| 29 | 
            +
                And the radio button element values should be "ched", "emmen", "muen"
         | 
| @@ -3,7 +3,7 @@ When /^I set the file field to the step definition file$/ do | |
| 3 3 | 
             
            end
         | 
| 4 4 |  | 
| 5 5 | 
             
            Then /^its\' value should equal that file$/ do
         | 
| 6 | 
            -
              @page.file_field_id_element.value | 
| 6 | 
            +
              __FILE__.should include @page.file_field_id_element.value
         | 
| 7 7 | 
             
            end
         | 
| 8 8 |  | 
| 9 9 | 
             
            When /^I search for the file field by "([^\"]*)"$/ do |how|
         | 
| @@ -19,6 +19,14 @@ When /^I select a link while the script is executing$/ do | |
| 19 19 | 
             
              link.click
         | 
| 20 20 | 
             
            end
         | 
| 21 21 |  | 
| 22 | 
            -
            Then | 
| 22 | 
            +
            Then(/^I should see that the link exists$/) do
         | 
| 23 23 | 
             
              @page.link_id?.should == true
         | 
| 24 | 
            -
            end
         | 
| 24 | 
            +
            end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            When(/^I get the href for the link$/) do
         | 
| 27 | 
            +
              @href = @page.google_search_id_element.href
         | 
| 28 | 
            +
            end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            Then(/^I should know it was "(.*?)"$/) do |href|
         | 
| 31 | 
            +
              @href.should include href
         | 
| 32 | 
            +
            end
         | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            When /^no radio buttons have been selected$/ do
         | 
| 2 | 
            +
              # nothing to do here
         | 
| 3 | 
            +
            end
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Then /^no radio buttons should be selected in the group$/ do
         | 
| 6 | 
            +
              @page.favorite_cheese_selected?.should == false
         | 
| 7 | 
            +
            end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            When /^I select the "([^\"]*)" radio button in the group$/ do |how|
         | 
| 10 | 
            +
              @page.select_favorite_cheese("#{how}")
         | 
| 11 | 
            +
            end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            Then /^the "([^\"]*)" radio button should be selected in the group$/ do |how|
         | 
| 14 | 
            +
              @page.favorite_cheese_selected?.should == "#{how}"
         | 
| 15 | 
            +
            end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            Then /^the "([^\"]*)" radio button should not be selected$/ do |how|
         | 
| 18 | 
            +
              @page.favorite_cheese_selected?.should_not == "#{how}"
         | 
| 19 | 
            +
            end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            Then /^I should see that the radio button group exists$/ do
         | 
| 22 | 
            +
              @page.favorite_cheese?.should == true
         | 
| 23 | 
            +
            end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            When /^I ask for the elements of a radio button group$/ do
         | 
| 26 | 
            +
              @elems = @page.favorite_cheese_elements
         | 
| 27 | 
            +
            end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            Then /^I should have an array with elements for each radio button$/ do
         | 
| 30 | 
            +
              @elems.length.should == 3
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            And /^the radio button element values should be "([^\"]*)", "([^\"]*)", "([^\"]*)"$/ do |val1, val2, val3|
         | 
| 34 | 
            +
              elem_arr = @elems.collect { |elem| elem.value }
         | 
| 35 | 
            +
              elem_arr.should == [val1, val2, val3]
         | 
| 36 | 
            +
            end
         | 
| @@ -31,6 +31,11 @@ Then /^the data for the first row should be "([^\"]*)" and "([^\"]*)"$/ do |col1 | |
| 31 31 | 
             
              @element.first_row[1].text.should == col2
         | 
| 32 32 | 
             
            end
         | 
| 33 33 |  | 
| 34 | 
            +
            Then /^the data for the second row should be "([^\"]*)" and "([^\"]*)"$/ do |col1, col2|
         | 
| 35 | 
            +
              @element[1][0].text.should == col1
         | 
| 36 | 
            +
              @element[1][1].text.should == col2
         | 
| 37 | 
            +
            end
         | 
| 38 | 
            +
             | 
| 34 39 | 
             
            Then /^the data for the last row should be "([^\"]*)" and "([^\"]*)"$/ do |col1, col2|
         | 
| 35 40 | 
             
              @element.last_row[0].text.should == col1
         | 
| 36 41 | 
             
              @element.last_row[1].text.should == col2
         | 
    
        data/features/support/page.rb
    CHANGED
    
    | @@ -100,6 +100,8 @@ class Page | |
| 100 100 |  | 
| 101 101 | 
             
              radio_button(:butter_id, :id => 'butter_id')
         | 
| 102 102 |  | 
| 103 | 
            +
              radio_button_group(:favorite_cheese, name: 'fav_cheese')
         | 
| 104 | 
            +
             | 
| 103 105 | 
             
              div(:div_id, :id => 'div_id')
         | 
| 104 106 | 
             
              div(:div_name, :name => 'div_name')
         | 
| 105 107 | 
             
              div(:div_class, :class => 'div_class')
         | 
| @@ -309,8 +311,8 @@ class Page | |
| 309 311 | 
             
              label(:label_class, :class => 'label_class')
         | 
| 310 312 | 
             
              label(:label_css, :css => '.label_class')
         | 
| 311 313 | 
             
              label(:label_text, :text => 'page-object is the best!')
         | 
| 312 | 
            -
              label(:label_index, :index =>  | 
| 313 | 
            -
              label(:label_xpath, :xpath => '//label[ | 
| 314 | 
            +
              label(:label_index, :index => 6)
         | 
| 315 | 
            +
              label(:label_xpath, :xpath => '//label[7]')
         | 
| 314 316 | 
             
              label(:label_class_index, :class => "label_class", :index => 0)
         | 
| 315 317 | 
             
              label(:label_name_index, :name => "label_name", :index => 0)
         | 
| 316 318 |  | 
    
        data/features/table.feature
    CHANGED
    
    | @@ -17,13 +17,11 @@ Feature: Table | |
| 17 17 |  | 
| 18 18 | 
             
              Scenario: Retrieve the data from a table
         | 
| 19 19 | 
             
                When I retrieve a table element
         | 
| 20 | 
            -
                Then the data for row " | 
| 21 | 
            -
                And the data for row " | 
| 22 | 
            -
                And the table should have " | 
| 23 | 
            -
                And  | 
| 24 | 
            -
                And row " | 
| 25 | 
            -
                And each column should contain "Data"
         | 
| 26 | 
            -
                And the data for the first row should be "Data1" and "Data2"
         | 
| 20 | 
            +
                Then the data for row "2" should be "Data1" and "Data2"
         | 
| 21 | 
            +
                And the data for row "3" should be "Data3" and "Data4"
         | 
| 22 | 
            +
                And the table should have "3" rows
         | 
| 23 | 
            +
                And row "2" should have "2" columns
         | 
| 24 | 
            +
                And the data for the second row should be "Data1" and "Data2"
         | 
| 27 25 | 
             
                And the data for the last row should be "Data3" and "Data4"
         | 
| 28 26 |  | 
| 29 27 | 
             
              Scenario: Retrieve data from a table using a row header
         | 
| @@ -44,7 +42,7 @@ Feature: Table | |
| 44 42 |  | 
| 45 43 | 
             
              Scenario: Retrieve data from a table using a column header
         | 
| 46 44 | 
             
                When I retrieve a table element
         | 
| 47 | 
            -
                Then the data for column " | 
| 45 | 
            +
                Then the data for column "Header" and row "3" should be "Data4"
         | 
| 48 46 |  | 
| 49 47 | 
             
              Scenario: Retrieve data from a table with a thead using a column header
         | 
| 50 48 | 
             
                When I retrieve a table with thead element
         | 
| @@ -56,11 +54,11 @@ Feature: Table | |
| 56 54 |  | 
| 57 55 | 
             
              Scenario: Retrieve data from a table using a partial column header
         | 
| 58 56 | 
             
                When I retrieve a table element
         | 
| 59 | 
            -
                Then the data for column " | 
| 57 | 
            +
                Then the data for column "eader" and row "3" should be "Data4"
         | 
| 60 58 |  | 
| 61 59 | 
             
              Scenario: Retrieve data from a table using both headers
         | 
| 62 60 | 
             
                When I retrieve a table element
         | 
| 63 | 
            -
                Then the data for row "Data3" and column " | 
| 61 | 
            +
                Then the data for row "Data3" and column "eader" should be "Data4"
         | 
| 64 62 |  | 
| 65 63 | 
             
              Scenario: Retrieve data from a table with an incorrect row header
         | 
| 66 64 | 
             
                When I retrieve a table element
         | 
| @@ -76,7 +74,7 @@ Feature: Table | |
| 76 74 |  | 
| 77 75 | 
             
              Scenario Outline: Locating table cells on the Page
         | 
| 78 76 | 
             
                When I retrieve a table element by "<search_by>"
         | 
| 79 | 
            -
                Then the data for row " | 
| 77 | 
            +
                Then the data for row "2" should be "Data1" and "Data2"
         | 
| 80 78 |  | 
| 81 79 | 
             
              Scenarios:
         | 
| 82 80 | 
             
                | search_by |
         | 
| @@ -89,7 +87,7 @@ Feature: Table | |
| 89 87 | 
             
              @selenium_only
         | 
| 90 88 | 
             
              Scenario Outline: Locating table cells on the Page
         | 
| 91 89 | 
             
                When I retrieve a table element by "<search_by>"
         | 
| 92 | 
            -
                Then the data for row " | 
| 90 | 
            +
                Then the data for row "2" should be "Data1" and "Data2"
         | 
| 93 91 |  | 
| 94 92 | 
             
              Scenarios:
         | 
| 95 93 | 
             
                | search_by |
         | 
| @@ -97,7 +95,7 @@ Feature: Table | |
| 97 95 |  | 
| 98 96 | 
             
              Scenario Outline: Locating table using multiple parameters
         | 
| 99 97 | 
             
                When I retrieve a table element by "<param1>" and "<param2>"
         | 
| 100 | 
            -
                Then the data for row " | 
| 98 | 
            +
                Then the data for row "2" should be "Data1" and "Data2"
         | 
| 101 99 |  | 
| 102 100 | 
             
              Scenarios:
         | 
| 103 101 | 
             
                | param1 | param2 |
         | 
| @@ -106,7 +104,7 @@ Feature: Table | |
| 106 104 |  | 
| 107 105 | 
             
              Scenario: Finding a table dynamically
         | 
| 108 106 | 
             
                When I retrieve a table element while the script is executing
         | 
| 109 | 
            -
                And the data for row " | 
| 107 | 
            +
                And the data for row "2" should be "Data1" and "Data2"
         | 
| 110 108 |  | 
| 111 109 | 
             
              @watir_only
         | 
| 112 110 | 
             
              Scenario: Finding an existing table
         | 
| @@ -419,6 +419,56 @@ module PageObject | |
| 419 419 | 
             
                end
         | 
| 420 420 | 
             
                alias_method :radio, :radio_button
         | 
| 421 421 |  | 
| 422 | 
            +
                #
         | 
| 423 | 
            +
                # adds five methods to help interact with a radio button group -
         | 
| 424 | 
            +
                # a method to select a radio button in the group by given value/text,
         | 
| 425 | 
            +
                # a method to return the values of all radio buttins in the group, a method
         | 
| 426 | 
            +
                # to return if a radio button in the group is selected (will return
         | 
| 427 | 
            +
                # the text of the selected radio button, if true), a method to return
         | 
| 428 | 
            +
                # an array of PageObject::Elements::RadioButton objects representing
         | 
| 429 | 
            +
                # the radio button group, and finally a method to check the existence
         | 
| 430 | 
            +
                # of the radio button group.
         | 
| 431 | 
            +
                #
         | 
| 432 | 
            +
                # @example
         | 
| 433 | 
            +
                # radio_button_group(:color, :name => "preferred_color")
         | 
| 434 | 
            +
                # will generate 'select_color', 'color_values', 'color_selected?',
         | 
| 435 | 
            +
                # 'color_elements', and 'color?' methods
         | 
| 436 | 
            +
                #
         | 
| 437 | 
            +
                # @param [Symbol] the name used for the generated methods
         | 
| 438 | 
            +
                # @param [Hash] shared identifier for the radio button group. Typically, a 'name' attribute.
         | 
| 439 | 
            +
                # The valid keys are:
         | 
| 440 | 
            +
                # * :name => Watir and Selenium
         | 
| 441 | 
            +
                #
         | 
| 442 | 
            +
                def radio_button_group(name, identifier)
         | 
| 443 | 
            +
                  define_method("select_#{name}") do |value|
         | 
| 444 | 
            +
                    platform.radio_buttons_for(identifier.clone).each do |radio_elem|
         | 
| 445 | 
            +
                      if radio_elem.value == value
         | 
| 446 | 
            +
                        return radio_elem.select
         | 
| 447 | 
            +
                      end
         | 
| 448 | 
            +
                    end
         | 
| 449 | 
            +
                  end
         | 
| 450 | 
            +
                  define_method("#{name}_values") do
         | 
| 451 | 
            +
                    result = []
         | 
| 452 | 
            +
                    platform.radio_buttons_for(identifier.clone).each do |radio_elem|
         | 
| 453 | 
            +
                      result << radio_elem.value
         | 
| 454 | 
            +
                    end
         | 
| 455 | 
            +
                    return result
         | 
| 456 | 
            +
                  end
         | 
| 457 | 
            +
                  define_method("#{name}_selected?") do
         | 
| 458 | 
            +
                    platform.radio_buttons_for(identifier.clone).each do |radio_elem|
         | 
| 459 | 
            +
                      return radio_elem.value if radio_elem.selected?
         | 
| 460 | 
            +
                    end
         | 
| 461 | 
            +
                    return false
         | 
| 462 | 
            +
                  end
         | 
| 463 | 
            +
                  define_method("#{name}_elements") do
         | 
| 464 | 
            +
                    return platform.radio_buttons_for(identifier.clone)
         | 
| 465 | 
            +
                  end
         | 
| 466 | 
            +
                  define_method("#{name}?") do
         | 
| 467 | 
            +
                    return platform.radio_buttons_for(identifier.clone).any?
         | 
| 468 | 
            +
                  end
         | 
| 469 | 
            +
                end
         | 
| 470 | 
            +
                alias_method :radio_group, :radio_button_group
         | 
| 471 | 
            +
             | 
| 422 472 | 
             
                #
         | 
| 423 473 | 
             
                # adds three methods - one to click a button, another to
         | 
| 424 474 | 
             
                # return the button element, and another to check the button's existence.
         | 
| @@ -1155,11 +1205,15 @@ module PageObject | |
| 1155 1205 | 
             
                #   * :xpath => Watir and Selenium
         | 
| 1156 1206 | 
             
                # @param optional block to be invoked when element method is called
         | 
| 1157 1207 | 
             
                #
         | 
| 1158 | 
            -
                LocatorGenerator::BASIC_ELEMENTS.each do | | 
| 1159 | 
            -
                  define_method( | 
| 1208 | 
            +
                LocatorGenerator::BASIC_ELEMENTS.each do |tag|
         | 
| 1209 | 
            +
                  define_method(tag) do |name, *identifier, &block|
         | 
| 1160 1210 | 
             
                    identifier = identifier[0] ? identifier[0] : {:index => 0}
         | 
| 1161 | 
            -
                    element(name,  | 
| 1211 | 
            +
                    element(name, tag, identifier, &block)
         | 
| 1162 1212 | 
             
                  end
         | 
| 1213 | 
            +
                  define_method("#{tag}s") do |name, *identifier, &block|
         | 
| 1214 | 
            +
                    identifier = identifier[0] ? identifier[0] : {:index => 0}
         | 
| 1215 | 
            +
                    elements(name, tag, identifier, &block)
         | 
| 1216 | 
            +
                  end unless tag == :param
         | 
| 1163 1217 | 
             
                end
         | 
| 1164 1218 |  | 
| 1165 1219 | 
             
                def standard_methods(name, identifier, method, &block)
         | 
| @@ -28,9 +28,14 @@ module PageObject | |
| 28 28 |  | 
| 29 29 | 
             
                  def include_platform_for platform
         | 
| 30 30 | 
             
                    super
         | 
| 31 | 
            -
                    if platform[:platform] == : | 
| 31 | 
            +
                    if platform[:platform] == :watir_webdriver
         | 
| 32 | 
            +
                      require 'page-object/platforms/watir_webdriver/link'
         | 
| 33 | 
            +
                      self.class.send :include, PageObject::Platforms::WatirWebDriver::Link
         | 
| 34 | 
            +
                    elsif platform[:platform] == :selenium_webdriver
         | 
| 32 35 | 
             
                      require 'page-object/platforms/selenium_webdriver/link'
         | 
| 33 36 | 
             
                      self.class.send :include, PageObject::Platforms::SeleniumWebDriver::Link
         | 
| 37 | 
            +
                    else
         | 
| 38 | 
            +
                      raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
         | 
| 34 39 | 
             
                    end
         | 
| 35 40 | 
             
                  end
         | 
| 36 41 | 
             
                end
         | 
| @@ -104,7 +104,7 @@ module PageObject | |
| 104 104 | 
             
                                     :svg]
         | 
| 105 105 |  | 
| 106 106 | 
             
                def self.generate_locators(target)
         | 
| 107 | 
            -
             | 
| 107 | 
            +
                  ADVANCED_ELEMENTS.each do |tag|
         | 
| 108 108 | 
             
                    target.send(:define_method, "#{tag.to_s}_element") do |*identifier|
         | 
| 109 109 | 
             
                      @platform.send "#{tag.to_s}_for", locator(identifier)
         | 
| 110 110 | 
             
                    end
         | 
| @@ -10,7 +10,7 @@ module PageObject | |
| 10 10 | 
             
                    # @return [PageObject::Elements::Option]
         | 
| 11 11 | 
             
                    #
         | 
| 12 12 | 
             
                    def [](idx)
         | 
| 13 | 
            -
                       | 
| 13 | 
            +
                      options[idx]
         | 
| 14 14 | 
             
                    end
         | 
| 15 15 |  | 
| 16 16 | 
             
                    #
         | 
| @@ -34,12 +34,7 @@ module PageObject | |
| 34 34 | 
             
                    # @return [array of PageObject::Elements::Option]
         | 
| 35 35 | 
             
                    #
         | 
| 36 36 | 
             
                    def options
         | 
| 37 | 
            -
                       | 
| 38 | 
            -
                      options = element.wd.find_elements(:xpath, child_xpath)
         | 
| 39 | 
            -
                      options.each do |opt|
         | 
| 40 | 
            -
                        elements << Object::PageObject::Elements::Option.new(opt, :platform => :watir_webdriver)
         | 
| 41 | 
            -
                      end
         | 
| 42 | 
            -
                      elements
         | 
| 37 | 
            +
                      element.options.map { |e| ::PageObject::Elements::Option.new(e, :platform => :watir_webdriver) }
         | 
| 43 38 | 
             
                    end
         | 
| 44 39 |  | 
| 45 40 | 
             
                    #
         | 
| @@ -56,7 +51,6 @@ module PageObject | |
| 56 51 | 
             
                      element.selected_options.map { |e| e.value }.compact
         | 
| 57 52 | 
             
                    end
         | 
| 58 53 |  | 
| 59 | 
            -
             | 
| 60 54 | 
             
                    #
         | 
| 61 55 | 
             
                    # Returns true if the select list has one or more options where text or label matches the given value.
         | 
| 62 56 | 
             
                    #
         | 
    
        data/lib/page-object/version.rb
    CHANGED
    
    
    
        data/page-object.gemspec
    CHANGED
    
    | @@ -21,11 +21,11 @@ Gem::Specification.new do |s| | |
| 21 21 | 
             
              s.require_paths = ["lib"]
         | 
| 22 22 |  | 
| 23 23 | 
             
              s.add_dependency 'watir-webdriver', '>= 0.6.4'
         | 
| 24 | 
            -
              s.add_dependency 'selenium-webdriver', '>= 2. | 
| 25 | 
            -
              s.add_dependency 'page_navigation', '>= 0. | 
| 24 | 
            +
              s.add_dependency 'selenium-webdriver', '>= 2.39.0'
         | 
| 25 | 
            +
              s.add_dependency 'page_navigation', '>= 0.9'
         | 
| 26 26 |  | 
| 27 | 
            -
              s.add_development_dependency 'rspec', '>= 2. | 
| 28 | 
            -
              s.add_development_dependency 'cucumber', '>= 1. | 
| 27 | 
            +
              s.add_development_dependency 'rspec', '>= 2.14.0'
         | 
| 28 | 
            +
              s.add_development_dependency 'cucumber', '>= 1.3.0'
         | 
| 29 29 | 
             
              s.add_development_dependency 'yard', '>= 0.7.2'
         | 
| 30 30 | 
             
              s.add_development_dependency 'rack', '>= 1.0'
         | 
| 31 31 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: page-object
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.9. | 
| 4 | 
            +
              version: 0.9.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jeff Morgan
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-01-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: watir-webdriver
         | 
| @@ -30,56 +30,56 @@ dependencies: | |
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - '>='
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: 2. | 
| 33 | 
            +
                    version: 2.39.0
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - '>='
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: 2. | 
| 40 | 
            +
                    version: 2.39.0
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: page_navigation
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 45 | 
             
                - - '>='
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: '0. | 
| 47 | 
            +
                    version: '0.9'
         | 
| 48 48 | 
             
              type: :runtime
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 52 | 
             
                - - '>='
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: '0. | 
| 54 | 
            +
                    version: '0.9'
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: rspec
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 58 | 
             
                requirements:
         | 
| 59 59 | 
             
                - - '>='
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: 2. | 
| 61 | 
            +
                    version: 2.14.0
         | 
| 62 62 | 
             
              type: :development
         | 
| 63 63 | 
             
              prerelease: false
         | 
| 64 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                requirements:
         | 
| 66 66 | 
             
                - - '>='
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version: 2. | 
| 68 | 
            +
                    version: 2.14.0
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: cucumber
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 72 | 
             
                requirements:
         | 
| 73 73 | 
             
                - - '>='
         | 
| 74 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version: 1. | 
| 75 | 
            +
                    version: 1.3.0
         | 
| 76 76 | 
             
              type: :development
         | 
| 77 77 | 
             
              prerelease: false
         | 
| 78 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 79 | 
             
                requirements:
         | 
| 80 80 | 
             
                - - '>='
         | 
| 81 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version: 1. | 
| 82 | 
            +
                    version: 1.3.0
         | 
| 83 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 84 | 
             
              name: yard
         | 
| 85 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -186,6 +186,7 @@ files: | |
| 186 186 | 
             
            - features/page_level_actions.feature
         | 
| 187 187 | 
             
            - features/paragraph.feature
         | 
| 188 188 | 
             
            - features/radio_button.feature
         | 
| 189 | 
            +
            - features/radio_button_group.feature
         | 
| 189 190 | 
             
            - features/sample-app/public/jquery-1.3.2.js
         | 
| 190 191 | 
             
            - features/sample-app/public/jquery.html
         | 
| 191 192 | 
             
            - features/sample-app/public/prototype-1.6.0.3.js
         | 
| @@ -222,6 +223,7 @@ files: | |
| 222 223 | 
             
            - features/step_definitions/page_level_actions_steps.rb
         | 
| 223 224 | 
             
            - features/step_definitions/page_traversal_steps.rb
         | 
| 224 225 | 
             
            - features/step_definitions/paragraph_steps.rb
         | 
| 226 | 
            +
            - features/step_definitions/radio_button_group_steps.rb
         | 
| 225 227 | 
             
            - features/step_definitions/radio_button_steps.rb
         | 
| 226 228 | 
             
            - features/step_definitions/select_list_steps.rb
         | 
| 227 229 | 
             
            - features/step_definitions/span_steps.rb
         | 
| @@ -314,6 +316,7 @@ files: | |
| 314 316 | 
             
            - lib/page-object/platforms/watir_webdriver/file_field.rb
         | 
| 315 317 | 
             
            - lib/page-object/platforms/watir_webdriver/form.rb
         | 
| 316 318 | 
             
            - lib/page-object/platforms/watir_webdriver/image.rb
         | 
| 319 | 
            +
            - lib/page-object/platforms/watir_webdriver/link.rb
         | 
| 317 320 | 
             
            - lib/page-object/platforms/watir_webdriver/ordered_list.rb
         | 
| 318 321 | 
             
            - lib/page-object/platforms/watir_webdriver/page_object.rb
         | 
| 319 322 | 
             
            - lib/page-object/platforms/watir_webdriver/radio_button.rb
         | 
| @@ -390,7 +393,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 390 393 | 
             
                  version: '0'
         | 
| 391 394 | 
             
            requirements: []
         | 
| 392 395 | 
             
            rubyforge_project: page-object
         | 
| 393 | 
            -
            rubygems_version: 2.0. | 
| 396 | 
            +
            rubygems_version: 2.0.14
         | 
| 394 397 | 
             
            signing_key: 
         | 
| 395 398 | 
             
            specification_version: 4
         | 
| 396 399 | 
             
            summary: Page Object DSL for browser testing
         | 
| @@ -454,6 +457,7 @@ test_files: | |
| 454 457 | 
             
            - features/page_level_actions.feature
         | 
| 455 458 | 
             
            - features/paragraph.feature
         | 
| 456 459 | 
             
            - features/radio_button.feature
         | 
| 460 | 
            +
            - features/radio_button_group.feature
         | 
| 457 461 | 
             
            - features/sample-app/public/jquery-1.3.2.js
         | 
| 458 462 | 
             
            - features/sample-app/public/jquery.html
         | 
| 459 463 | 
             
            - features/sample-app/public/prototype-1.6.0.3.js
         | 
| @@ -490,6 +494,7 @@ test_files: | |
| 490 494 | 
             
            - features/step_definitions/page_level_actions_steps.rb
         | 
| 491 495 | 
             
            - features/step_definitions/page_traversal_steps.rb
         | 
| 492 496 | 
             
            - features/step_definitions/paragraph_steps.rb
         | 
| 497 | 
            +
            - features/step_definitions/radio_button_group_steps.rb
         | 
| 493 498 | 
             
            - features/step_definitions/radio_button_steps.rb
         | 
| 494 499 | 
             
            - features/step_definitions/select_list_steps.rb
         | 
| 495 500 | 
             
            - features/step_definitions/span_steps.rb
         |