druid-ts 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +27 -0
  3. data/features/async.feature +6 -0
  4. data/features/div.feature +1 -0
  5. data/features/element.feature +4 -0
  6. data/features/hidden_field.feature +0 -2
  7. data/features/html/async.html +13 -0
  8. data/features/html/multi_elements.html +4 -0
  9. data/features/html/static_elements.html +10 -3
  10. data/features/link.feature +1 -0
  11. data/features/multi_elements.feature +135 -25
  12. data/features/select_list.feature +8 -0
  13. data/features/span.feature +2 -0
  14. data/features/step_definations/async_steps.rb +17 -0
  15. data/features/step_definations/element_steps.rb +6 -0
  16. data/features/step_definations/multi_elements_steps.rb +96 -0
  17. data/features/step_definations/select_list_steps.rb +12 -0
  18. data/features/step_definations/table_steps.rb +20 -3
  19. data/features/support/ajax_test_environment.rb +1 -1
  20. data/features/support/page.rb +7 -2
  21. data/features/table.feature +35 -0
  22. data/features/text_area.feature +0 -2
  23. data/features/text_field.feature +1 -2
  24. data/lib/druid.rb +31 -3
  25. data/lib/druid/accessors.rb +184 -146
  26. data/lib/druid/assist.rb +10 -2
  27. data/lib/druid/element_locators.rb +186 -102
  28. data/lib/druid/elements/div.rb +1 -1
  29. data/lib/druid/elements/element.rb +131 -96
  30. data/lib/druid/elements/hidden_field.rb +1 -5
  31. data/lib/druid/elements/link.rb +1 -1
  32. data/lib/druid/elements/select_list.rb +8 -0
  33. data/lib/druid/elements/span.rb +1 -1
  34. data/lib/druid/elements/table.rb +14 -3
  35. data/lib/druid/elements/table_row.rb +17 -2
  36. data/lib/druid/elements/text_area.rb +0 -8
  37. data/lib/druid/elements/text_field.rb +1 -1
  38. data/lib/druid/javascript/yui.rb +19 -0
  39. data/lib/druid/javascript_framework_facade.rb +3 -1
  40. data/lib/druid/nested_elements.rb +1 -1
  41. data/lib/druid/page_factory.rb +25 -0
  42. data/lib/druid/page_populator.rb +1 -0
  43. data/lib/druid/version.rb +1 -1
  44. data/spec/druid/accessors_spec.rb +189 -1
  45. data/spec/druid/druid_spec.rb +6 -0
  46. data/spec/druid/element_locators_spec.rb +276 -0
  47. data/spec/druid/elements/div_spec.rb +1 -1
  48. data/spec/druid/elements/element_spec.rb +11 -0
  49. data/spec/druid/elements/hidden_field_spec.rb +0 -5
  50. data/spec/druid/elements/link_spec.rb +1 -1
  51. data/spec/druid/elements/span_spec.rb +1 -1
  52. data/spec/druid/elements/text_area_spec.rb +0 -5
  53. data/spec/druid/elements/text_field_spec.rb +1 -1
  54. data/spec/druid/page_factory_spec.rb +20 -0
  55. data/spec/druid/page_populator_spec.rb +8 -4
  56. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c83e03d267731768c34e5a6e686dc2105e9a94ad
4
- data.tar.gz: b4f5d3fa5dac92cb3f107cd78d4cc7026ce4d7e4
3
+ metadata.gz: 6276d1b684e76f744b084e805f4deaba4b26a460
4
+ data.tar.gz: 0292a33fda9f47366307003aa3f436f9ef00956f
5
5
  SHA512:
6
- metadata.gz: 00a48ae184bbc2008cc8acd0c886690fd6b52b4854f7c1e2317ed02e6104e4e27fec356d75bdcbf9b714a38260973e36431a220ade40afc46058a40deef783bd
7
- data.tar.gz: 9bedf55e94feacfa9b04eb2dcc6532b30fc36cc16071d9892c4720849c0f6337d145cd13605b9253554f0dea7bf15b64784b3c224f43240920793e427058a555
6
+ metadata.gz: add0a49296d0a8090293fd22665635a2c48f0acadc317ca3c1577d5fa34d155138733a9fac26f574d43e43375da70ee281636f9249f272d033ccf1992a520cb1
7
+ data.tar.gz: dec9a28581e98915b5e608de1e3bb2c0568c477e528dcd59b334039ef6d05eed5c215524e731581802f9491ad71fcbf370e3660dfdcf96b9f1583ae98813f098
data/ChangeLog CHANGED
@@ -1,6 +1,33 @@
1
+ === 2016-12-28
2
+ * Enhancement
3
+ * Updated Table [] method to return a row that has matching partial text in any column
4
+ * Updated TableRow [] method to return column that matching partial text in any column
5
+ ===Version v1.1.4/ 2016-12-27
6
+ * Enhancement
7
+ * Added ability to find span's by title
8
+ * Changed order of initialization so initialize_page is called after goto
9
+ * Added flash method to Element to temporarily change the background color
10
+ * Added when_not_present method to Element
11
+ * Added default override of page level waits - Druid.default_page_wait
12
+ * Added default override of element level waits - Druid.default_element_wait
13
+ * Added the ability to find a TableRow by providing a String to the [] method
14
+ * Added the ability to find a TableCell by providing a String to the [] method from TableRow
15
+ * Updated link to be able to identify by title
16
+ * Updated div to be able to identify by title
17
+ * Added ability to find text_field by :text and :label
18
+ * Added select_value method to SelectList
19
+ * Fixes
20
+ * Modified text area methods so it clears before setting new text
21
+ * Updated [] method on Table to return nil when bad row header is provided
22
+ * Updated [] method on TableRow to return nil when bad column header is provided
23
+ * Fixed populate_page_with to work with text areas
1
24
  === 2016-12-26
2
25
  * Enhancement
3
26
  * Changed page_url to accept a symbol that will cause it to call a corresponding method
27
+ * Updated all accessor methods to take a default identifier of {:index => 0}
28
+ * Added a page level element method to return a generic Element object
29
+ * Updated all page level element locators to take a default identifier of {:index => 0}
30
+ * Added a method to retrieve all file fields on a page
4
31
  === 2016-12-23
5
32
  * Enhancement
6
33
  * Added #execute_script method to Druid
@@ -16,3 +16,9 @@ Feature: Handling Asynch calls
16
16
  Scenario: Wait until something is not visible
17
17
  Given I am on the async elements page
18
18
  Then I should be able to wait until the button becomes invisible
19
+
20
+ Scenario: Wait for an element to disappear from the page
21
+ Given I am on the async elements page
22
+ When I add a button a few seconds from now
23
+ And I remove a button a few seconds from now
24
+ Then I should not be able to find the button
data/features/div.feature CHANGED
@@ -22,6 +22,7 @@ Feature: Div
22
22
  | index |
23
23
  | name |
24
24
  | text |
25
+ | title |
25
26
 
26
27
  Scenario: Getting the div element
27
28
  When I retrieve the div element
@@ -218,3 +218,7 @@ Feature: Elements
218
218
  When I find the child link element
219
219
  And ask for the parent element
220
220
  Then I should have a div parent
221
+
222
+ Scenario: Flashing an element
223
+ When I retrieve a button element
224
+ Then I should be able to flash it
@@ -17,8 +17,6 @@ Feature: Hidden Fields
17
17
  | class |
18
18
  | name |
19
19
  | xpath |
20
- | css |
21
- | tag_name |
22
20
  | index |
23
21
  | text |
24
22
  | value |
@@ -8,11 +8,24 @@
8
8
  function hide() {
9
9
  document.getElementById("target").style.display="none";
10
10
  }
11
+ function addDiv() {
12
+ var button = document.createElement("input");
13
+ button.setAttribute("type", "button");
14
+ button.setAttribute("value", "New Button");
15
+ button.setAttribute("id", "new_button");
16
+ document.body.appendChild(button);
17
+ }
18
+ function removeDiv() {
19
+ var button = document.getElementById("new_button");
20
+ document.body.removeChild(button);
21
+ }
11
22
  </script>
12
23
  </head>
13
24
  <body>
14
25
  <input type="button" id="target" value="Target"/>
15
26
  <input type="button" onclick="setTimeout(function() {hide();}, 2000);" value="Hide Button"/>
16
27
  <input type="button" onclick="setTimeout(function() {unhide();}, 2000);" value="Unhide Button"/>
28
+ <input type="button" onclick="setTimeout(function() {addDiv();}, 2000);" value="Create Button"/>
29
+ <input type="button" onclick="setTimeout(function() {removeDiv();}, 2000);" value="Remove Button"/>
17
30
  </body>
18
31
  </html>
@@ -135,5 +135,9 @@
135
135
  <p class="p">Paragraph Two</p>
136
136
  <p class="p">Paragraph Three</p>
137
137
 
138
+ <input type="file" class="file_field_class" title="File Field 1" />
139
+ <input type="file" class="file_field_class" title="File Field 2" />
140
+ <input type="file" class="file_field_class" title="File Field 3" />
141
+
138
142
  </body>
139
143
  </html>
@@ -4,6 +4,7 @@
4
4
  </head>
5
5
  <body>
6
6
  <p id="p_id" name="p_name" class="p_class">Static Elements Page</p>
7
+ <label for="text_field_id">Text Field</label>
7
8
  <input id="text_field_id" name="text_field_name" class="text_field_class" title="text_field_title"
8
9
  size="40" type="text" />
9
10
 
@@ -17,19 +18,25 @@
17
18
  <option value="option2">Test 2</option>
18
19
  </select>
19
20
 
21
+ <select multiple="multiple" id="sel_list_multiple">
22
+ <option value="option1" selected="true">Test 1</option>
23
+ <option value="option2">Test 2</option>
24
+ <option value="option3" selected="true">Test 3</option>
25
+ </select>
26
+
20
27
 
21
- <a href="success.html" id="link_id" name="link_name" class="link_class" >Google Search</a>
28
+ <a href="success.html" id="link_id" name="link_name" class="link_class" title="link_title" >Google Search</a>
22
29
 
23
30
  <input id="cb_id" name="cb_name" class="cb_class" type="checkbox" value="1" />
24
31
 
25
32
  <input type="radio" id="milk_id" name="milk_name" class="milk_class" value="Milk"> Milk <br />
26
33
  <input type="radio" id="butter_id" name="butter_name" class="butter_class" value="Butter">Butter
27
34
 
28
- <div id="div_id" name="div_name" class="div_class">
35
+ <div id="div_id" name="div_name" class="div_class" title="div_title">
29
36
  page-object rocks!
30
37
  </div>
31
38
 
32
- <span id="span_id" name="span_name" class="span_class">
39
+ <span id="span_id" name="span_name" class="span_class" title="span_title">
33
40
  My alert
34
41
  </span>
35
42
 
@@ -25,6 +25,7 @@ Feature: Links
25
25
  | link |
26
26
  | link_text |
27
27
  | css |
28
+ | title |
28
29
 
29
30
  Scenario: Retrieve a Link
30
31
  When I retrieve a link element
@@ -3,178 +3,288 @@ Feature: Multi Elements
3
3
  Background:
4
4
  Given I am on the multi elements page
5
5
 
6
- Scenario: Selecting buttons
6
+ Scenario: Selecting buttons using an identifier
7
7
  When I select the buttons with class "button"
8
8
  Then I should have 3 buttons
9
9
  And the value of button 1 should be "Button 1"
10
10
  And the value of button 2 should be "Button 2"
11
11
  And the value of button 3 should be "Button 3"
12
12
 
13
+ Scenario: Selecting buttons using no identifier
14
+ When I select all buttons using no identifier
15
+ Then I should have 3 buttons
13
16
 
14
- Scenario: Selecting text_fields
17
+ Scenario: Selecting text fields using an identifier
15
18
  When I select the text fields with class "textfield"
16
19
  Then I should have 3 text fields
17
20
  And the value of text field 1 should be "text 1"
18
21
  And the value of text field 2 should be "text 2"
19
22
  And the value of text field 3 should be "text 3"
20
23
 
21
- Scenario: Selecting hidden_fields
24
+ Scenario: Selecting text field using no identifier
25
+ When I select all text fields using no identifier
26
+ Then I should have 3 text fields
27
+
28
+ Scenario: Selecting hidden fields using an identifier
22
29
  When I select the hidden fields with class "hiddenfield"
23
30
  Then I should have 3 hidden fields
24
31
  And the value of hidden field 1 should be "hidden 1"
25
32
  And the value of hidden field 2 should be "hidden 2"
26
33
  And the value of hidden field 3 should be "hidden 3"
27
34
 
28
- Scenario: Selecting text_areas
35
+ Scenario: Selecting hidden fields using no identifier
36
+ When I select all hidden fields using no identifier
37
+ Then I should have 3 hidden fields
38
+
39
+ Scenario: Selecting text areas using an identifier
29
40
  When I select the text areas with class "textarea"
30
41
  Then I should have 3 text areas
31
42
  And the value of text area 1 should be "textarea 1"
32
43
  And the value of text area 2 should be "textarea 2"
33
44
  And the value of text area 3 should be "textarea 3"
34
45
 
35
- Scenario: Selecting select_lists
46
+ Scenario: Selecting text areas using no identifier
47
+ When I select all text areas using no identifier
48
+ Then I should have 3 text areas
49
+
50
+ Scenario: Selecting select lists using an identifier
36
51
  When I select the select lists with class "selectlist"
37
52
  Then I should have 3 select lists
38
53
  And the value of select list 1 should be "selectlist 1"
39
54
  And the value of select list 2 should be "selectlist 2"
40
55
  And the value of select list 3 should be "selectlist 3"
41
56
 
42
- Scenario: Selecting links
57
+ Scenario: Selecting select lists using no identifier
58
+ When I select all select lists using no identifier
59
+ Then I should have 3 select lists
60
+
61
+ Scenario: Selecting links using an identifier
43
62
  When I select the link with class "link"
44
63
  Then I should have 3 links
45
64
  And the text of link 1 should be "link 1"
46
65
  And the text of link 2 should be "link 2"
47
66
  And the text of link 3 should be "link 3"
48
67
 
49
- Scenario: Selecting checkboxes
68
+ Scenario: Selecting links using no identifier
69
+ When I select all links using no identifier
70
+ Then I should have 3 links
71
+
72
+ Scenario: Selecting checkboxes using an identifier
50
73
  When I select the check boxes with class "checkbox"
51
74
  Then I should have 3 checkboxes
52
75
  And the value of checkbox 1 should be "checkbox 1"
53
76
  And the value of checkbox 2 should be "checkbox 2"
54
77
  And the value of checkbox 3 should be "checkbox 3"
55
78
 
56
- Scenario: Selecting radio buttons
79
+ Scenario: Selecting checkboxes using no identifier
80
+ When I select all check boxes using no identifier
81
+ Then I should have 3 checkboxes
82
+
83
+ Scenario: Selecting radio buttons uisng an identifier
57
84
  When I select the radio buttons with class "radio"
58
85
  Then I should have 3 radio buttons
59
86
  And the value of radio button 1 should be "radio 1"
60
87
  And the value of radio button 2 should be "radio 2"
61
88
  And the value of radio button 3 should be "radio 3"
62
89
 
63
- Scenario: Selecting divs
90
+ Scenario: Selecting radio buttons using no identifier
91
+ When I select all radio buttons using no identifier
92
+ Then I should have 3 radio buttons
93
+
94
+ Scenario: Selecting divs using an identifier
64
95
  When I select the divs with class "div"
65
96
  Then I should have 3 divs
66
97
  And the text of div 1 should be "Div 1"
67
98
  And the text of div 2 should be "Div 2"
68
99
  And the text of div 3 should be "Div 3"
69
100
 
70
- Scenario: Selecting spans
101
+ Scenario: Selecting divs using no identifier
102
+ When I select all divs using no identifier
103
+ Then I should have 3 divs
104
+
105
+ Scenario: Selecting spans using an identifier
71
106
  When I select the spans with class "span"
72
107
  Then I should have 3 spans
73
108
  And the text of span 1 should be "Span 1"
74
109
  And the text of span 2 should be "Span 2"
75
110
  And the text of span 3 should be "Span 3"
76
111
 
77
- Scenario: Selecting tables
112
+ Scenario: Selecting spans using no identifier
113
+ When I select all spans using no identifier
114
+ Then I should have 3 spans
115
+
116
+ Scenario: Selecting tables using an identifier
78
117
  When I select the tables with class "table"
79
118
  Then I should have 3 tables
80
119
  And the first row first column for table 1 should have "Data 1"
81
120
  And the first row first column for table 2 should have "Data 4"
82
121
  And the first row first column for table 3 should have "Data 7"
83
122
 
84
- Scenario: Selecting cells
123
+ Scenario: Selecting tables using no identifier
124
+ When I select all tables using no identifier
125
+ Then I should have 3 tables
126
+
127
+ Scenario: Selecting cells using an identifier
85
128
  When I select the cells with class "td"
86
129
  Then I should have 3 cells
87
130
  And the text for cell 1 should be "Data 1"
88
131
  And the text for cell 2 should be "Data 2"
89
132
  And the text for cell 3 should be "Data 3"
90
133
 
91
- Scenario: Selecting images
134
+ Scenario: Selecting cells using no identifier
135
+ When I select all cells using no identifier
136
+ Then I should have 9 cells
137
+
138
+ Scenario: Selecting images using an identifier
92
139
  When I select the images with class "image"
93
140
  Then I should have 3 images
94
141
  And the alt for image 1 should be "image 1"
95
142
  And the alt for image 2 should be "image 2"
96
143
  And the alt for image 3 should be "image 3"
97
144
 
98
- Scenario: Selecting forms
145
+ Scenario: Selecting images using no identifier
146
+ When I select the images using no identifier
147
+ Then I should have 3 images
148
+
149
+ Scenario: Selecting forms using an identifier
99
150
  When I select the forms with class "form"
100
151
  Then I should have 3 forms
101
152
  And the action for form 1 should be "form1"
102
153
  And the action for form 2 should be "form2"
103
154
  And the action for form 3 should be "form3"
104
155
 
105
- Scenario: Selecting list items
156
+ Scenario: Selecting forms using no identifier
157
+ When I select the forms using no identifier
158
+ Then I should have 3 forms
159
+
160
+ Scenario: Selecting list items using an identifier
106
161
  When I select the list items with class "li"
107
162
  Then I should have 3 list items
108
163
  And the text for list item 1 should be "Item One"
109
164
  And the text for list item 2 should be "Item Two"
110
165
  And the text for list item 3 should be "Item Three"
111
166
 
112
- Scenario: Selecting unordered lists
167
+ Scenario: Selecting list items using no identifier
168
+ When I select all list items using no identifier
169
+ Then I should have 8 list items
170
+
171
+ Scenario: Selecting unordered lists using an identifier
113
172
  When I select the unordered lists with class "ul"
114
173
  Then I should have 3 unordered lists
115
174
  And the text for the first item in unordered list 1 should be "Item One"
116
175
  And the text for the first item in unordered list 2 should be "Item Four"
117
176
  And the text for the first item in unordered list 3 should be "Item Five"
118
177
 
119
- Scenario: Selecting ordered lists
178
+ Scenario: Selecting unordered lists using no identifier
179
+ When I select all unordered lists using no identifier
180
+ Then I should have 3 unordered lists
181
+
182
+ Scenario: Selecting ordered lists using an identifier
120
183
  When I select the ordered lists with class "ol"
121
184
  Then I should have 3 ordered lists
122
185
  And the text for the first item in ordered list 1 should be "Number One"
123
186
  And the text for the first item in ordered list 2 should be "Number Two"
124
187
  And the text for the first item in ordered list 3 should be "Number Three"
125
188
 
126
- Scenario: Selecting h1s
189
+ Scenario: Selecting ordered lists using no identifier
190
+ When I select all ordered lists using no identifier
191
+ Then I should have 3 ordered lists
192
+
193
+ Scenario: Selecting h1s using an identifier
127
194
  When I select the h1s with class "h1"
128
195
  Then I should have 3 h1s
129
196
  And the text for h1 1 should be "H1 One"
130
197
  And the text for h1 2 should be "H1 Two"
131
198
  And the text for h1 3 should be "H1 Three"
132
199
 
133
- Scenario: Selecting h2s
200
+ Scenario: Selecting h1s using no identifier
201
+ When I select all h1s using no identifier
202
+ Then I should have 3 h1s
203
+
204
+ Scenario: Selecting h2s using an identifier
134
205
  When I select the h2s with class "h2"
135
206
  Then I should have 3 h2s
136
207
  And the text for h2 1 should be "H2 One"
137
208
  And the text for h2 2 should be "H2 Two"
138
209
  And the text for h2 3 should be "H2 Three"
139
210
 
140
- Scenario: Selecting h3s
211
+ Scenario: Selecting h2s using no identifier
212
+ When I select all h2s using no identifier
213
+ Then I should have 3 h2s
214
+
215
+ Scenario: Selecting h3s using an identifier
141
216
  When I select the h3s with class "h3"
142
217
  Then I should have 3 h3s
143
218
  And the text for h3 1 should be "H3 One"
144
219
  And the text for h3 2 should be "H3 Two"
145
220
  And the text for h3 3 should be "H3 Three"
146
221
 
147
- Scenario: Selecting h4s
222
+ Scenario: Selecting h3s using no identifier
223
+ When I select all h3s using no identifier
224
+ Then I should have 3 h3s
225
+
226
+ Scenario: Selecting h4s using an identifier
148
227
  When I select the h4s with class "h4"
149
228
  Then I should have 3 h4s
150
229
  And the text for h4 1 should be "H4 One"
151
230
  And the text for h4 2 should be "H4 Two"
152
231
  And the text for h4 3 should be "H4 Three"
153
232
 
154
- Scenario: Selecting h5s
233
+ Scenario: Selecting h4s using no identifier
234
+ When I select all h4s using no identifier
235
+ Then I should have 3 h4s
236
+
237
+ Scenario: Selecting h5s using an identifier
155
238
  When I select the h5s with class "h5"
156
239
  Then I should have 3 h5s
157
240
  And the text for h5 1 should be "H5 One"
158
241
  And the text for h5 2 should be "H5 Two"
159
242
  And the text for h5 3 should be "H5 Three"
160
243
 
161
- Scenario: Selecting h6s
244
+ Scenario: Selecting h5s using no identifier
245
+ When I select all h5s using no identifier
246
+ Then I should have 3 h5s
247
+
248
+ Scenario: Selecting h6s using an identifier
162
249
  When I select the h6s with class "h6"
163
250
  Then I should have 3 h6s
164
251
  And the text for h6 1 should be "H6 One"
165
252
  And the text for h6 2 should be "H6 Two"
166
253
  And the text for h6 3 should be "H6 Three"
167
254
 
168
- Scenario: Selecting paragraphs
255
+ Scenario: Selecting h6s using no identifier
256
+ When I select all h6s using no identifier
257
+ Then I should have 3 h6s
258
+
259
+ Scenario: Selecting paragraphs using an identifier
169
260
  When I select the paragraphs with class "p"
170
261
  Then I should have 3 paragraphs
171
262
  And the text for paragraph 1 should be "Paragraph One"
172
263
  And the text for paragraph 2 should be "Paragraph Two"
173
264
  And the text for paragraph 3 should be "Paragraph Three"
174
265
 
175
- Scenario: Selecting labels
266
+ Scenario: Selcting paragraphs using no identifier
267
+ When I select all paragraphs using no identifier
268
+ Then I should have 3 paragraphs
269
+
270
+ Scenario: Selecting labels using an identifier
176
271
  When I select the labels with class "label"
177
272
  Then I should have 3 labels
178
273
  And the text for label 1 should be "Label 1"
179
274
  And the text for label 2 should be "Label 2"
180
275
  And the text for label 3 should be "Label 3"
276
+
277
+ Scenario: Selecting lables using no identifier
278
+ When I select all labels using no identifier
279
+ Then I should have 3 labels
280
+
281
+ Scenario: Selecting file fields using an identifier
282
+ When I select the file fields with class "file_field_class"
283
+ Then I should have 3 file fields
284
+ And the title for file field 1 should be "File Field 1"
285
+ And the title for file field 2 should be "File Field 2"
286
+ And the title for file field 3 should be "File Field 3"
287
+
288
+ Scenario: Selecting file fields using no identifier
289
+ When I select all file fields using no identifier
290
+ Then I should have 3 file fields