page-object 0.0.5 → 0.1
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.
- data/ChangeLog +46 -1
- data/README.md +2 -0
- data/cucumber.yml +2 -2
- data/features/button.feature +11 -2
- data/features/check_box.feature +7 -5
- data/features/div.feature +7 -15
- data/features/{element.feature → element_attributes.feature} +1 -1
- data/features/form.feature +7 -6
- data/features/hidden_field.feature +9 -1
- data/features/html/static_elements.html +6 -1
- data/features/image.feature +9 -9
- data/features/link.feature +8 -1
- data/features/list_item.feature +6 -13
- data/features/ordered_list.feature +9 -17
- data/features/radio_button.feature +7 -6
- data/features/select_list.feature +12 -10
- data/features/span.feature +7 -15
- data/features/step_definitions/accessor_steps.rb +101 -26
- data/features/step_definitions/element_steps.rb +5 -0
- data/features/support/page.rb +36 -0
- data/features/table.feature +6 -15
- data/features/table_cell.feature +6 -12
- data/features/text_area.feature +7 -6
- data/features/text_field.feature +7 -6
- data/features/unordered_list.feature +9 -17
- data/lib/page-object/accessors.rb +93 -76
- data/lib/page-object/elements.rb +1 -0
- data/lib/page-object/elements/element.rb +76 -6
- data/lib/page-object/elements/option.rb +7 -0
- data/lib/page-object/elements/select_list.rb +24 -1
- data/lib/page-object/page_factory.rb +3 -3
- data/lib/page-object/platforms/selenium_select_list.rb +29 -0
- data/lib/page-object/platforms/watir_select_list.rb +30 -0
- data/lib/page-object/selenium_page_object.rb +53 -3
- data/lib/page-object/version.rb +1 -1
- data/lib/page-object/watir_page_object.rb +20 -1
- data/page-object.gemspec +2 -2
- data/spec/page-object/accessors_spec.rb +2 -2
- data/spec/page-object/elements/button_spec.rb +1 -1
- data/spec/page-object/elements/check_box_spec.rb +1 -1
- data/spec/page-object/elements/div_spec.rb +1 -1
- data/spec/page-object/elements/hidden_field_spec.rb +1 -1
- data/spec/page-object/elements/image_spec.rb +1 -1
- data/spec/page-object/elements/link_spec.rb +1 -1
- data/spec/page-object/elements/list_item_spec.rb +1 -1
- data/spec/page-object/elements/ordered_list_spec.rb +1 -1
- data/spec/page-object/elements/radio_button_spec.rb +1 -1
- data/spec/page-object/elements/select_list_spec.rb +43 -2
- data/spec/page-object/elements/span_spec.rb +1 -1
- data/spec/page-object/elements/table_row_spec.rb +5 -1
- data/spec/page-object/elements/table_spec.rb +1 -1
- data/spec/page-object/elements/text_area_spec.rb +1 -1
- data/spec/page-object/elements/text_field_spec.rb +1 -1
- data/spec/page-object/elements/unordered_list_spec.rb +1 -1
- metadata +9 -6
data/ChangeLog
CHANGED
@@ -1,3 +1,48 @@
|
|
1
|
+
=== Version 0.1 / 2011-07-01
|
2
|
+
* Enhancements
|
3
|
+
* Support for using multiple identifiers when locating the following element:
|
4
|
+
* Link
|
5
|
+
* TextField
|
6
|
+
* HiddenField
|
7
|
+
* TextArea
|
8
|
+
* SelectList
|
9
|
+
* CheckBox
|
10
|
+
* RadioButton
|
11
|
+
* Button
|
12
|
+
* Div
|
13
|
+
* Span
|
14
|
+
* Table
|
15
|
+
* TableCell
|
16
|
+
* Image
|
17
|
+
* Form
|
18
|
+
* ListItem
|
19
|
+
* UnorderedList
|
20
|
+
* OrderedList
|
21
|
+
* Selenium support for using index for the following elements:
|
22
|
+
* Link
|
23
|
+
* TextField
|
24
|
+
* HiddenField
|
25
|
+
* TextArea
|
26
|
+
* SelectList
|
27
|
+
* CheckBox
|
28
|
+
* RadioButton
|
29
|
+
* Button
|
30
|
+
* Div
|
31
|
+
* Span
|
32
|
+
* Table
|
33
|
+
* Image
|
34
|
+
* Form
|
35
|
+
* ListItem
|
36
|
+
* UnorderedList
|
37
|
+
* OrderedList
|
38
|
+
* Support name for identification across all elements in Watir
|
39
|
+
* Added [] method to SelectList to index Options
|
40
|
+
* Added options method to Select List
|
41
|
+
* Added support for the following elements
|
42
|
+
* Option
|
43
|
+
* Updated to use selenium-webdriver 0.2.2
|
44
|
+
* Updated to use watir-webdriver 0.2.5
|
45
|
+
|
1
46
|
=== Version 0.0.5 / 2011-06-15
|
2
47
|
* Enhancements
|
3
48
|
* Added rows method to Table to return number or rows
|
@@ -57,4 +102,4 @@
|
|
57
102
|
* Support for the following page level functions
|
58
103
|
* text
|
59
104
|
* html
|
60
|
-
* title
|
105
|
+
* title
|
data/README.md
CHANGED
@@ -68,6 +68,8 @@ The rdocs for this project can be found at [rubydoc.info](http://rubydoc.info/gi
|
|
68
68
|
|
69
69
|
If you wish to view the current tracker board you can view it on [Pivotal Tracker](https://www.pivotaltracker.com/projects/289099)
|
70
70
|
|
71
|
+
To see the changes from release to release please look at the [ChangeLog](https://raw.github.com/cheezy/page-object/master/ChangeLog)
|
72
|
+
|
71
73
|
To read about the motivation for this gem please read this [blog entry](http://www.cheezyworld.com/2010/11/19/ui-tests-introducing-a-simple-dsl/)
|
72
74
|
|
73
75
|
## Known Issues
|
data/cucumber.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
default: DRIVER=WATIR --no-source --color --format pretty --tags ~@selenium_only
|
2
2
|
watir: DRIVER=WATIR --no-source --color --format pretty --tags ~@selenium_only
|
3
3
|
selenium: DRIVER=SELENIUM --no-source --color --format pretty --tags ~@watir_only
|
4
|
-
watir_focus: DRIVER=WATIR --no-source --color --format pretty --tags @focus
|
5
|
-
selenium_focus: DRIVER=SELENIUM --no-source --color --format pretty --tags @focus
|
4
|
+
watir_focus: DRIVER=WATIR --no-source --color --format pretty --tags @focus --tags ~@selenium_only
|
5
|
+
selenium_focus: DRIVER=SELENIUM --no-source --color --format pretty --tags @focus --tags ~@watir_only
|
6
6
|
autotest: DRIVER=WATIR --no-source --color --format pretty --tags ~@selenium_only
|
7
7
|
|
data/features/button.feature
CHANGED
@@ -25,13 +25,22 @@ Feature: Button
|
|
25
25
|
| class |
|
26
26
|
| name |
|
27
27
|
| xpath |
|
28
|
+
| index |
|
28
29
|
|
29
30
|
@watir_only
|
30
|
-
Scenario Outline: Locating
|
31
|
+
Scenario Outline: Locating buttons on Watir only
|
31
32
|
When I search for the button by "<search_by>"
|
32
33
|
Then I should be able to click the button
|
33
34
|
|
34
35
|
Scenarios:
|
35
36
|
| search_by |
|
36
|
-
| index |
|
37
37
|
| text |
|
38
|
+
|
39
|
+
Scenario Outline: Locating button using multiple parameters
|
40
|
+
When I search for the button by "<param1>" and "<param2>"
|
41
|
+
Then I should be able to click the button
|
42
|
+
|
43
|
+
Scenarios:
|
44
|
+
| param1 | param2 |
|
45
|
+
| class | index |
|
46
|
+
| name | index |
|
data/features/check_box.feature
CHANGED
@@ -22,15 +22,17 @@ Feature: Check Box
|
|
22
22
|
| class |
|
23
23
|
| name |
|
24
24
|
| xpath |
|
25
|
+
| index |
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
When I search for the check box by "<search_by>"
|
27
|
+
Scenario Outline: Locating check boxes using multiple parameters
|
28
|
+
When I search for the check box by "<param1>" and "<param2>"
|
29
29
|
Then I should be able to check the check box
|
30
30
|
|
31
31
|
Scenarios:
|
32
|
-
|
|
33
|
-
| index
|
32
|
+
| param1 | param2 |
|
33
|
+
| class | index |
|
34
|
+
| name | index |
|
35
|
+
|
34
36
|
|
35
37
|
Scenario: Retrieve a CheckBox
|
36
38
|
When I retrieve a check box element
|
data/features/div.feature
CHANGED
@@ -24,22 +24,14 @@ Feature: Div
|
|
24
24
|
| id |
|
25
25
|
| class |
|
26
26
|
| xpath |
|
27
|
-
|
28
|
-
@watir_only
|
29
|
-
Scenario Outline: Locating divs on Watir only
|
30
|
-
When I search for the div by "<search_by>"
|
31
|
-
Then the text should be "page-object rocks!"
|
32
|
-
|
33
|
-
Scenarios:
|
34
|
-
| search_by |
|
35
27
|
| index |
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
When I search for the div by "<search_by>"
|
28
|
+
| name |
|
29
|
+
|
30
|
+
Scenario Outline: Locating divs using multiple parameters
|
31
|
+
When I search for the div by "<param1>" and "<param2>"
|
41
32
|
Then the text should be "page-object rocks!"
|
42
33
|
|
43
34
|
Scenarios:
|
44
|
-
|
|
45
|
-
|
|
35
|
+
| param1 | param2 |
|
36
|
+
| class | index |
|
37
|
+
| name | index |
|
data/features/form.feature
CHANGED
@@ -16,13 +16,14 @@ Feature: Form
|
|
16
16
|
| id |
|
17
17
|
| class |
|
18
18
|
| xpath |
|
19
|
+
| index |
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
When I locate the form by "<search_by>"
|
21
|
+
Scenario Outline: Locating table using multiple parameters
|
22
|
+
When I locate the form using "<param1>" and "<param2>"
|
23
23
|
Then I should be able to submit the form
|
24
|
-
|
24
|
+
|
25
25
|
Scenarios:
|
26
|
-
|
|
27
|
-
| index
|
26
|
+
| param1 | param2 |
|
27
|
+
| class | index |
|
28
|
+
| name | index |
|
28
29
|
|
@@ -19,6 +19,7 @@ Feature: Hidden Fields
|
|
19
19
|
| xpath |
|
20
20
|
| css |
|
21
21
|
| tag_name |
|
22
|
+
| index |
|
22
23
|
|
23
24
|
@watir_only
|
24
25
|
Scenario Outline: Locating hidden fields on Watir only
|
@@ -27,6 +28,13 @@ Feature: Hidden Fields
|
|
27
28
|
|
28
29
|
Scenarios:
|
29
30
|
| search_by |
|
30
|
-
| index |
|
31
31
|
| text |
|
32
32
|
|
33
|
+
Scenario Outline: Locating a hidden field using multiple parameters
|
34
|
+
When I search for the hidden field by "<param1>" and "<param2>"
|
35
|
+
Then hidden field element should contains "12345"
|
36
|
+
|
37
|
+
Scenarios:
|
38
|
+
| param1 | param2 |
|
39
|
+
| class | index |
|
40
|
+
| name | index |
|
data/features/image.feature
CHANGED
@@ -19,14 +19,14 @@ Feature: Image
|
|
19
19
|
| class |
|
20
20
|
| name |
|
21
21
|
| xpath |
|
22
|
-
|
23
|
-
@watir_only
|
24
|
-
Scenario Outline: Locating an image on the page with Watir
|
25
|
-
When I get the image element by "<search_by>"
|
26
|
-
Then the image should be "106" pixels wide
|
27
|
-
And the image should be "106" pixels tall
|
28
|
-
|
29
|
-
Scenarios:
|
30
|
-
| search_by |
|
31
22
|
| index |
|
32
23
|
|
24
|
+
Scenario Outline: Locating an image using multiple parameters
|
25
|
+
When I get the image element by "<param1>" and "<param2>"
|
26
|
+
Then the image should be "106" pixels wide
|
27
|
+
And the image should be "106" pixels tall
|
28
|
+
|
29
|
+
Scenarios:
|
30
|
+
| param1 | param2 |
|
31
|
+
| class | index |
|
32
|
+
| name | index |
|
data/features/link.feature
CHANGED
@@ -22,6 +22,7 @@ Feature: Links
|
|
22
22
|
| link |
|
23
23
|
| link_text |
|
24
24
|
| text |
|
25
|
+
| index |
|
25
26
|
|
26
27
|
@watir_only
|
27
28
|
Scenario Outline: Locating links on Watir only
|
@@ -31,8 +32,14 @@ Feature: Links
|
|
31
32
|
Scenarios:
|
32
33
|
| search_by |
|
33
34
|
| href |
|
34
|
-
| index |
|
35
35
|
|
36
|
+
Scenario: Support for multiple parameters
|
37
|
+
When I select a link labeled "Hello" and index "0"
|
38
|
+
Then the page should contain the text "Success"
|
39
|
+
Given I am on the static elements page
|
40
|
+
When I select a link labeled "Hello" and index "1"
|
41
|
+
Then the page should contain the text "Success"
|
42
|
+
|
36
43
|
Scenario: Retrieve a Link
|
37
44
|
When I retrieve a link element
|
38
45
|
Then I should know it exists
|
data/features/list_item.feature
CHANGED
@@ -16,21 +16,14 @@ Feature: List item
|
|
16
16
|
| id |
|
17
17
|
| class |
|
18
18
|
| xpath |
|
19
|
-
|
20
|
-
@watir_only
|
21
|
-
Scenario Outline: Locating list items on Watir only
|
22
|
-
When I search for the list item by "<search_by>"
|
23
|
-
Then the text should be "Item One"
|
24
|
-
|
25
|
-
Scenarios:
|
26
|
-
| search_by |
|
27
19
|
| index |
|
20
|
+
| name |
|
28
21
|
|
29
|
-
|
30
|
-
|
31
|
-
When I search for the list item by "<search_by>"
|
22
|
+
Scenario Outline: Locating list items using multiple parameters
|
23
|
+
When I search for the list item by "<param1>" and "<param2>"
|
32
24
|
Then the text should be "Item One"
|
33
25
|
|
34
26
|
Scenarios:
|
35
|
-
|
|
36
|
-
|
|
27
|
+
| param1 | param2 |
|
28
|
+
| class | index |
|
29
|
+
| name | index |
|
@@ -5,12 +5,12 @@ Feature: Ordered list
|
|
5
5
|
|
6
6
|
Scenario: Getting the first element from the ordered list
|
7
7
|
When I get the first item from the ordered list
|
8
|
-
Then the list
|
8
|
+
Then the list items text should be "Number One"
|
9
9
|
|
10
10
|
Scenario Outline: Locating ordered lists on the page
|
11
11
|
When I search for the ordered list by "<search_by>"
|
12
12
|
And I get the first item from the list
|
13
|
-
Then the list
|
13
|
+
Then the list items text should be "Number One"
|
14
14
|
And the list should contain 3 items
|
15
15
|
And each item should contain "Number"
|
16
16
|
|
@@ -19,23 +19,15 @@ Feature: Ordered list
|
|
19
19
|
| id |
|
20
20
|
| class |
|
21
21
|
| xpath |
|
22
|
-
|
23
|
-
@watir_only
|
24
|
-
Scenario Outline: Locating ordered lists in Watir only
|
25
|
-
When I search for the ordered list by "<search_by>"
|
26
|
-
And I get the first item from the list
|
27
|
-
Then the list item's text should be "Number One"
|
28
|
-
|
29
|
-
Scenarios:
|
30
|
-
| search_by |
|
31
22
|
| index |
|
23
|
+
| name |
|
32
24
|
|
33
|
-
|
34
|
-
|
35
|
-
When I search for the ordered list by "<search_by>"
|
25
|
+
Scenario Outline: Locating ordered lists using multiple parameters
|
26
|
+
When I search for the ordered list by "<param1>" and "<param2>"
|
36
27
|
And I get the first item from the list
|
37
|
-
Then the list
|
28
|
+
Then the list items text should be "Number One"
|
38
29
|
|
39
30
|
Scenarios:
|
40
|
-
|
|
41
|
-
|
|
31
|
+
| param1 | param2 |
|
32
|
+
| class | index |
|
33
|
+
| name | index |
|
@@ -23,16 +23,17 @@ Feature: Radio Buttons
|
|
23
23
|
| class |
|
24
24
|
| name |
|
25
25
|
| xpath |
|
26
|
+
| index |
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
When I search for the radio button by "<search_by>"
|
28
|
+
Scenario Outline: Locating radio buttons using multiple parameters
|
29
|
+
When I search for the radio button by "<param1>" and "<param2>"
|
30
30
|
And I select the radio button
|
31
31
|
Then the "Milk" radio button should be selected
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
Scenarios:
|
34
|
+
| param1 | param2 |
|
35
|
+
| class | index |
|
36
|
+
| name | index |
|
36
37
|
|
37
38
|
Scenario: Retrieve a radio button
|
38
39
|
When I retrieve a radio button
|
@@ -21,18 +21,20 @@ Feature: Select List
|
|
21
21
|
| class |
|
22
22
|
| name |
|
23
23
|
| xpath |
|
24
|
+
| index |
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
When I search for the select list by "<search_by>"
|
26
|
+
Scenario Outline: Locating a hidden field using multiple parameters
|
27
|
+
When I search for the select list by "<param1>" and "<param2>"
|
28
28
|
Then I should be able to select "Test 2"
|
29
29
|
And the value for the selected item should be "option2"
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
Scenarios:
|
32
|
+
| param1 | param2 |
|
33
|
+
| class | index |
|
34
|
+
| name | index |
|
34
35
|
|
35
|
-
Scenario:
|
36
|
-
When I
|
37
|
-
Then
|
38
|
-
And
|
36
|
+
Scenario: Iterating through the options in the select list
|
37
|
+
When I search for the select list by "id"
|
38
|
+
Then option "1" should contain "Test 1"
|
39
|
+
And option "2" should contain "Test 2"
|
40
|
+
And each option should contain "Test"
|
data/features/span.feature
CHANGED
@@ -16,22 +16,14 @@ Feature: Span
|
|
16
16
|
| id |
|
17
17
|
| class |
|
18
18
|
| xpath |
|
19
|
-
|
20
|
-
@watir_only
|
21
|
-
Scenario Outline: Locating span on Watir only
|
22
|
-
When I search for the span by "<search_by>"
|
23
|
-
Then the text should be "My alert"
|
24
|
-
|
25
|
-
Scenarios:
|
26
|
-
| search_by |
|
27
19
|
| index |
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
When I search for the span by "<search_by>"
|
20
|
+
| name |
|
21
|
+
|
22
|
+
Scenario Outline: Locating span using multiple parameters
|
23
|
+
When I search for the span by "<param1>" and "<param2>"
|
33
24
|
Then the text should be "My alert"
|
34
25
|
|
35
26
|
Scenarios:
|
36
|
-
|
|
37
|
-
|
|
27
|
+
| param1 | param2 |
|
28
|
+
| class | index |
|
29
|
+
| name | index |
|
@@ -10,23 +10,31 @@ When /^I search for the text field by "([^\"]*)"$/ do |how|
|
|
10
10
|
@how = how
|
11
11
|
end
|
12
12
|
|
13
|
+
When /^I search for the text field by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
14
|
+
@how = "#{param1}_#{param2}"
|
15
|
+
end
|
16
|
+
|
13
17
|
Then /^I should be able to type "([^\"]*)" into the field$/ do |value|
|
14
18
|
@page.send "text_field_#{@how}=".to_sym, value
|
15
19
|
end
|
16
20
|
|
17
|
-
When /^I type "([
|
21
|
+
When /^I type "([^\"]*)" into the text area$/ do |text|
|
18
22
|
@page.text_area_id = text
|
19
23
|
end
|
20
24
|
|
21
|
-
Then /^the text area should contain "([
|
25
|
+
Then /^the text area should contain "([^\"]*)"$/ do |expected_text|
|
22
26
|
@page.text_area_id.should == expected_text
|
23
27
|
end
|
24
28
|
|
25
|
-
When /^I search for the text area by "([
|
29
|
+
When /^I search for the text area by "([^\"]*)"$/ do |how|
|
26
30
|
@how = how
|
27
31
|
end
|
28
32
|
|
29
|
-
|
33
|
+
When /^I search for the text area by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
34
|
+
@how = "#{param1}_#{param2}"
|
35
|
+
end
|
36
|
+
|
37
|
+
Then /^I should be able to type "([^\"]*)" into the area$/ do |value|
|
30
38
|
@page.send "text_area_#{@how}=".to_sym, value
|
31
39
|
end
|
32
40
|
|
@@ -54,6 +62,10 @@ When /^I search for the select list by "([^\"]*)"$/ do |how|
|
|
54
62
|
@how = how
|
55
63
|
end
|
56
64
|
|
65
|
+
When /^I search for the select list by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
66
|
+
@how = "#{param1}_#{param2}"
|
67
|
+
end
|
68
|
+
|
57
69
|
Then /^I should be able to select "([^\"]*)"$/ do |value|
|
58
70
|
@page.send "sel_list_#{@how}=".to_sym, value
|
59
71
|
end
|
@@ -83,6 +95,10 @@ When /^I search for the check box by "([^\"]*)"$/ do |how|
|
|
83
95
|
@how = how
|
84
96
|
end
|
85
97
|
|
98
|
+
When /^I search for the check box by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
99
|
+
@how = "#{param1}_#{param2}"
|
100
|
+
end
|
101
|
+
|
86
102
|
Then /^I should be able to check the check box$/ do
|
87
103
|
@page.send "check_cb_#{@how}".to_sym
|
88
104
|
end
|
@@ -99,6 +115,10 @@ When /^I search for the radio button by "([^\"]*)"$/ do |how|
|
|
99
115
|
@how = how
|
100
116
|
end
|
101
117
|
|
118
|
+
When /^I search for the radio button by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
119
|
+
@how = "#{param1}_#{param2}"
|
120
|
+
end
|
121
|
+
|
102
122
|
When /^I select the radio button$/ do
|
103
123
|
@page.send "select_milk_#{@how}".to_sym
|
104
124
|
end
|
@@ -107,22 +127,29 @@ When /^I get the text from the div$/ do
|
|
107
127
|
@text = @page.div_id
|
108
128
|
end
|
109
129
|
|
110
|
-
Then /^the text should be "([
|
130
|
+
Then /^the text should be "([^\"]*)"$/ do |expected_text|
|
111
131
|
@text.should == expected_text
|
112
132
|
end
|
113
133
|
|
114
|
-
When /^I search for the div by "([
|
134
|
+
When /^I search for the div by "([^\"]*)"$/ do |how|
|
115
135
|
@text = @page.send "div_#{how}".to_sym
|
116
136
|
end
|
117
137
|
|
138
|
+
When /^I search for the div by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
139
|
+
@text = @page.send "div_#{param1}_#{param2}".to_sym
|
140
|
+
end
|
141
|
+
|
118
142
|
When /^I get the text from the span$/ do
|
119
143
|
@text = @page.span_id
|
120
144
|
end
|
121
145
|
|
122
|
-
When /^I search for the span by "([
|
146
|
+
When /^I search for the span by "([^\"]*)"$/ do |how|
|
123
147
|
@text = @page.send "span_#{how}".to_sym
|
124
148
|
end
|
125
149
|
|
150
|
+
When /^I search for the span by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
151
|
+
@text = @page.send "span_#{param1}_#{param2}".to_sym
|
152
|
+
end
|
126
153
|
|
127
154
|
When /^I click the button$/ do
|
128
155
|
@page.button_id
|
@@ -133,82 +160,115 @@ Then /^I should be on the success page$/ do
|
|
133
160
|
@page.title.should == 'Success'
|
134
161
|
end
|
135
162
|
|
136
|
-
When /^I search for the button by "([
|
163
|
+
When /^I search for the button by "([^\"]*)"$/ do |how|
|
137
164
|
@how = how
|
138
165
|
end
|
139
166
|
|
167
|
+
When /^I search for the button by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
168
|
+
@how = "#{param1}_#{param2}"
|
169
|
+
end
|
170
|
+
|
140
171
|
Then /^I should be able to click the button$/ do
|
141
172
|
@page.send "button_#{@how}"
|
142
173
|
end
|
143
174
|
|
144
|
-
When /^I search for the table cell by "([
|
175
|
+
When /^I search for the table cell by "([^\"]*)"$/ do |how|
|
145
176
|
@cell_data = @page.send "cell_#{how}"
|
146
177
|
end
|
147
178
|
|
148
|
-
When /^I retrieve a table element by "([^"]*)"$/ do |
|
179
|
+
When /^I retrieve a table cell element by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
180
|
+
@cell_data = @page.send "cell_#{param1}_#{param2}"
|
181
|
+
end
|
182
|
+
|
183
|
+
When /^I retrieve a table element by "([^\"]*)"$/ do |how|
|
149
184
|
@element = @page.send "table_#{how}_table"
|
150
185
|
end
|
151
186
|
|
187
|
+
When /^I retrieve a table element by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
188
|
+
@element = @page.send "table_#{param1}_#{param2}_table"
|
189
|
+
end
|
190
|
+
|
152
191
|
When /^I get the image element$/ do
|
153
192
|
@element = @page.image_id_image
|
154
193
|
end
|
155
194
|
|
156
|
-
Then /^the image should be "([
|
195
|
+
Then /^the image should be "([^\"]*)" pixels wide$/ do |width|
|
157
196
|
@element.width.should == width.to_i
|
158
197
|
end
|
159
198
|
|
160
|
-
Then /^the image should be "([
|
199
|
+
Then /^the image should be "([^\"]*)" pixels tall$/ do |height|
|
161
200
|
@element.height.should == height.to_i
|
162
201
|
end
|
163
202
|
|
164
|
-
When /^I get the image element by "([
|
203
|
+
When /^I get the image element by "([^\"]*)"$/ do |how|
|
165
204
|
@element = @page.send "image_#{how}_image"
|
166
205
|
end
|
167
206
|
|
207
|
+
When /^I get the image element by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
208
|
+
@element = @page.send "image_#{param1}_#{param2}_image"
|
209
|
+
end
|
210
|
+
|
168
211
|
When /^I retrieve the hidden field element$/ do
|
169
212
|
@element = @page.hidden_field_id_hidden_field
|
170
213
|
end
|
171
214
|
|
172
|
-
Then /^I should see the hidden field contains "([
|
215
|
+
Then /^I should see the hidden field contains "([^\"]*)"$/ do |text|
|
173
216
|
@page.hidden_field_id.should == text
|
174
217
|
end
|
175
218
|
|
176
|
-
When /^I search for the hidden field by "([
|
219
|
+
When /^I search for the hidden field by "([^\"]*)"$/ do |how|
|
177
220
|
@element = @page.send "hidden_field_#{how}_hidden_field"
|
178
221
|
end
|
179
222
|
|
180
|
-
Then /^hidden field element should contains "([
|
223
|
+
Then /^hidden field element should contains "([^\"]*)"$/ do |text|
|
181
224
|
@element.value.should == text
|
182
225
|
end
|
183
226
|
|
227
|
+
When /^I search for the hidden field by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
228
|
+
@element = @page.send "hidden_field_#{param1}_#{param2}_hidden_field"
|
229
|
+
end
|
230
|
+
|
184
231
|
Then /^I should be able to submit the form$/ do
|
185
232
|
@element.submit
|
186
233
|
end
|
187
234
|
|
188
|
-
When /^I locate the form by "([
|
235
|
+
When /^I locate the form by "([^\"]*)"$/ do |how|
|
189
236
|
@element = @page.send "form_#{how}_form"
|
190
237
|
end
|
191
238
|
|
239
|
+
When /^I locate the form using "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
240
|
+
@element = @page.send "form_#{param1}_#{param2}_form"
|
241
|
+
end
|
242
|
+
|
192
243
|
When /^I get the text from the list item$/ do
|
193
244
|
@text = @page.li_id
|
194
245
|
end
|
195
246
|
|
196
|
-
When /^I search for the list item by "([
|
247
|
+
When /^I search for the list item by "([^\"]*)"$/ do |how|
|
197
248
|
@text = @page.send "li_#{how}"
|
198
249
|
end
|
199
250
|
|
251
|
+
When /^I search for the list item by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
252
|
+
@text = @page.send "li_#{param1}_#{param2}"
|
253
|
+
end
|
254
|
+
|
200
255
|
When /^I get the first item from the unordered list$/ do
|
201
256
|
@element = @page.ul_id_unordered_list[0]
|
202
257
|
end
|
203
258
|
|
204
|
-
Then /^the list
|
259
|
+
Then /^the list items text should be "([^\"]*)"$/ do |expected_text|
|
205
260
|
@element.text.should == expected_text
|
206
261
|
end
|
207
262
|
|
208
|
-
When /^I search for the unordered list by "([
|
263
|
+
When /^I search for the unordered list by "([^\"]*)"$/ do |how|
|
209
264
|
@list = @page.send "ul_#{how}_unordered_list"
|
210
265
|
end
|
211
266
|
|
267
|
+
When /^I search for the unordered list by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
268
|
+
@list = @page.send "ul_#{param1}_#{param2}_unordered_list"
|
269
|
+
end
|
270
|
+
|
271
|
+
|
212
272
|
When /^I get the first item from the list$/ do
|
213
273
|
@element = @list[0]
|
214
274
|
end
|
@@ -217,25 +277,29 @@ When /^I get the first item from the ordered list$/ do
|
|
217
277
|
@element = @page.ol_id_ordered_list[0]
|
218
278
|
end
|
219
279
|
|
220
|
-
When /^I search for the ordered list by "([
|
280
|
+
When /^I search for the ordered list by "([^\"]*)"$/ do |how|
|
221
281
|
@list = @page.send "ol_#{how}_ordered_list"
|
222
282
|
end
|
223
283
|
|
224
|
-
|
284
|
+
When /^I search for the ordered list by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
|
285
|
+
@list = @page.send "ol_#{param1}_#{param2}_ordered_list"
|
286
|
+
end
|
287
|
+
|
288
|
+
Then /^the table should have "([^\"]*)" rows$/ do |rows|
|
225
289
|
@element.rows.should == rows.to_i
|
226
290
|
end
|
227
291
|
|
228
|
-
Then /^each row should contain "([
|
292
|
+
Then /^each row should contain "([^\"]*)"$/ do |text|
|
229
293
|
@element.each do |row|
|
230
294
|
row.text.should include text
|
231
295
|
end
|
232
296
|
end
|
233
297
|
|
234
|
-
Then /^row "([
|
298
|
+
Then /^row "([^\"]*)" should have "([^\"]*)" columns$/ do |row, cols|
|
235
299
|
@element[row.to_i - 1].columns.should == cols.to_i
|
236
300
|
end
|
237
301
|
|
238
|
-
Then /^each column should contain "([
|
302
|
+
Then /^each column should contain "([^\"]*)"$/ do |text|
|
239
303
|
row = @element[0]
|
240
304
|
row.each do |column|
|
241
305
|
column.text.should include text
|
@@ -246,6 +310,17 @@ Then /^the list should contain (\d+) items$/ do |items|
|
|
246
310
|
@list.items.should == items.to_i
|
247
311
|
end
|
248
312
|
|
249
|
-
Then /^each item should contain "([
|
313
|
+
Then /^each item should contain "([^\"]*)"$/ do |text|
|
250
314
|
@list.each { |item| item.text.should include text }
|
251
315
|
end
|
316
|
+
|
317
|
+
Then /^option "([^\"]*)" should contain "([^\"]*)"$/ do |opt_num, text|
|
318
|
+
@element = @page.send "sel_list_#{@how}_select_list".to_sym
|
319
|
+
@element[opt_num.to_i - 1].text.should == text
|
320
|
+
end
|
321
|
+
|
322
|
+
Then /^each option should contain "([^\"]*)"$/ do |text|
|
323
|
+
@element.options.each do |option|
|
324
|
+
option.text.should include text
|
325
|
+
end
|
326
|
+
end
|