druid-ts 1.1.8 → 1.2.0
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/ChangeLog +27 -0
- data/features/bold.feature +21 -0
- data/features/element.feature +7 -0
- data/features/frames.feature +15 -0
- data/features/html/frames.html +3 -3
- data/features/html/iframes.html +2 -2
- data/features/html/multi_elements.html +1 -0
- data/features/html/static_elements.html +25 -8
- data/features/javascript.feature +10 -1
- data/features/link.feature +4 -0
- data/features/multi_elements.feature +6 -0
- data/features/radio_button_group.feature +28 -0
- data/features/section.feature +128 -0
- data/features/select_list.feature +4 -0
- data/features/step_definations/bold_steps.rb +11 -0
- data/features/step_definations/element_steps.rb +8 -0
- data/features/step_definations/frame_steps.rb +53 -11
- data/features/step_definations/javasript_steps.rb +9 -0
- data/features/step_definations/link_steps.rb +8 -0
- data/features/step_definations/multi_elements_steps.rb +13 -0
- data/features/step_definations/radio_button_group_steps.rb +32 -0
- data/features/step_definations/section_steps.rb +262 -0
- data/features/step_definations/table_steps.rb +9 -0
- data/features/support/env.rb +1 -0
- data/features/support/page.rb +16 -5
- data/features/table.feature +18 -14
- data/lib/druid.rb +42 -30
- data/lib/druid/accessors.rb +188 -55
- data/lib/druid/assist.rb +46 -4
- data/lib/druid/elements.rb +1 -0
- data/lib/druid/elements/bold.rb +8 -0
- data/lib/druid/elements/element.rb +16 -3
- data/lib/druid/elements/link.rb +7 -0
- data/lib/druid/elements/radio_button.rb +0 -7
- data/lib/druid/elements/select_list.rb +2 -2
- data/lib/druid/elements/table.rb +7 -0
- data/lib/druid/javascript/angularjs.rb +12 -0
- data/lib/druid/javascript_framework_facade.rb +5 -3
- data/lib/druid/locator_generator.rb +1 -0
- data/lib/druid/page_factory.rb +1 -0
- data/lib/druid/page_populator.rb +10 -1
- data/lib/druid/sections.rb +29 -0
- data/lib/druid/version.rb +1 -1
- data/spec/druid/accessors_spec.rb +79 -13
- data/spec/druid/druid_spec.rb +2 -1
- data/spec/druid/element_locators_spec.rb +26 -4
- data/spec/druid/elements/bold_spec.rb +21 -0
- data/spec/druid/elements/link_spec.rb +1 -1
- data/spec/druid/elements/page_factory_spec.rb +2 -2
- data/spec/druid/elements/radio_button_spec.rb +0 -5
- data/spec/druid/elements/select_list_spec.rb +3 -3
- data/spec/druid/page_factory_spec.rb +15 -15
- data/spec/druid/page_populator_spec.rb +4 -4
- data/spec/druid/page_section_spec.rb +61 -0
- data/spec/spec_helper.rb +1 -0
- metadata +20 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bfc5bbc0d62062451dde2bf3d508d4d3a0c2383
|
4
|
+
data.tar.gz: b67836bb6d42f79df16267ecad88edbfa64a4ad1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1886bcb9184acf5c0c1c4fbbc2cd4bd09606fea1e879c9af98a8e703b460b7ae610e2b08ce621cbc5ae14e6ad3cabf970d2904a60eb7963c4b963d0033d707ce
|
7
|
+
data.tar.gz: 6e1dd82de64f6be46c6fb271f7e5742a3a7fe182d06f3194455e7928355eba239053ddbb4e8c35b8fdec917172bb68e41696019fa88f0ea00deb2f0f79784381
|
data/ChangeLog
CHANGED
@@ -1,6 +1,33 @@
|
|
1
|
+
===Version 1.2.0/ 2017-01-24
|
2
|
+
* Enhancements
|
3
|
+
* Added new page_section/ page_sections method to accessor
|
4
|
+
=== Version 1.1.9/2017-01-22
|
5
|
+
* Enhancements
|
6
|
+
* Populate_page_with now supports radio groups
|
7
|
+
* Added new page_url_value mehod that is created when you define page_url to return the value
|
8
|
+
* Checking the name of accessors to ensure it does not conflict with an existing druid method name
|
9
|
+
* Added support for dynamically finding elements inside iframes
|
10
|
+
* Reverted the method name check due to unintended consequences
|
11
|
+
* Added support to use multiple identifiers when locating nested frames / iframes
|
12
|
+
* Remove methods for clearing radio buttons
|
13
|
+
* Add support bold tag
|
14
|
+
* Fixed wait_for_expected_title so it detects if the title changes
|
15
|
+
=== 2017-01-20
|
16
|
+
* Enhancements
|
17
|
+
* Super called when factory method invoked with non Druid class
|
18
|
+
* populate_page_with
|
1
19
|
=== 2017-01-19
|
2
20
|
* Enhancements
|
3
21
|
* Added elements method to accessor so one can generate methods for generic collections of elements
|
22
|
+
* Added class_name method to Element
|
23
|
+
* Added wait_for_expected_title and expected_element_visible methods
|
24
|
+
* Added select_text method to Element
|
25
|
+
* Added ability for execute_scripts to accept arguments
|
26
|
+
* Added ability to identify frame using a regular expression when using Watir
|
27
|
+
* Added href method to Link
|
28
|
+
* Added generation of plural version of basic types on class
|
29
|
+
* added accessor to support radio_button_group method
|
30
|
+
* Updated in_iframe methods to match the updates to the watir-webdriver gem
|
4
31
|
=== Version 1.1.8/2017-01-18
|
5
32
|
* Enhancements
|
6
33
|
* Added ability to find elements using any valid attribute
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Bold
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the static elements page
|
5
|
+
|
6
|
+
Scenario: Getting the text of headings
|
7
|
+
When I get the bold text for the "b" element
|
8
|
+
Then I should see "some text in bold" in bold
|
9
|
+
|
10
|
+
Scenario Outline: Locating b on the page
|
11
|
+
When I search bold text for the b by "<search_by>"
|
12
|
+
Then I should see "some text in bold" in bold
|
13
|
+
|
14
|
+
Examples:
|
15
|
+
| search_by |
|
16
|
+
| id |
|
17
|
+
| class |
|
18
|
+
| name |
|
19
|
+
| xpath |
|
20
|
+
| index |
|
21
|
+
| css |
|
data/features/element.feature
CHANGED
@@ -252,3 +252,10 @@ Feature: Elements
|
|
252
252
|
Scenario: Accessing an HTML 5 element using the element method
|
253
253
|
When I retrieve the figure using the element
|
254
254
|
Then I should see the figure contains an image
|
255
|
+
|
256
|
+
Scenario: Getting the class name for an element
|
257
|
+
When I search for the paragraph by "id"
|
258
|
+
Then I should know the paragraph class is "p_class"
|
259
|
+
|
260
|
+
Scenario: Selecting the text for an element
|
261
|
+
Then I should be able to select "Elements" from the paragraph
|
data/features/frames.feature
CHANGED
@@ -41,6 +41,11 @@ Scenario: Identifying items in frames at runtime
|
|
41
41
|
When I type "page-object" into the text field from frame 1 identified dynamically
|
42
42
|
Then I should verify "page-object" in the text field for frame 1 identified dynamically
|
43
43
|
|
44
|
+
Scenario: Identifying items in iframes at runtime
|
45
|
+
Given I am on the iframe elements page
|
46
|
+
When I type "page-object" into the text field from iframe 1 identified dynamically
|
47
|
+
Then I should verify "page-object" in the text field for iframe 1 identified dynamically
|
48
|
+
|
44
49
|
Scenario: Handling alerts inside frames
|
45
50
|
Given I am on the frame elements page
|
46
51
|
When I trigger an alert within a frame
|
@@ -55,3 +60,13 @@ Scenario: Handling prompts inside frames
|
|
55
60
|
Given I am on the frame elements page
|
56
61
|
When I trigger an prompt within a frame
|
57
62
|
Then I should be able to get the message and default value
|
63
|
+
|
64
|
+
Scenario: Accessing elements within the frame using Regexp
|
65
|
+
Given I am on the frame elements page
|
66
|
+
When I type "page-object" into the text field for frame 2 using "regex"
|
67
|
+
Then I should verify "page-object" is in the text field for frame 2 using "regex"
|
68
|
+
|
69
|
+
Scenario: Accessing elements within the frame using multiple identifiers
|
70
|
+
Given I am on the iframe elements page
|
71
|
+
When I type "page-object" into the text field for frame 2 using "multiple identifiers"
|
72
|
+
Then I should verify "page-object" is in the text field for frame 2 using "multiple identifiers"
|
data/features/html/frames.html
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
6
|
</head>
|
7
7
|
<frameset cols="40%, 40%, 20%">
|
8
|
-
<frame src="frame_1.html" id="
|
9
|
-
<frame src="frame_2.html" id="
|
10
|
-
<frame src="frame_3.html" id="
|
8
|
+
<frame src="frame_1.html" id="frame_one_1" name="frame1" />
|
9
|
+
<frame src="frame_2.html" id="frame_two_2" name="frame2" />
|
10
|
+
<frame src="frame_3.html" id="frame_three_3" name="frame3" />
|
11
11
|
</frameset>
|
12
12
|
</html>
|
data/features/html/iframes.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
</head>
|
7
7
|
<body>
|
8
8
|
<h1>Iframes</h1>
|
9
|
-
<iframe src="frame_1.html" id="
|
10
|
-
<iframe src="frame_2.html" id="
|
9
|
+
<iframe src="frame_1.html" id="frame_one_1" name="frame1" class="iframe"></iframe>
|
10
|
+
<iframe src="frame_2.html" id="frame_two_2" name="frame2" class="iframe"></iframe>
|
11
11
|
</body>
|
12
12
|
</html>
|
@@ -18,6 +18,7 @@
|
|
18
18
|
<select name="sel_list_name" id="sel_list_id" class="sel_list_class">
|
19
19
|
<option value="option1">Test 1</option>
|
20
20
|
<option value="option2">Test 2</option>
|
21
|
+
<option value="option3">Test/Test 3</option>
|
21
22
|
</select>
|
22
23
|
|
23
24
|
<select multiple="multiple" id="sel_list_multiple">
|
@@ -64,6 +65,13 @@
|
|
64
65
|
<input type="radio" id="milk_id" name="milk_name" class="milk_class" value="Milk"> Milk <br />
|
65
66
|
<input type="radio" id="butter_id" name="butter_name" class="butter_class" value="Butter">Butter
|
66
67
|
|
68
|
+
<br/>
|
69
|
+
<label>Radio Button Group</label>
|
70
|
+
<input type="radio" name="fav_cheese" value="ched">Cheddar</input>
|
71
|
+
<input type="radio" name="fav_cheese" value="emmen">Emmental</input>
|
72
|
+
<input type="radio" name="fav_cheese" value="muen">Muenster</input>
|
73
|
+
<br/>
|
74
|
+
|
67
75
|
<div id="div_id" name="div_name" class="div_class" title="div_title">
|
68
76
|
page-object rocks!
|
69
77
|
</div>
|
@@ -81,13 +89,22 @@
|
|
81
89
|
</label>
|
82
90
|
|
83
91
|
<table id='table_id' name='table_name' class='table_class' border='1'>
|
84
|
-
<
|
85
|
-
<
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
92
|
+
<thead>
|
93
|
+
<tr>
|
94
|
+
<th>Table</th>
|
95
|
+
<th>Header</th>
|
96
|
+
</tr>
|
97
|
+
</thead>
|
98
|
+
<tbody>
|
99
|
+
<tr>
|
100
|
+
<td>Data1</td>
|
101
|
+
<td>Data2</td>
|
102
|
+
</tr>
|
103
|
+
<tr>
|
104
|
+
<td>Data3</td>
|
105
|
+
<td id='cell_id', name='cell_name' class='cell_class'>Data4</td>
|
106
|
+
</tr>
|
107
|
+
</tbody>
|
91
108
|
</table>
|
92
109
|
|
93
110
|
<table id="table_with_thead_id" border='1'>
|
@@ -176,6 +193,6 @@
|
|
176
193
|
<figure id='figure_id'>
|
177
194
|
<img src="images/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">
|
178
195
|
</figure>
|
179
|
-
|
196
|
+
This text have <b id="b_id" class="b_class" name="b_name">some text in bold</b>
|
180
197
|
</body>
|
181
198
|
</html>
|
data/features/javascript.feature
CHANGED
@@ -16,4 +16,13 @@ Feature: Handling javascript events
|
|
16
16
|
Given I am on the static elements page
|
17
17
|
Given I execute the javascript "return 2 + 2;"
|
18
18
|
Then I should get the answer "4"
|
19
|
-
|
19
|
+
|
20
|
+
Scenario: Executing javascript in the browser with value arugment
|
21
|
+
Given I am on the static elements page
|
22
|
+
When I execute the javascript "return 2 + Number(arguments[0]);" with an argument of "2"
|
23
|
+
Then I should get the answer "4"
|
24
|
+
|
25
|
+
Scenario: Executing javascript in the browser with element argument
|
26
|
+
Given I am on the static elements page
|
27
|
+
When I execute the javascript "arguments[0].value = 'abcDEF';" with a text field argument
|
28
|
+
Then the text field should contain "abcDEF"
|
data/features/link.feature
CHANGED
@@ -44,3 +44,7 @@ Feature: Links
|
|
44
44
|
Scenario: Finding a link dynamically
|
45
45
|
When I select a link while the script is executing
|
46
46
|
And the page should contain the text "Success"
|
47
|
+
|
48
|
+
Scenario: Getting the href for a link
|
49
|
+
When I get the href for the link
|
50
|
+
Then I should know it was "success.html"
|
@@ -484,3 +484,9 @@ Feature: Multi Elements
|
|
484
484
|
And the text for label 1 should be "Label 1"
|
485
485
|
And the text for label 2 should be "Label 2"
|
486
486
|
And the text for label 3 should be "Label 3"
|
487
|
+
|
488
|
+
Scenario: Selecting bs using an identifier
|
489
|
+
When I select the bs
|
490
|
+
Then I should have 2 bs
|
491
|
+
And the text for b 1 should be "One B"
|
492
|
+
And the text for b 2 should be "Two B"
|
@@ -0,0 +1,28 @@
|
|
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
|
+
Then no radio buttons should be selected in the group
|
14
|
+
|
15
|
+
Scenario: Selecting grouped radio buttons by value
|
16
|
+
When I select the "ched" radio button in the group
|
17
|
+
Then the "ched" radio button should be selected in the group
|
18
|
+
And the "emmen" radio button should not be selected
|
19
|
+
And the "muen" radio button should not be selected
|
20
|
+
When I select the "muen" radio button in the group
|
21
|
+
Then the "ched" radio button should not be selected
|
22
|
+
And the "emmen" radio button should not be selected
|
23
|
+
And the "muen" radio button should be selected in the group
|
24
|
+
|
25
|
+
Scenario: Getting an array of elements for each radio button in the group
|
26
|
+
When I ask for the elements of a radio button group
|
27
|
+
Then I should have an array with elements for each radio button
|
28
|
+
And the radio button element values should be "ched", "emmen", "muen"
|
@@ -0,0 +1,128 @@
|
|
1
|
+
Feature: Sections
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the section elements page
|
5
|
+
|
6
|
+
Scenario: Getting the text from a section
|
7
|
+
When I get the text from the section
|
8
|
+
Then the text should include "page-object rocks!"
|
9
|
+
|
10
|
+
Scenario: Cannot find elements not in the section
|
11
|
+
When I access an element that is outside of the section
|
12
|
+
Then I should see that is doesn't exist in the section
|
13
|
+
|
14
|
+
Scenario: Finding a link within a section
|
15
|
+
When I search for a link located in a section
|
16
|
+
Then I should be able to click the section link
|
17
|
+
|
18
|
+
Scenario: Finding a button within a section
|
19
|
+
When I search for a button located in a section
|
20
|
+
Then I should be able to click the section button
|
21
|
+
|
22
|
+
Scenario: Finding a text field within a section
|
23
|
+
When I search for a text field located in a section
|
24
|
+
Then I should be able to type "123abc" in the section text field
|
25
|
+
|
26
|
+
Scenario: Finding a hidden field within a section
|
27
|
+
When I search for a hidden field located in a section
|
28
|
+
Then I should be able to see that the section hidden field contains "LeanDog"
|
29
|
+
|
30
|
+
Scenario: Finding a text area within a section
|
31
|
+
When I search for a text area located in a section
|
32
|
+
Then I should be able to type "abcdefg" in the section text area
|
33
|
+
|
34
|
+
Scenario: Finding a select list within a section
|
35
|
+
When I search for a select list located in a section
|
36
|
+
Then I should be able to select "Test 2" in the section select list
|
37
|
+
|
38
|
+
Scenario: Finding a file field within a section
|
39
|
+
When I search for a file field located in a section
|
40
|
+
Then I should be able to set the section file field
|
41
|
+
|
42
|
+
Scenario: Finding a checkbox within a section
|
43
|
+
When I search for a checkbox located in a section
|
44
|
+
Then I should be able to check the section checkbox
|
45
|
+
|
46
|
+
Scenario: Finding a radio button witin a section
|
47
|
+
When I search for a radio button located in a section
|
48
|
+
Then I should be able to select the section radio button
|
49
|
+
|
50
|
+
Scenario: Finding a div within a section
|
51
|
+
When I search for a div located in a section
|
52
|
+
Then I should see the text "page-object rocks!" in the section div
|
53
|
+
|
54
|
+
Scenario: Finding a span within a section
|
55
|
+
When I search for a span located in a section
|
56
|
+
Then I should see the text "My alert" in the section span
|
57
|
+
|
58
|
+
Scenario: Finding a table within a section
|
59
|
+
When I search for a table located in a section
|
60
|
+
Then the data for row "1" of the section table should be "Data1" and "Data2"
|
61
|
+
|
62
|
+
Scenario: Finding a table cell within a section
|
63
|
+
When I search the second table cell located in a table in a section
|
64
|
+
Then the section table cell should contain "Data2"
|
65
|
+
|
66
|
+
Scenario: Finding an image within a section
|
67
|
+
When I search for an image located in a section
|
68
|
+
Then the section image should be "106" pixels wide
|
69
|
+
And the section image should be "106" pixels tall
|
70
|
+
|
71
|
+
Scenario: Finding a form within a section
|
72
|
+
When I search for a form located in a section
|
73
|
+
Then I should be able to submit the section form
|
74
|
+
|
75
|
+
Scenario: Finding an ordered list within a section
|
76
|
+
When I search for an ordered list located in a section
|
77
|
+
Then the first section list items text should be "Number One"
|
78
|
+
|
79
|
+
Scenario: Finding an unordered list within a section
|
80
|
+
When I search for an unordered list located in a section
|
81
|
+
Then the first section list items text should be "Item One"
|
82
|
+
|
83
|
+
Scenario: Finding a list item section in an ordered list within a section
|
84
|
+
When I search for a list item section in an ordered list in a section
|
85
|
+
Then I should see the section list items text should be "Number One"
|
86
|
+
|
87
|
+
Scenario: Finding a h1 within a section
|
88
|
+
When I search for a h1 located in a section
|
89
|
+
Then I should see the section h1s text should be "h1's are cool"
|
90
|
+
|
91
|
+
Scenario: Finding a h2 within a section
|
92
|
+
When I search for a h2 located in a section
|
93
|
+
Then I should see the section h2s text should be "h2's are cool"
|
94
|
+
|
95
|
+
Scenario: Finding a h3 within a section
|
96
|
+
When I search for a h3 located in a section
|
97
|
+
Then I should see the section h3s text should be "h3's are cool"
|
98
|
+
|
99
|
+
Scenario: Finding a h4 within a section
|
100
|
+
When I search for a h4 located in a section
|
101
|
+
Then I should see the section h4s text should be "h4's are cool"
|
102
|
+
|
103
|
+
Scenario: Finding a h5 within a section
|
104
|
+
When I search for a h5 located in a section
|
105
|
+
Then I should see the section h5s text should be "h5's are cool"
|
106
|
+
|
107
|
+
Scenario: Finding a h6 within a section
|
108
|
+
When I search for a h6 located in a section
|
109
|
+
Then I should see the section h6s text should be "h6's are cool"
|
110
|
+
|
111
|
+
Scenario: Finding a paragraph within a section
|
112
|
+
When I search for a paragraph located in a section
|
113
|
+
Then I should see the section paragraphs text should be "This is a paragraph."
|
114
|
+
|
115
|
+
Scenario: Selecting multiple sections
|
116
|
+
When I select multiple sections
|
117
|
+
Then I should have a section collection containing the sections
|
118
|
+
And I can access any index of that collection of sections
|
119
|
+
|
120
|
+
Scenario: Searching section collection
|
121
|
+
Given I select multiple sections
|
122
|
+
When I search by a specific value of the section
|
123
|
+
Then I will find the first section with that value
|
124
|
+
|
125
|
+
Scenario: Filtering section collection
|
126
|
+
Given I select multiple sections
|
127
|
+
When I filter by a specific value of the sections
|
128
|
+
Then I will find all sections with that value
|
@@ -9,6 +9,10 @@ Feature: Select List
|
|
9
9
|
When I select "Test 2" from the select list
|
10
10
|
Then the current item should be "Test 2"
|
11
11
|
|
12
|
+
Scenario: Selecting an element when there is a forward slash
|
13
|
+
When I select "Test/Test 3" from the select list
|
14
|
+
Then the current item should be "Test/Test 3"
|
15
|
+
|
12
16
|
Scenario Outline: Locating select lists on the Page
|
13
17
|
When I locate the select list by "<locate_by>"
|
14
18
|
Then I should be able to select "Test 2"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
When(/^I get the bold text for the "([^"]*)" element$/) do |el|
|
2
|
+
@b = @page.send "#{el}_id"
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^I should see "([^"]*)" in bold$/) do |text|
|
6
|
+
expect(@b).to eql text
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I search bold text for the b by "([^"]*)"$/) do |type|
|
10
|
+
@b = @page.send "b_#{type}"
|
11
|
+
end
|
@@ -167,3 +167,11 @@ Then(/^I should know the attribute "([^"]*)" includes "([^"]*)"$/) do |attribute
|
|
167
167
|
@attr = @element.attribute(attribute)
|
168
168
|
expect(@attr).to include included
|
169
169
|
end
|
170
|
+
|
171
|
+
Then(/^I should know the paragraph class is "([^"]*)"$/) do |class_name|
|
172
|
+
expect(@page.p_id_element.class_name).to eql class_name
|
173
|
+
end
|
174
|
+
|
175
|
+
Then(/^I should be able to select "([^"]*)" from the paragraph$/) do |text|
|
176
|
+
@page.p_id_element.select_text text
|
177
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class FramePage
|
2
2
|
include Druid
|
3
3
|
|
4
|
-
in_frame(:id => "
|
4
|
+
in_frame(:id => "frame_two_2") do |frame|
|
5
5
|
text_field(:text_field_2_id, :name => 'recieverElement', :frame => frame)
|
6
6
|
end
|
7
7
|
|
@@ -13,7 +13,7 @@ class FramePage
|
|
13
13
|
text_field(:text_field_2_index, :name => 'recieverElement', :frame => frame)
|
14
14
|
end
|
15
15
|
|
16
|
-
in_frame(:id => "
|
16
|
+
in_frame(:id => "frame_one_1") do |frame|
|
17
17
|
text_field(:text_field_1_id, :name => 'senderElement', :frame => frame)
|
18
18
|
end
|
19
19
|
|
@@ -25,6 +25,36 @@ class FramePage
|
|
25
25
|
text_field(:text_field_1_index, :name => 'senderElement', :frame => frame)
|
26
26
|
end
|
27
27
|
|
28
|
+
in_frame(:id => /frame_two_\d+/) do |frame|
|
29
|
+
text_field(:text_field_2_regex, :name => 'recieverElement', :frame => frame)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class IFramePage
|
35
|
+
include Druid
|
36
|
+
|
37
|
+
in_iframe(:id => 'frame_two_2') do |frame|
|
38
|
+
text_field(:text_field_2_id, :name => 'recieverElement', :frame => frame)
|
39
|
+
end
|
40
|
+
in_iframe(:id => 'frame_one_1') do |frame|
|
41
|
+
text_field(:text_field_1_id, :name => 'senderElement', :frame => frame)
|
42
|
+
end
|
43
|
+
in_iframe(:name => 'frame2') do |frame|
|
44
|
+
text_field(:text_field_2_name, :name => 'recieverElement', :frame => frame)
|
45
|
+
end
|
46
|
+
in_iframe(:name => 'frame1') do |frame|
|
47
|
+
text_field(:text_field_1_name, :name => 'senderElement', :frame => frame)
|
48
|
+
end
|
49
|
+
in_iframe(:index => 1) do |frame|
|
50
|
+
text_field(:text_field_2_index, :name => 'recieverElement', :frame => frame)
|
51
|
+
end
|
52
|
+
in_iframe(:index => 0) do |frame|
|
53
|
+
text_field(:text_field_1_index, :name => 'senderElement', :frame => frame)
|
54
|
+
end
|
55
|
+
in_iframe(:class => 'iframe', :name => 'frame2') do |frame|
|
56
|
+
text_field(:text_field_2_multiple_identifiers, :name => 'recieverElement', :frame => frame)
|
57
|
+
end
|
28
58
|
end
|
29
59
|
|
30
60
|
Given(/^I am on the frame elements page$/) do
|
@@ -33,11 +63,11 @@ Given(/^I am on the frame elements page$/) do
|
|
33
63
|
end
|
34
64
|
|
35
65
|
When(/^I type "(.*?)" into the text field for frame 2 using "(.*?)"$/) do |text, arg_type|
|
36
|
-
@page.send "text_field_2_#{arg_type}=".to_sym, text
|
66
|
+
@page.send "text_field_2_#{arg_type.gsub(' ','_')}=".to_sym, text
|
37
67
|
end
|
38
68
|
|
39
69
|
Then(/^I should verify "(.*?)" is in the text field for frame 2 using "(.*?)"$/) do |text, arg_type|
|
40
|
-
result = @page.send "text_field_2_#{arg_type}".to_sym
|
70
|
+
result = @page.send "text_field_2_#{arg_type.gsub(' ','_')}".to_sym
|
41
71
|
expect(result).to eql text
|
42
72
|
end
|
43
73
|
|
@@ -51,8 +81,8 @@ Then(/^I should verify "(.*?)" is in the text field for frame 1 using "(.*?)"$/)
|
|
51
81
|
end
|
52
82
|
|
53
83
|
Given(/^I am on the iframe elements page$/) do
|
54
|
-
@page =
|
55
|
-
@page.navigate_to(UrlHelper.
|
84
|
+
@page = IFramePage.new(@driver)
|
85
|
+
@page.navigate_to(UrlHelper.iframe_elements)
|
56
86
|
end
|
57
87
|
|
58
88
|
class NestedFramePage
|
@@ -76,19 +106,19 @@ Then(/^I should be able to click the link in the frame$/) do
|
|
76
106
|
end
|
77
107
|
|
78
108
|
When(/^I type "([^"]*)" into the text field from frame 1 identified dynamically$/) do |value|
|
79
|
-
@page.in_frame(:id => '
|
109
|
+
@page.in_frame(:id => 'frame_one_1') do |frame|
|
80
110
|
@page.text_field_element(:name => 'senderElement', :frame => frame).value = value
|
81
111
|
end
|
82
112
|
end
|
83
113
|
|
84
114
|
Then(/^I should verify "([^"]*)" in the text field for frame 1 identified dynamically$/) do |value|
|
85
|
-
@page.in_frame(:id => '
|
115
|
+
@page.in_frame(:id => 'frame_one_1') do |frame|
|
86
116
|
expect(@page.text_field_element(:name => 'senderElement', :frame => frame).value).to eql value
|
87
117
|
end
|
88
118
|
end
|
89
119
|
|
90
120
|
When(/^I trigger an alert within a frame$/) do
|
91
|
-
@page.in_frame(:id => '
|
121
|
+
@page.in_frame(:id => 'frame_three_3') do |frame|
|
92
122
|
@msg = @page.alert do
|
93
123
|
@page.button_element(:id => 'alert_button', :frame => frame).click
|
94
124
|
end
|
@@ -96,7 +126,7 @@ When(/^I trigger an alert within a frame$/) do
|
|
96
126
|
end
|
97
127
|
|
98
128
|
When(/^I trigger an confirm within a frame$/) do
|
99
|
-
@page.in_frame(:id => '
|
129
|
+
@page.in_frame(:id => 'frame_three_3') do |frame|
|
100
130
|
@msg = @page.confirm(true) do
|
101
131
|
@page.button_element(:id => 'confirm_button', :frame => frame).click
|
102
132
|
end
|
@@ -104,9 +134,21 @@ When(/^I trigger an confirm within a frame$/) do
|
|
104
134
|
end
|
105
135
|
|
106
136
|
When(/^I trigger an prompt within a frame$/) do
|
107
|
-
@page.in_frame(:id => '
|
137
|
+
@page.in_frame(:id => 'frame_three_3') do |frame|
|
108
138
|
@msg = @page.prompt("Tim") do
|
109
139
|
@page.button_element(:id => 'prompt_button', :frame => frame).click
|
110
140
|
end
|
111
141
|
end
|
112
142
|
end
|
143
|
+
|
144
|
+
When(/^I type "([^"]*)" into the text field from iframe 1 identified dynamically$/) do |value|
|
145
|
+
@page.in_iframe(:id => 'frame_one_1') do |frame|
|
146
|
+
@page.text_field_element(:name => 'senderElement', :frame => frame).value = value
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
Then(/^I should verify "([^"]*)" in the text field for iframe 1 identified dynamically$/) do |value|
|
151
|
+
@page.in_iframe(:id => 'frame_one_1') do |frame|
|
152
|
+
expect(@page.text_field_element(:name => 'senderElement', :frame => frame).value).to eql value
|
153
|
+
end
|
154
|
+
end
|