Skip to content

Commit

Permalink
first commit to simplify by migrating toward watir
Browse files Browse the repository at this point in the history
  • Loading branch information
cheezy committed Nov 23, 2016
1 parent 456f22b commit 9009122
Show file tree
Hide file tree
Showing 58 changed files with 32 additions and 4,303 deletions.
6 changes: 3 additions & 3 deletions cucumber.yml
Expand Up @@ -2,9 +2,9 @@
std_opts = "--no-source --color --format pretty" # Cucumber::Formatter::Fuubar"
%>

default: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
watir: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
selenium_webdriver: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
default: DRIVER=WATIR <%= std_opts %>
watir: DRIVER=WATIR <%= std_opts %>
selenium_webdriver: DRIVER=SELENIUM <%= std_opts %>
focus: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only --tags @focus
#focus: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only --tags @focus

2 changes: 0 additions & 2 deletions features/button.feature
Expand Up @@ -53,7 +53,6 @@ Feature: Button
| index |
| value |

@watir_only
Scenario Outline: Locating buttons on Watir only
When I search for the button by "<search_by>"
Then I should be able to click the button
Expand All @@ -62,7 +61,6 @@ Feature: Button
| search_by |
| text |

@dane
Scenario Outline: Getting the text from a button
When I get the text for a button that is a "<tag>"
Then the text should be "This button is a <tag>"
Expand Down
35 changes: 0 additions & 35 deletions features/element.feature
Expand Up @@ -43,12 +43,10 @@ Feature: Elements
And I should know the attribute "href" includes "success.html"
And I should be able to click it

@watir_only
Scenario: Link element methods for watir
When I retrieve a link element
Then I should know the value is ""


Scenario: Button element methods
When I retrieve a button element
Then I should know it exists
Expand All @@ -59,7 +57,6 @@ Feature: Elements
And I should know the attribute "readonly" is false
And I should be able to click it

@watir_only
Scenario: Button element methods for watir
When I retrieve a button element
Then I should know the text is "Click Me"
Expand All @@ -85,16 +82,10 @@ Feature: Elements
And I should know the attribute "readonly" is false
And I should be able to click it

@watir_only
Scenario: Div element methods for watir
When I retrieve the div element
Then I should know the value is ""

@selenium_only
Scenario: Div element methods for selenium
When I retrieve the div element
Then I should know the value is nil

Scenario: Radio Button element methods
When I retrieve a radio button
Then I should know it exists
Expand Down Expand Up @@ -126,17 +117,11 @@ Feature: Elements
And I should know the attribute "readonly" is false
And I should be able to click it

@watir_only
Scenario: Table element methods in watir
When I retrieve a table element
Then I should know it exists
And I should know the value is ""

@selenium_only
Scenario: Table element methods in selenium
When I retrieve a table element
Then I should know the value is nil

Scenario: Table Cell element methods
When I retrieve table cell
Then I should know it exists
Expand All @@ -147,16 +132,10 @@ Feature: Elements
And I should know the attribute "readonly" is false
And I should be able to click it

@watir_only
Scenario: Table Cell element methods in watir
When I retrieve table cell
Then I should know the value is ""

@selenium_only
Scenario: Table Cell element methods in selenium
When I retrieve table cell
Then I should know the value is nil

Scenario: Text Field element methods
When I retrieve a text field
Then I should know it exists
Expand Down Expand Up @@ -189,16 +168,10 @@ Feature: Elements
And I should know the attribute "readonly" is false
And I should be able to click it

@watir_only
Scenario: Image element methods in watir
When I get the image element
Then I should know the value is ""

@selenium_only
Scenario: Image element methods in selenium
When I get the image element
Then I should know the value is nil

Scenario: Hidden Field element methods
When I retrieve the hidden field element
Then I should know it exists
Expand All @@ -218,16 +191,10 @@ Feature: Elements
And I should know the tag name is "form"
And I should know the attribute "readonly" is false

@watir_only
Scenario: Form element methods in watir
When I locate the form
Then I should know the value is ""

@selenium_only
Scenario: Form element methods in selenium
When I locate the form
Then I should know the value is nil

Scenario: List item element methods
When I retrieve a list item element
Then I should know it exists
Expand Down Expand Up @@ -308,13 +275,11 @@ Feature: Elements
And I scroll the heading element into view
Then the heading element should be visible

@watir_only
Scenario: Expanding how we find elements to include non-standard locators
When I retrieve a div using data-entity
Then I should know it exists
And I should know it is visible
And I should know the text is "found using data-entity"


Scenario: Accessing an HTML 5 element using the declaration
When I retrieve the figure using the declaration
Expand Down
2 changes: 0 additions & 2 deletions features/frames.feature
Expand Up @@ -9,13 +9,11 @@ Feature: Handling frames
When I type "page-object" into the text field for frame 2 using "index"
Then I should verify "page-object" is in the text field for frame 2 using "index"

@watir_only
Scenario: Accessing elements within the frame using Regexp
Given I am on the frame elements page
When I type "page-object" into the text field for frame 2 using "regex"
Then I should verify "page-object" is in the text field for frame 2 using "regex"

@watir_only
Scenario: Accessing elements within the frame using multiple identifiers
Given I am on the iframe elements page
When I type "page-object" into the text field for frame 2 using "multiple identifiers"
Expand Down
1 change: 0 additions & 1 deletion features/gxt_table_extension.feature
Expand Up @@ -13,7 +13,6 @@ Feature: Gxt Table Extension
When I retrieve a GxtTable widget
Then I should know it is visible

@watir_only
Scenario: Determine if a GxtTable exists
When I retrieve a GxtTable widget
Then I should know it exists
Expand Down
4 changes: 0 additions & 4 deletions features/step_definitions/element_steps.rb
Expand Up @@ -90,10 +90,6 @@
@element.value.should == value
end

Then /^I should know the value is nil$/ do
@element.value.should be_nil
end

Then /^I should know it is equal to itself$/ do
@element.should == @element
end
Expand Down
6 changes: 1 addition & 5 deletions features/step_definitions/indexed_property_steps.rb
Expand Up @@ -113,11 +113,7 @@ def page
end

Then(/^I should see that the element doesn't exist for that index/) do
if page.platform.class == PageObject::Platforms::SeleniumWebDriver::PageObject
expect { page.other_table[@index].text_table_element.text }.to raise_error Selenium::WebDriver::Error::NoSuchElementError
else
expect { page.other_table[@index].text_table_element.text }.to raise_error Watir::Exception::UnknownObjectException
end
expect { page.other_table[@index].text_table_element.text }.to raise_error Watir::Exception::UnknownObjectException
end

When(/^I search for an element by an index on an indexed property$/) do
Expand Down
1 change: 0 additions & 1 deletion features/table.feature
Expand Up @@ -104,7 +104,6 @@ Feature: Table
When I retrieve a table element while the script is executing
And the data for row "2" should be "Data1" and "Data2"

@watir_only
Scenario: Finding an existing table
Then I should see that the table exists

Expand Down
1 change: 0 additions & 1 deletion features/table_cell.feature
Expand Up @@ -21,7 +21,6 @@ Feature: Table Cell
| text |
| css |

@watir_only
Scenario Outline: Locating table cells on the Page with watir
When I search for the table cell by "<search_by>"
Then the cell data should be 'Data4'
Expand Down
2 changes: 0 additions & 2 deletions features/table_row.feature
Expand Up @@ -19,12 +19,10 @@ Feature: Table Row
| css |


@watir_only
Scenario: Locating table rows on the Page by text
When I search for the table row by "text"
Then the row data should be 'Data1 Data2'

@watir_only
Scenario Outline: Locating table rows on the Page with watir
When I search for the table row by "<search_by>"
Then the row data should be 'Data1 Data2'
Expand Down
9 changes: 0 additions & 9 deletions features/text_field.feature
Expand Up @@ -26,22 +26,13 @@ Feature: Text Fields
| css |


@watir_only
Scenario Outline: Locating text fields on the Page using Watir
When I search for the text field by "<search_by>"
Then I should be able to type "I found it" into the field
Examples:
| search_by |
| data_field |

@selenium_only
Scenario Outline: Locating text fields on the Page using Watir
When I search for the text field by "<search_by>"
Then I should be able to type "I found it" into the field
Examples:
| search_by |
| text |

Scenario Outline: Locating a text field using multiple parameters
When I search for the text field by "<param1>" and "<param2>"
Then I should be able to type "I found it" into the field
Expand Down
2 changes: 0 additions & 2 deletions lib/page-object.rb
Expand Up @@ -13,8 +13,6 @@
require 'watir'
require 'page-object/platforms/watir/element'
require 'page-object/platforms/watir/page_object'
require 'page-object/platforms/selenium_webdriver/element'
require 'page-object/platforms/selenium_webdriver/page_object'

require 'selenium/webdriver/common/error'
#
Expand Down
11 changes: 8 additions & 3 deletions lib/page-object/platforms/selenium_webdriver.rb
Expand Up @@ -3,7 +3,8 @@ module Platforms
module SeleniumWebDriver

def self.create_page_object(browser)
SeleniumWebDriver::PageObject.new(browser)
browser = Watir::Browser.new(browser) if browser.is_a?(Selenium::WebDriver::Driver)
WatirWebDriver::PageObject.new(browser)
end

def self.is_for?(browser)
Expand All @@ -12,8 +13,12 @@ def self.is_for?(browser)
end

def self.browser_for root
return root if root.is_a?(::Selenium::WebDriver::Driver)
Selenium::WebDriver::Driver.new(root.send(:bridge))
watir_browser_for(root).browser
end

def self.watir_browser_for(root)
return Watir::Browser.new(root) if root.is_a?(::Selenium::WebDriver::Driver)
Watir::Browser.new(Selenium::WebDriver::Driver.new(root.send(:bridge)))
end

def self.root_element_for root
Expand Down
15 changes: 0 additions & 15 deletions lib/page-object/platforms/selenium_webdriver/button.rb

This file was deleted.

29 changes: 0 additions & 29 deletions lib/page-object/platforms/selenium_webdriver/check_box.rb

This file was deleted.

0 comments on commit 9009122

Please sign in to comment.