selenium-cucumber 0.0.2 → 0.0.4

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.
Files changed (28) hide show
  1. data/doc/canned_steps.md +337 -76
  2. data/doc/installation.md +13 -13
  3. data/features-skeleton/my_first.feature +5 -5
  4. data/features-skeleton/step_definitions/custom_steps.rb +3 -3
  5. data/features-skeleton/support/env.rb +37 -29
  6. data/lib/selenium-cucumber.rb +8 -7
  7. data/lib/selenium-cucumber/assertion_steps.rb +436 -57
  8. data/lib/selenium-cucumber/configuration_steps.rb +7 -0
  9. data/lib/selenium-cucumber/input_steps.rb +322 -0
  10. data/lib/selenium-cucumber/javascript_handling_steps.rb +9 -0
  11. data/lib/selenium-cucumber/methods/assertion_methods.rb +165 -34
  12. data/lib/selenium-cucumber/methods/configuration_methods.rb +9 -0
  13. data/lib/selenium-cucumber/methods/input_methods.rb +87 -0
  14. data/lib/selenium-cucumber/methods/javascript_handling_methods.rb +6 -0
  15. data/lib/selenium-cucumber/methods/navigate_methods.rb +75 -11
  16. data/lib/selenium-cucumber/methods/press_button_methods.rb +6 -6
  17. data/lib/selenium-cucumber/methods/progress_methods.rb +15 -6
  18. data/lib/selenium-cucumber/methods/screenshot_methods.rb +7 -0
  19. data/lib/selenium-cucumber/navigation_steps.rb +104 -9
  20. data/lib/selenium-cucumber/press_button_steps.rb +37 -13
  21. data/lib/selenium-cucumber/progress_steps.rb +58 -0
  22. data/lib/selenium-cucumber/screenshot_steps.rb +5 -0
  23. data/lib/selenium-cucumber/version.rb +1 -1
  24. metadata +19 -11
  25. data/lib/selenium-cucumber/enter_text_steps.rb +0 -27
  26. data/lib/selenium-cucumber/methods/enter_text_methods.rb +0 -14
  27. data/lib/selenium-cucumber/progress_step.rb +0 -17
  28. data/lib/selenium-cucumber/screenshot_step.rb +0 -8
data/doc/canned_steps.md CHANGED
@@ -1,76 +1,337 @@
1
- Canned Steps
2
- ============
3
- selenium-cucumber comes with the following set of predefined steps.
4
- You can add your own steps or change the ones you see here.
5
-
6
- Assertion Steps
7
- ---------------
8
- To assert that page title can be found use following step.
9
-
10
- Then(/^I see page title as "(.*?)"$/)
11
-
12
- To assert that value of element can be found use any of the following steps.
13
-
14
- Then /^I should see element value as "([^\"]*)" where element id is "([^\"]*)"$/
15
- Then /^I should see element value as "([^\"]*)" where element name is "([^\"]*)"$/
16
- Then /^I should see element value as "([^\"]*)" where element xpath is "([^\"]*)"$/
17
-
18
-
19
- To assert that value of element cannot be found use any of the following steps.
20
-
21
- Then /^I should not see element value as "([^\"]*)" where element id is "([^\"]*)"$/
22
- Then /^I should not see element value as "([^\"]*)" where element name is "([^\"]*)"$/
23
- Then /^I should not see element value as "([^\"]*)" where element xpath is "([^\"]*)"$/
24
-
25
-
26
- To assert that element is enabled use any of the following steps.
27
-
28
- Then /^element with id "([^\"]*)" should enable$/
29
- Then /^element with name "([^\"]*)" should enable$/
30
- Then /^element with xpath "([^\"]*)" should enable$/
31
-
32
- To assert that element is disabled use any of the following steps.
33
-
34
- Then /^element with id "([^\"]*)" should disable$/
35
- Then /^element with name "([^\"]*)" should disable$/
36
- Then /^element with xpath "([^\"]*)" should disable$/
37
-
38
- Input Steps
39
- -----------
40
- To enter text into input field use following steps
41
-
42
- Then /^I enter "([^\"]*)" into input field with id "([^\"]*)"$/
43
- Then /^I enter "([^\"]*)" into input field with name "([^\"]*)"$/
44
- Then /^I enter "([^\"]*)" into input field with xpath "([^\"]*)"$/
45
-
46
- To clear input field use following steps
47
-
48
- Then /^I clear input field with id "([^\"]*)"$/
49
- Then /^I clear input field with name "([^\"]*)"$/
50
- Then /^I clear input field with xpath "([^\"]*)"$/
51
-
52
- Navigation Steps
53
- ----------------
54
-
55
- Then(/^I navigate to "([^\"]*)"$/)
56
- Then(/^I close browser$/)
57
-
58
- Click Steps
59
- -----------
60
-
61
- Then(/^I click on element with id "(.*?)"$/)
62
- Then(/^I click on element with name "(.*?)"$/)
63
- Then(/^I click on element with xpath "(.*?)"$/)
64
-
65
- Progress Steps
66
- --------------
67
-
68
- Then(/^I wait for (\d+) sec$/)
69
- Then(/^I wait "(.*?)" second for element having id "(.*?)"$/)
70
- Then(/^I wait "(.*?)" second for element having name "(.*?)"$/)
71
- Then(/^I wait "(.*?)" second for element having xpath "(.*?)"$/)
72
-
73
- Screenshot Steps
74
- ----------------
75
-
76
- Then(/^I take screenshot$/)
1
+ Canned Steps
2
+ ============
3
+ selenium-cucumber comes having the following set of predefined steps.
4
+ You can add your own steps or change the ones you see here.
5
+
6
+ Navigation Steps
7
+ ----------------
8
+ To open/close URL and to navigate between pages use following steps
9
+
10
+ Then I navigate to "([^\"]*)"
11
+ Then I navigate forward
12
+ Then I navigate back
13
+ Then I refresh page
14
+
15
+ To interact with browser use following steps
16
+
17
+ Then I resize browser with width (\d+) and heigth (\d+)
18
+ Then I close browser
19
+
20
+ To zoom in/out webpage use following steps
21
+
22
+ Then I zoom in page
23
+ Then I zoom out page
24
+
25
+ To zoom in/out webpage till necessary element displays use following steps
26
+
27
+ Then I zoom in page till I see element having id "(.*?)"
28
+ Then I zoom in page till I see element having name "(.*?)"
29
+ Then I zoom in page till I see element having class "(.*?)"
30
+ Then I zoom in page till I see element having xpath "(.*?)"
31
+ Then I zoom in page till I see element having css "(.*?)"
32
+
33
+ Then I zoom out page till I see element having id "(.*?)"
34
+ Then I zoom out page till I see element having name "(.*?)"
35
+ Then I zoom out page till I see element having class "(.*?)"
36
+ Then I zoom out page till I see element having xpath "(.*?)"
37
+ Then I zoom out page till I see element having css "(.*?)"
38
+
39
+ To reset webpage view use following step
40
+
41
+ Then I reset page view
42
+
43
+
44
+ Assertion Steps
45
+ ---------------
46
+ To assert that page title can be found use following step.
47
+
48
+ Then I see page title as "(.*?)"
49
+
50
+ To assert element text use any of the following steps.
51
+
52
+ Then I should see text as "(.*?)" for element having id "(.*?)"
53
+ Then I should see text as "(.*?)" for element having class "(.*?)"
54
+ Then I should see text as "(.*?)" for element having name "(.*?)"
55
+ Then I should see text as "(.*?)" for element having xpath "(.*?)"
56
+ Then I should see text as "(.*?)" for element having css "(.*?)"
57
+
58
+ Then I should not see text as "(.*?)" for element having id "(.*?)"
59
+ Then I should not see text as "(.*?)" for element having class "(.*?)"
60
+ Then I should not see text as "(.*?)" for element having name "(.*?)"
61
+ Then I should not see text as "(.*?)" for element having xpath "(.*?)"
62
+ Then I should not see text as "(.*?)" for element having css "(.*?)"
63
+
64
+ To assert element attribute use any of the following steps.
65
+
66
+ Then I should see attribute "(.*?)" having value "(.*?)" for element having id "(.*?)"
67
+ Then I should see attribute "(.*?)" having value "(.*?)" for element having class "(.*?)"
68
+ Then I should see attribute "(.*?)" having value "(.*?)" for element having name "(.*?)"
69
+ Then I should see attribute "(.*?)" having value "(.*?)" for element having xpath "(.*?)"
70
+ Then I should see attribute "(.*?)" having value "(.*?)" for element having css "(.*?)"
71
+
72
+ Then I should not see attribute "(.*?)" having value "(.*?)" for element having id "(.*?)"
73
+ Then I should not see attribute "(.*?)" having value "(.*?)" for element having class "(.*?)"
74
+ Then I should not see attribute "(.*?)" having value "(.*?)" for element having name "(.*?)"
75
+ Then I should not see attribute "(.*?)" having value "(.*?)" for element having xpath "(.*?)"
76
+ Then I should not see attribute "(.*?)" having value "(.*?)" for element having css "(.*?)"
77
+
78
+ To assert that element is enabled use any of the following steps.
79
+
80
+ Then element having id "([^\"]*)" should enable
81
+ Then element having name "([^\"]*)" should enable
82
+ Then element having class "([^\"]*)" should enable
83
+ Then element having xpath "([^\"]*)" should enable
84
+ Then element having css "([^\"]*)" should enable
85
+
86
+ To assert that element is disabled use any of the following steps.
87
+
88
+ Then element having id "([^\"]*)" should disable
89
+ Then element having name "([^\"]*)" should disable
90
+ Then element having class "([^\"]*)" should disable
91
+ Then element having xpath "([^\"]*)" should disable
92
+ Then element having css "([^\"]*)" should disable
93
+
94
+ To assert that element is present use any of the following steps.
95
+
96
+ Then I should see element present having id "(.*?)"
97
+ Then I should see element present having name "(.*?)"
98
+ Then I should see element present having class "(.*?)"
99
+ Then I should see element present having xpath "(.*?)"
100
+ Then I should see element present having css "(.*?)"
101
+
102
+ To assert that element is not present use any of the following steps.
103
+
104
+ Then I should not see element present having id "(.*?)"
105
+ Then I should not see element present having name "(.*?)"
106
+ Then I should not see element present having class "(.*?)"
107
+ Then I should not see element present having xpath "(.*?)"
108
+ Then I should not see element present having css "(.*?)"
109
+
110
+
111
+ To assert that checkbox is checked use any of the following steps.
112
+
113
+ Then I should see checkbox having id "(.*?)" checked
114
+ Then I should see checkbox having name "(.*?)" checked
115
+ Then I should see checkbox having class "(.*?)" checked
116
+ Then I should see checkbox having xpath "(.*?)" checked
117
+ Then I should see checkbox having css "(.*?)" checked
118
+
119
+ To assert that checkbox is unchecked use any of the following steps.
120
+
121
+ Then I should see checkbox having id "(.*?)" unchecked
122
+ Then I should see checkbox having name "(.*?)" unchecked
123
+ Then I should see checkbox having class "(.*?)" unchecked
124
+ Then I should see checkbox having xpath "(.*?)" unchecked
125
+ Then I should see checkbox having css "(.*?)" unchecked
126
+
127
+ To assert that radio button selected use any of the following steps.
128
+
129
+ Then I should see radio button having id "(.*?)" selected
130
+ Then I should see radio button having name "(.*?)" selected
131
+ Then I should see radio button having class "(.*?)" selected
132
+ Then I should see radio button having xpath "(.*?)" selected
133
+ Then I should see radio button having css "(.*?)" selected
134
+
135
+ To assert that radio button not selected use any of the following steps.
136
+
137
+ Then I should see radio button having id "(.*?)" not selected
138
+ Then I should see radio button having name "(.*?)" not selected
139
+ Then I should see radio button having class "(.*?)" not selected
140
+ Then I should see radio button having xpath "(.*?)" not selected
141
+ Then I should see radio button having css "(.*?)" not selected
142
+
143
+ To assert that radio button group selected by text use any of the following steps.
144
+
145
+ Then I should see "(.*?)" option by text from radio button group having id "(.*?)" selected
146
+ Then I should see "(.*?)" option by text from radio button group having name "(.*?)" selected
147
+ Then I should see "(.*?)" option by text from radio button group having class "(.*?)" selected
148
+ Then I should see "(.*?)" option by text from radio button group having xpath "(.*?)" selected
149
+ Then I should see "(.*?)" option by text from radio button group having css "(.*?)" selected
150
+
151
+ To assert that radio button group selected by value use any of the following steps.
152
+
153
+ Then I should see "(.*?)" option by value from radio button group having id "(.*?)" selected
154
+ Then I should see "(.*?)" option by value from radio button group having name "(.*?)" selected
155
+ Then I should see "(.*?)" option by value from radio button group having class "(.*?)" selected
156
+ Then I should see "(.*?)" option by value from radio button group having xpath "(.*?)" selected
157
+ Then I should see "(.*?)" option by value from radio button group having css "(.*?)" selected
158
+
159
+ To assert that radio button group not selected by text use any of the following steps.
160
+
161
+ Then I should see "(.*?)" option by text from radio button group having id "(.*?)" not selected
162
+ Then I should see "(.*?)" option by text from radio button group having name "(.*?)" not selected
163
+ Then I should see "(.*?)" option by text from radio button group having class "(.*?)" not selected
164
+ Then I should see "(.*?)" option by text from radio button group having xpath "(.*?)" not selected
165
+ Then I should see "(.*?)" option by text from radio button group having css "(.*?)" not selected
166
+
167
+ To assert that radio button group not selected by value use any of the following steps.
168
+
169
+ Then I should see "(.*?)" option by value from radio button group having id "(.*?)" not selected
170
+ Then I should see "(.*?)" option by value from radio button group having name "(.*?)" not selected
171
+ Then I should see "(.*?)" option by value from radio button group having class "(.*?)" not selected
172
+ Then I should see "(.*?)" option by value from radio button group having xpath "(.*?)" not selected
173
+ Then I should see "(.*?)" option by value from radio button group having css "(.*?)" not selected
174
+
175
+ To assert that link is present use following steps
176
+
177
+ Then I should see link present having text "(.*?)"
178
+ Then I should see link present having partial text "(.*?)"
179
+
180
+ Then I should see link not present having text "(.*?)"
181
+ Then I should see link not present having partial text "(.*?)"
182
+
183
+ Input Steps
184
+ -----------
185
+ To enter text into input field use following steps
186
+
187
+ Then I enter "([^\"]*)" into input field having id "([^\"]*)
188
+ Then I enter "([^\"]*)" into input field having name "([^\"]*)
189
+ Then I enter "([^\"]*)" into input field having class "([^\"]*)
190
+ Then I enter "([^\"]*)" into input field having xpath "([^\"]*)
191
+ Then I enter "([^\"]*)" into input field having css "([^\"]*)
192
+
193
+ To clear input field use following steps
194
+
195
+ Then I clear input field having id "([^\"]*)
196
+ Then I clear input field having name "([^\"]*)
197
+ Then I clear input field having class "([^\"]*)
198
+ Then I clear input field having xpath "([^\"]*)
199
+ Then I clear input field having css "([^\"]*)
200
+
201
+ To select option by text from dropdown/multiselect use following steps
202
+
203
+ Then I select "(.*?)" option by text from dropdown having id "(.*?)"
204
+ Then I select "(.*?)" option by text from dropdown having name "(.*?)"
205
+ Then I select "(.*?)" option by text from dropdown having class "(.*?)"
206
+ Then I select "(.*?)" option by text from dropdown having xpath "(.*?)"
207
+ Then I select "(.*?)" option by text from dropdown having css "(.*?)"
208
+
209
+ To select option by index from dropdown/multiselect use following steps
210
+
211
+ Then I select (\d+) option by index from dropdown having id "(.*?)"
212
+ Then I select (\d+) option by index from dropdown having name "(.*?)"
213
+ Then I select (\d+) option by index from dropdown having class "(.*?)"
214
+ Then I select (\d+) option by index from dropdown having xpath "(.*?)"
215
+ Then I select (\d+) option by index from dropdown having css "(.*?)"
216
+
217
+ To select option by value from dropdown/multiselect use following steps
218
+
219
+ Then I select "(.*?)" option by value from dropdown having id "(.*?)"
220
+ Then I select "(.*?)" option by value from dropdown having name "(.*?)"
221
+ Then I select "(.*?)" option by value from dropdown having class "(.*?)"
222
+ Then I select "(.*?)" option by value from dropdown having xpath "(.*?)"
223
+ Then I select "(.*?)" option by value from dropdown having css "(.*?)"
224
+
225
+ To unselect all option from dropdown/multiselect use following steps
226
+
227
+ Then I unselect options from dropdown having id "(.*?)"
228
+ Then I unselect options from dropdown having name "(.*?)"
229
+ Then I unselect options from dropdown having class "(.*?)"
230
+ Then I unselect options from dropdown having xpath "(.*?)"
231
+ Then I unselect options from dropdown having css "(.*?)"
232
+
233
+ To check checkbox use following steps
234
+
235
+ Then I check checkbox having id "(.*?)"
236
+ Then I check checkbox having name "(.*?)"
237
+ Then I check checkbox having class "(.*?)"
238
+ Then I check checkbox having xpath "(.*?)"
239
+ Then I check checkbox having css "(.*?)"
240
+
241
+ To uncheck checkbox use following steps
242
+
243
+ Then I uncheck checkbox having id "(.*?)"
244
+ Then I uncheck checkbox having name "(.*?)"
245
+ Then I uncheck checkbox having class "(.*?)"
246
+ Then I uncheck checkbox having xpath "(.*?)"
247
+ Then I uncheck checkbox having css "(.*?)"
248
+
249
+ To toggle checkbox use following steps
250
+
251
+ Then toggle checkbox having id "(.*?)"
252
+ Then toggle checkbox having name "(.*?)"
253
+ Then toggle checkbox having class "(.*?)"
254
+ Then toggle checkbox having xpath "(.*?)"
255
+ Then toggle checkbox having css "(.*?)"
256
+
257
+ To select radio button use following steps
258
+
259
+ Then I select radio button having id "(.*?)"
260
+ Then I select radio button having name "(.*?)"
261
+ Then I select radio button having class "(.*?)"
262
+ Then I select radio button having xpath "(.*?)"
263
+ Then I select radio button having css "(.*?)"
264
+
265
+
266
+ To select one radio button by text from radio button group use following steps
267
+
268
+ Then I select "(.*?)" option by text from radio button group having id "(.*?)"
269
+ Then I select "(.*?)" option by text from radio button group having name "(.*?)"
270
+ Then I select "(.*?)" option by text from radio button group having class "(.*?)"
271
+ Then I select "(.*?)" option by text from radio button group having xpath "(.*?)"
272
+ Then I select "(.*?)" option by text from radio button group having css "(.*?)"
273
+
274
+ To select one radio button by value from radio button group use following steps
275
+
276
+ Then I select "(.*?)" option by value from radio button group having id "(.*?)"
277
+ Then I select "(.*?)" option by value from radio button group having name "(.*?)"
278
+ Then I select "(.*?)" option by value from radio button group having class "(.*?)"
279
+ Then I select "(.*?)" option by value from radio button group having xpath "(.*?)"
280
+ Then I select "(.*?)" option by value from radio button group having css "(.*?)"
281
+
282
+
283
+ Click Steps
284
+ -----------
285
+ To click on web element use following steps
286
+
287
+ Then I click on element having id "(.*?)"
288
+ Then I click on element having name "(.*?)"
289
+ Then I click on element having class "(.*?)"
290
+ Then I click on element having xpath "(.*?)"
291
+ Then I click on element having css "(.*?)"
292
+
293
+ To click on links use following steps
294
+
295
+ Then I click on link having text "(.*?)"
296
+ Then I click on link having partial text "(.*?)"
297
+
298
+ Progress Steps
299
+ --------------
300
+ To wait for specific time and for specific element to display use following steps
301
+
302
+ Then I wait for (\d+) sec
303
+ Then I wait "(.*?)" seconds for element to display having id "(.*?)"
304
+ Then I wait "(.*?)" seconds for element to display having name "(.*?)"
305
+ Then I wait "(.*?)" seconds for element to display having class "(.*?)"
306
+ Then I wait "(.*?)" seconds for element to display having xpath "(.*?)"
307
+ Then I wait "(.*?)" seconds for element to display having css "(.*?)"
308
+
309
+ To wait for specific time and for specific element to enable use following steps
310
+
311
+ Then I wait for (\d+) sec
312
+ Then I wait "(.*?)" seconds for element to enable having id "(.*?)"
313
+ Then I wait "(.*?)" seconds for element to enable having name "(.*?)"
314
+ Then I wait "(.*?)" seconds for element to enable having class "(.*?)"
315
+ Then I wait "(.*?)" seconds for element to enable having xpath "(.*?)"
316
+ Then I wait "(.*?)" seconds for element to enable having css "(.*?)"
317
+
318
+ Javascript Handling Steps
319
+ -------------------------
320
+ To handle javascript pop-up use following steps
321
+
322
+ Then I accept alert
323
+ Then I dismiss alert
324
+
325
+
326
+ Screenshot Steps
327
+ ----------------
328
+ To take screenshot use following step
329
+
330
+ Then I take screenshot
331
+
332
+
333
+ Configuration Steps
334
+ -------------------
335
+ To print testing configuration use following step
336
+
337
+ Then I print configuration
data/doc/installation.md CHANGED
@@ -1,13 +1,13 @@
1
- Installation
2
- ============
3
- ### Prerequisites
4
- You need to have Ruby installed. Verify your installation by running ruby -v in a terminal - it should print "ruby 1.8.7" (or higher).
5
-
6
- If you are on Windows you can get Ruby from [RubyInstaller.org](http://rubyinstaller.org/)
7
-
8
- ### Installation
9
-
10
- Install `selenium-cucumber` by running
11
-
12
- - `gem install selenium-cucumber`
13
- - You might have to run `sudo gem install selenium-cucumber` if you do not have the right permissions.
1
+ Installation
2
+ ============
3
+ ### Prerequisites
4
+ You need to have Ruby installed. Verify your installation by running ruby -v in a terminal - it should print "ruby 1.8.7" (or higher).
5
+
6
+ If you are on Windows you can get Ruby from [RubyInstaller.org](http://rubyinstaller.org/)
7
+
8
+ ### Installation
9
+
10
+ Install `selenium-cucumber` by running
11
+
12
+ - `gem install selenium-cucumber`
13
+ - You might have to run `sudo gem install selenium-cucumber` if you do not have the right permissions.
@@ -1,5 +1,5 @@
1
- Feature: Login feature
2
-
3
- Scenario: As a valid user I can log into my web app
4
- When I press "Login"
5
- Then I see "Welcome to coolest web app ever"
1
+ Feature: Login feature
2
+
3
+ Scenario: As a valid user I can log into my web app
4
+ When I press "Login"
5
+ Then I see "Welcome to coolest web app ever"