selenium-cucumber 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/doc/canned_steps.md CHANGED
@@ -78,19 +78,19 @@ To assert element attribute use any of the following steps.
78
78
 
79
79
  To assert that element is enabled use any of the following steps.
80
80
 
81
- Then element having id "([^\"]*)" should enable
82
- Then element having name "([^\"]*)" should enable
83
- Then element having class "([^\"]*)" should enable
84
- Then element having xpath "([^\"]*)" should enable
85
- Then element having css "([^\"]*)" should enable
81
+ Then element having id "([^\"]*)" should be enabled
82
+ Then element having name "([^\"]*)" should be enabled
83
+ Then element having class "([^\"]*)" should be enabled
84
+ Then element having xpath "([^\"]*)" should be enabled
85
+ Then element having css "([^\"]*)" should be enabled
86
86
 
87
87
  To assert that element is disabled use any of the following steps.
88
88
 
89
- Then element having id "([^\"]*)" should disable
90
- Then element having name "([^\"]*)" should disable
91
- Then element having class "([^\"]*)" should disable
92
- Then element having xpath "([^\"]*)" should disable
93
- Then element having css "([^\"]*)" should disable
89
+ Then element having id "([^\"]*)" should be disabled
90
+ Then element having name "([^\"]*)" should be disabled
91
+ Then element having class "([^\"]*)" should be disabled
92
+ Then element having xpath "([^\"]*)" should be disabled
93
+ Then element having css "([^\"]*)" should be disabled
94
94
 
95
95
  To assert that element is present use any of the following steps.
96
96
 
@@ -102,11 +102,11 @@ To assert that element is present use any of the following steps.
102
102
 
103
103
  To assert that element is not present use any of the following steps.
104
104
 
105
- Then I should see element not present having id "(.*?)"
106
- Then I should see element not present having name "(.*?)"
107
- Then I should see element not present having class "(.*?)"
108
- Then I should see element not present having xpath "(.*?)"
109
- Then I should see element not present having css "(.*?)"
105
+ Then I should not see element present having id "(.*?)"
106
+ Then I should not see element present having name "(.*?)"
107
+ Then I should not see element present having class "(.*?)"
108
+ Then I should not see element present having xpath "(.*?)"
109
+ Then I should not see element present having css "(.*?)"
110
110
 
111
111
 
112
112
  To assert that checkbox is checked use any of the following steps.
@@ -135,11 +135,11 @@ To assert that radio button selected use any of the following steps.
135
135
 
136
136
  To assert that radio button not selected use any of the following steps.
137
137
 
138
- Then I should see radio button having id "(.*?)" not selected
139
- Then I should see radio button having name "(.*?)" not selected
140
- Then I should see radio button having class "(.*?)" not selected
141
- Then I should see radio button having xpath "(.*?)" not selected
142
- Then I should see radio button having css "(.*?)" not selected
138
+ Then I should see radio button having id "(.*?)" unselected
139
+ Then I should see radio button having name "(.*?)" unselected
140
+ Then I should see radio button having class "(.*?)" unselected
141
+ Then I should see radio button having xpath "(.*?)" unselected
142
+ Then I should see radio button having css "(.*?)" unselected
143
143
 
144
144
  To assert that radio button group selected by text use any of the following steps.
145
145
 
@@ -159,19 +159,19 @@ To assert that radio button group selected by value use any of the following ste
159
159
 
160
160
  To assert that radio button group not selected by text use any of the following steps.
161
161
 
162
- Then I should see "(.*?)" option by text from radio button group having id "(.*?)" not selected
163
- Then I should see "(.*?)" option by text from radio button group having name "(.*?)" not selected
164
- Then I should see "(.*?)" option by text from radio button group having class "(.*?)" not selected
165
- Then I should see "(.*?)" option by text from radio button group having xpath "(.*?)" not selected
166
- Then I should see "(.*?)" option by text from radio button group having css "(.*?)" not selected
162
+ Then I should see "(.*?)" option by text from radio button group having id "(.*?)" unselected
163
+ Then I should see "(.*?)" option by text from radio button group having name "(.*?)" unselected
164
+ Then I should see "(.*?)" option by text from radio button group having class "(.*?)" unselected
165
+ Then I should see "(.*?)" option by text from radio button group having xpath "(.*?)" unselected
166
+ Then I should see "(.*?)" option by text from radio button group having css "(.*?)" unselected
167
167
 
168
168
  To assert that radio button group not selected by value use any of the following steps.
169
169
 
170
- Then I should see "(.*?)" option by value from radio button group having id "(.*?)" not selected
171
- Then I should see "(.*?)" option by value from radio button group having name "(.*?)" not selected
172
- Then I should see "(.*?)" option by value from radio button group having class "(.*?)" not selected
173
- Then I should see "(.*?)" option by value from radio button group having xpath "(.*?)" not selected
174
- Then I should see "(.*?)" option by value from radio button group having css "(.*?)" not selected
170
+ Then I should see "(.*?)" option by value from radio button group having id "(.*?)" unselected
171
+ Then I should see "(.*?)" option by value from radio button group having name "(.*?)" unselected
172
+ Then I should see "(.*?)" option by value from radio button group having class "(.*?)" unselected
173
+ Then I should see "(.*?)" option by value from radio button group having xpath "(.*?)" unselected
174
+ Then I should see "(.*?)" option by value from radio button group having css "(.*?)" unselected
175
175
 
176
176
  To assert that link is present use following steps
177
177
 
@@ -335,4 +335,4 @@ Configuration Steps
335
335
  -------------------
336
336
  To print testing configuration use following step
337
337
 
338
- Then I print configuration
338
+ Then I print configuration
@@ -0,0 +1,16 @@
1
+ Usage: selenium-cucumber <command-name> [parameters] [options]
2
+ <command-name> can be one of
3
+ help
4
+ gen
5
+ version
6
+
7
+ Commands:
8
+ help : prints more detailed help information.
9
+
10
+ gen : creates a skeleton features dir. This is usually used once when
11
+ setting up selnium-cucumber to ensure that the features folder contains
12
+ the right step definitions and environment to run with cucumber.
13
+
14
+ version : prints the gem version
15
+
16
+ Options: -v, --verbose Turns on verbose logging
@@ -1,437 +1,68 @@
1
1
  require_relative 'methods/assertion_methods'
2
2
 
3
+
3
4
  #Page title checking
4
5
  Then(/^I see page title as "(.*?)"$/) do |title|
5
6
  check_title(title)
6
7
  end
7
8
 
8
- #Check element text steps : positive test
9
-
10
- #By ID
11
- Then(/^I should see text as "(.*?)" for element having id "(.*?)"$/) do |actual_value , access_name|
12
- check_element_text("id", actual_value, access_name, true)
13
- end
14
-
15
- #By CLASS
16
- Then(/^I should see text as "(.*?)" for element having class "(.*?)"$/) do |actual_value , access_name|
17
- check_element_text("class", actual_value, access_name, true)
18
- end
19
-
20
- #By NAME
21
- Then(/^I should see text as "(.*?)" for element having name "(.*?)"$/) do |actual_value , access_name|
22
- check_element_text("name", actual_value, access_name, true)
23
- end
24
-
25
- #By XPATH
26
- Then(/^I should see text as "(.*?)" for element having xpath "(.*?)"$/) do |actual_value , access_name|
27
- check_element_text("xpath", actual_value, access_name, true)
28
- end
29
-
30
- #By CSS
31
- Then(/^I should see text as "(.*?)" for element having css "(.*?)"$/) do |actual_value , access_name|
32
- check_element_text("css", actual_value, access_name, true)
33
- end
34
-
35
- # check element text steps : negative test
36
-
37
- #By ID
38
- Then(/^I should not see text as "(.*?)" for element having id "(.*?)"$/) do |actual_value , access_name|
39
- check_element_text("id", actual_value, access_name, false)
40
- end
41
-
42
- #By CLASS
43
- Then(/^I should not see text as "(.*?)" for element having class "(.*?)"$/) do |actual_value , access_name|
44
- check_element_text("class", actual_value, access_name, false)
45
- end
46
-
47
- #By NAME
48
- Then(/^I should not see text as "(.*?)" for element having name "(.*?)"$/) do |actual_value , access_name|
49
- check_element_text("name", actual_value, access_name, false)
50
- end
51
-
52
- #By XPATH
53
- Then(/^I should not see text as "(.*?)" for element having xpath "(.*?)"$/) do |actual_value , access_name|
54
- check_element_text("xpath", actual_value, access_name, false)
55
- end
56
-
57
- #By CSS
58
- Then(/^I should not see text as "(.*?)" for element having css "(.*?)"$/) do |actual_value , access_name|
59
- check_element_text("css", actual_value, access_name, false)
60
- end
61
-
62
- # To check attribute value - positive test
63
-
64
- #By ID
65
- Then(/^I should see attribute "(.*?)" having value "(.*?)" for element having id "(.*?)"$/) do |attribute_name , attribute_value , access_name|
66
- check_element_attribute("id", attribute_name , attribute_value, access_name, true)
67
- end
68
-
69
- #By CLASS
70
- Then(/^I should see attribute "(.*?)" having value "(.*?)" for element having class "(.*?)"$/) do |attribute_name , attribute_value , access_name|
71
- check_element_attribute("class", attribute_name , attribute_value, access_name, true)
72
- end
73
-
74
- #By NAME
75
- Then(/^I should see attribute "(.*?)" having value "(.*?)" for element having name "(.*?)"$/) do |attribute_name , attribute_value , access_name|
76
- check_element_attribute("name", attribute_name , attribute_value, access_name, true)
77
- end
78
-
79
- #By XPATH
80
- Then(/^I should see attribute "(.*?)" having value "(.*?)" for element having xpath "(.*?)"$/) do |attribute_name , attribute_value , access_name|
81
- check_element_attribute("xpath", attribute_name , attribute_value, access_name, true)
82
- end
83
-
84
- #By CSS
85
- Then(/^I should see attribute "(.*?)" having value "(.*?)" for element having css "(.*?)"$/) do |attribute_name , attribute_value , access_name|
86
- check_element_attribute("css", attribute_name , attribute_value, access_name, true)
87
- end
88
-
89
- # To check attribute value - negative test
90
-
91
- #By ID
92
- Then(/^I should not see attribute "(.*?)" having value "(.*?)" for element having id "(.*?)"$/) do |attribute_name , attribute_value , access_name|
93
- check_element_attribute("id", attribute_name , attribute_value, access_name, false)
94
- end
95
-
96
- #By CLASS
97
- Then(/^I should not see attribute "(.*?)" having value "(.*?)" for element having class "(.*?)"$/) do |attribute_name , attribute_value , access_name|
98
- check_element_attribute("class", attribute_name , attribute_value, access_name, false)
99
- end
100
-
101
- #By NAME
102
- Then(/^I should not see attribute "(.*?)" having value "(.*?)" for element having name "(.*?)"$/) do |attribute_name , attribute_value , access_name|
103
- check_element_attribute("name", attribute_name , attribute_value, access_name, false)
104
- end
105
-
106
- #By XPATH
107
- Then(/^I should not see attribute "(.*?)" having value "(.*?)" for element having xpath "(.*?)"$/) do |attribute_name , attribute_value , access_name|
108
- check_element_attribute("xpath", attribute_name , attribute_value, access_name, false)
109
- end
110
-
111
- #By CSS
112
- Then(/^I should not see attribute "(.*?)" having value "(.*?)" for element having css "(.*?)"$/) do |attribute_name , attribute_value , access_name|
113
- check_element_attribute("css", attribute_name , attribute_value, access_name, false)
114
- end
115
-
116
- #Element enabled checking - Positive test
117
- #By ID
118
- Then(/^element having id "([^\"]*)" should enable$/) do |access_name|
119
- check_element_enable("id", access_name, true)
120
- end
121
-
122
- #By NAME
123
- Then(/^element having name "([^\"]*)" should enable$/) do |access_name|
124
- check_element_enable("name", access_name, true)
125
- end
126
-
127
- #By CLASS
128
- Then(/^element having class "([^\"]*)" should enable$/) do |access_name|
129
- check_element_enable("class", access_name, true)
130
- end
131
-
132
- #By XPATH
133
- Then(/^element having xpath "([^\"]*)" should enable$/) do |access_name|
134
- check_element_enable("xpath", access_name, true)
135
- end
136
-
137
- #By CSS
138
- Then(/^element having css "([^\"]*)" should enable$/) do |access_name|
139
- check_element_enable("css", access_name, true)
140
- end
141
-
142
-
143
- #Element disabled checking - Negative test
144
- #By ID
145
- Then(/^element having id "([^\"]*)" should disable$/) do |access_name|
146
- check_element_enable("id", access_name, false)
147
- end
148
-
149
- #By NAME
150
- Then (/^element having name "([^\"]*)" should disable$/) do |access_name|
151
- check_element_enable("name", access_name, false)
152
- end
153
-
154
- #By CLASS
155
- Then (/^element having class "([^\"]*)" should disable$/) do |access_name|
156
- check_element_enable("class", access_name, false)
157
- end
158
-
159
- #By XPATH
160
- Then (/^element having xpath "([^\"]*)" should disable$/) do |access_name|
161
- check_element_enable("xpath", access_name, false)
162
- end
163
-
164
- #By CSS
165
- Then (/^element having css "([^\"]*)" should disable$/) do |access_name|
166
- check_element_enable("css", access_name, false)
167
- end
168
-
169
- #element presence - positive test
170
- Then(/^I should see element present having id "(.*?)"$/) do |access_name|
171
- check_element_presence("id", access_name, true)
172
- end
173
-
174
- Then(/^I should see element present having name "(.*?)"$/) do |access_name|
175
- check_element_presence("name", access_name, true)
176
- end
177
-
178
- Then(/^I should see element present having class "(.*?)"$/) do |access_name|
179
- check_element_presence("class", access_name, true)
180
- end
181
-
182
- Then(/^I should see element present having xpath "(.*?)"$/) do |access_name|
183
- check_element_presence("xpath", access_name, true)
184
- end
185
-
186
- Then(/^I should see element present having css "(.*?)"$/) do |access_name|
187
- check_element_presence("css", access_name, true)
188
- end
189
-
190
- #element presence - negative test
191
-
192
- Then(/^I should see element not present having id "(.*?)"$/) do |access_name|
193
- check_element_presence("id", access_name, false)
194
- end
195
-
196
- Then(/^I should see element not present having name "(.*?)"$/) do |access_name|
197
- check_element_presence("name", access_name, false)
198
- end
199
-
200
- Then(/^I should see element not present having class "(.*?)"$/) do |access_name|
201
- check_element_presence("class", access_name, false)
202
- end
203
-
204
- Then(/^I should see element not present having xpath "(.*?)"$/) do |access_name|
205
- check_element_presence("xpath", access_name, false)
206
- end
207
-
208
- Then(/^I should see element not present having css "(.*?)"$/) do |access_name|
209
- check_element_presence("css", access_name, false)
210
- end
211
-
212
-
213
- #assert check box is checked
214
- #By ID
215
- Then(/^I should see checkbox having id "(.*?)" checked$/) do |access_name|
216
- is_checkbox_checked("id",access_name)
217
- end
218
-
219
- #By NAME
220
- Then(/^I should see checkbox having name "(.*?)" checked$/) do |access_name|
221
- is_checkbox_checked("name",access_name)
222
- end
223
-
224
- #By CLASS
225
- Then(/^I should see checkbox having class "(.*?)" checked$/) do |access_name|
226
- is_checkbox_checked("class",access_name)
227
- end
228
-
229
- #By XPATH
230
- Then(/^I should see checkbox having xpath "(.*?)" checked$/) do |access_name|
231
- is_checkbox_checked("xpath",access_name)
232
- end
233
-
234
- #By CSS
235
- Then(/^I should see checkbox having css "(.*?)" checked$/) do |access_name|
236
- is_checkbox_checked("css",access_name)
237
- end
238
-
239
- #assert check box is unchecked
240
- #By ID
241
- Then(/^I should see checkbox having id "(.*?)" unchecked$/) do |access_name|
242
- is_checkbox_unchecked("id",access_name)
9
+ #Step to check element text
10
+ Then(/^I should\s*((?:not)?)\s+see text as "(.*?)" for element having (.+) "(.*?)"$/) do |present, value, type, access_name|
11
+ validate_locator type
12
+ check_element_text(type, value, access_name, present.empty?)
243
13
  end
244
14
 
245
- #By NAME
246
- Then(/^I should see checkbox having name "(.*?)" unchecked$/) do |access_name|
247
- is_checkbox_unchecked("name",access_name)
15
+ #Step to check attribute value
16
+ Then(/^I should\s*((?:not)?)\s+see attribute "(.*?)" having value "(.*?)" for element having (.+) "(.*?)"$/) do |present, name , value , type, access_name|
17
+ validate_locator type
18
+ check_element_attribute(type, name, value, access_name, present.empty?)
248
19
  end
249
20
 
250
- #By CLASS
251
- Then(/^I should see checkbox having class "(.*?)" unchecked$/) do |access_name|
252
- is_checkbox_unchecked("class",access_name)
21
+ #Step to check element enabled or not
22
+ Then(/^element having (.+) "([^\"]*)" should\s*((?:not)?)\s+be (enabled|disabled)$/) do |type, access_name, present, state|
23
+ validate_locator type
24
+ flag = state == "enabled"
25
+ flag = !flag unless present.empty?
26
+ check_element_enable(type, access_name, flag)
253
27
  end
254
28
 
255
- #By XPATH
256
- Then(/^I should see checkbox having xpath "(.*?)" unchecked$/) do |access_name|
257
- is_checkbox_unchecked("xpath",access_name)
29
+ #Step to check element present or not
30
+ Then(/^I should\s*((?:not)?)\s+see element present having (.+) "(.*?)"$/) do |present, type, access_name|
31
+ validate_locator type
32
+ check_element_presence(type, access_name, present.empty?)
258
33
  end
259
34
 
260
- #By CSS
261
- Then(/^I should see checkbox having css "(.*?)" unchecked$/) do |access_name|
262
- is_checkbox_unchecked("css",access_name)
35
+ #Step to assert checkbox is checked or unchecked
36
+ Then(/^I should\s*((?:not)?)\s+see checkbox having (.+) "(.*?)" (checked|unchecked)$/) do |present, type, access_name, state|
37
+ validate_locator type
38
+ flag = state == "checked"
39
+ flag = !flag unless present.empty?
40
+ is_checkbox_checked(type, access_name, flag)
263
41
  end
264
42
 
265
- #steps to assert radio button checked
266
- #By ID
267
- Then(/^I should see radio button having id "(.*?)" selected$/) do |access_name|
268
- is_radio_button_selected("id",access_name)
269
- end
270
-
271
- #By NAME
272
- Then(/^I should see radio button having name "(.*?)" selected$/) do |access_name|
273
- is_radio_button_selected("name",access_name)
274
- end
275
-
276
- #By CLASS
277
- Then(/^I should see radio button having class "(.*?)" selected$/) do |access_name|
278
- is_radio_button_selected("class",access_name)
279
- end
280
-
281
- #By XPATH
282
- Then(/^I should see radio button having xpath "(.*?)" selected$/) do |access_name|
283
- is_radio_button_selected("xpath",access_name)
284
- end
285
-
286
- #By CSS
287
- Then(/^I should see radio button having css "(.*?)" selected$/) do |access_name|
288
- is_radio_button_selected("css",access_name)
289
- end
290
-
291
- #steps to assert radio button checked
292
- #By ID
293
- Then(/^I should see radio button having id "(.*?)" not selected$/) do |access_name|
294
- is_radio_button_unselected("id",access_name)
295
- end
296
-
297
- #By NAME
298
- Then(/^I should see radio button having name "(.*?)" not selected$/) do |access_name|
299
- is_radio_button_unselected("name",access_name)
300
- end
301
-
302
- #By CLASS
303
- Then(/^I should see radio button having class "(.*?)" not selected$/) do |access_name|
304
- is_radio_button_unselected("class",access_name)
305
- end
306
-
307
- #By XPATH
308
- Then(/^I should see radio button having xpath "(.*?)" not selected$/) do |access_name|
309
- is_radio_button_unselected("xpath",access_name)
310
- end
311
-
312
- #By CSS
313
- Then(/^I should see radio button having css "(.*?)" not selected$/) do |access_name|
314
- is_radio_button_unselected("css",access_name)
43
+ #steps to assert radio button checked or unchecked
44
+ Then(/^I should\s*((?:not)?)\s+see radio button having (.+) "(.*?)" (selected|unselected)$/) do |present, type, access_name, state|
45
+ validate_locator type
46
+ flag = state == "checked"
47
+ flag = !flag unless present.empty?
48
+ is_radio_button_selected(type, access_name, flag)
315
49
  end
316
50
 
317
51
  #steps to assert option by text from radio button group selected
318
- #By ID
319
- Then(/^I should see "(.*?)" option by text from radio button group having id "(.*?)" selected$/) do |option, access_name|
320
- is_option_from_radio_button_group_selected("id","text",option,access_name)
321
- end
322
-
323
- #By NAME
324
- Then(/^I should see "(.*?)" option by text from radio button group having name "(.*?)" selected$/) do |option, access_name|
325
- is_option_from_radio_button_group_selected("name","text",option,access_name)
326
- end
327
-
328
- #By CLASS
329
- Then(/^I should see "(.*?)" option by text from radio button group having class "(.*?)" selected$/) do |option, access_name|
330
- is_option_from_radio_button_group_selected("class","text",option,access_name)
331
- end
332
-
333
- #By XPATH
334
- Then(/^I should see "(.*?)" option by text from radio button group having xpath "(.*?)" selected$/) do |option, access_name|
335
- is_option_from_radio_button_group_selected("xpath","text",option,access_name)
336
- end
337
-
338
- #By CSS
339
- Then(/^I should see "(.*?)" option by text from radio button group having css "(.*?)" selected$/) do |option, access_name|
340
- is_option_from_radio_button_group_selected("css","text",option,access_name)
341
- end
342
-
343
- #steps to assert option by value from radio button group selected
344
- #By ID
345
- Then(/^I should see "(.*?)" option by value from radio button group having id "(.*?)" selected$/) do |option, access_name|
346
- is_option_from_radio_button_group_selected("id","value",option,access_name)
347
- end
348
-
349
- #By NAME
350
- Then(/^I should see "(.*?)" option by value from radio button group having name "(.*?)" selected$/) do |option, access_name|
351
- is_option_from_radio_button_group_selected("name","value",option,access_name)
352
- end
353
-
354
- #By CLASS
355
- Then(/^I should see "(.*?)" option by value from radio button group having class "(.*?)" selected$/) do |option, access_name|
356
- is_option_from_radio_button_group_selected("class","value",option,access_name)
357
- end
358
-
359
- #By XPATH
360
- Then(/^I should see "(.*?)" option by value from radio button group having xpath "(.*?)" selected$/) do |option, access_name|
361
- is_option_from_radio_button_group_selected("xpath","value",option,access_name)
362
- end
363
-
364
- #By CSS
365
- Then(/^I should see "(.*?)" option by value from radio button group having css "(.*?)" selected$/) do |option, access_name|
366
- is_option_from_radio_button_group_selected("css","value",option,access_name)
367
- end
368
-
369
- #steps to assert option by text from radio button group not selected
370
- #By ID
371
- Then(/^I should see "(.*?)" option by text from radio button group having id "(.*?)" not selected$/) do |option, access_name|
372
- is_option_from_radio_button_group_not_selected("id","text",option,access_name)
373
- end
374
-
375
- #By NAME
376
- Then(/^I should see "(.*?)" option by text from radio button group having name "(.*?)" not selected$/) do |option, access_name|
377
- is_option_from_radio_button_group_not_selected("name","text",option,access_name)
378
- end
379
-
380
- #By CLASS
381
- Then(/^I should see "(.*?)" option by text from radio button group having class "(.*?)" not selected$/) do |option, access_name|
382
- is_option_from_radio_button_group_not_selected("class","text",option,access_name)
383
- end
384
-
385
- #By XPATH
386
- Then(/^I should see "(.*?)" option by text from radio button group having xpath "(.*?)" not selected$/) do |option, access_name|
387
- is_option_from_radio_button_group_not_selected("xpath","text",option,access_name)
388
- end
389
-
390
- #By CSS
391
- Then(/^I should see "(.*?)" option by text from radio button group having css "(.*?)" not selected$/) do |option, access_name|
392
- is_option_from_radio_button_group_not_selected("css","text",option,access_name)
393
- end
394
-
395
- #steps to assert option by value from radio button group not selected
396
- #By ID
397
- Then(/^I should see "(.*?)" option by value from radio button group having id "(.*?)" not selected$/) do |option, access_name|
398
- is_option_from_radio_button_group_not_selected("id","value",option,access_name)
399
- end
400
-
401
- #By NAME
402
- Then(/^I should see "(.*?)" option by value from radio button group having name "(.*?)" not selected$/) do |option, access_name|
403
- is_option_from_radio_button_group_not_selected("name","value",option,access_name)
404
- end
405
-
406
- #By CLASS
407
- Then(/^I should see "(.*?)" option by value from radio button group having class "(.*?)" not selected$/) do |option, access_name|
408
- is_option_from_radio_button_group_not_selected("class","value",option,access_name)
409
- end
410
-
411
- #By XPATH
412
- Then(/^I should see "(.*?)" option by value from radio button group having xpath "(.*?)" not selected$/) do |option, access_name|
413
- is_option_from_radio_button_group_not_selected("xpath","value",option,access_name)
414
- end
415
-
416
- #By CSS
417
- Then(/^I should see "(.*?)" option by value from radio button group having css "(.*?)" not selected$/) do |option, access_name|
418
- is_option_from_radio_button_group_not_selected("css","value",option,access_name)
52
+ Then(/^I should\s*((?:not)?)\s+see "(.*?)" option by (.+) from radio button group having (.+) "(.*?)" (selected|unselected)$/) do |present, option, attr, access_name, type, state|
53
+ validate_locator type
54
+ flag = state == "selected"
55
+ flag = !flag unless present.empty?
56
+ is_option_from_radio_button_group_selected(type, attr, option, access_name, flag)
419
57
  end
420
58
 
421
59
  #steps to check link presence
422
-
423
- Then(/^I should see link present having text "(.*?)"$/) do |access_name|
424
- check_element_presence("link", access_name, true)
60
+ Then(/^I should see link\s*((?:not)?)\s+present having text "(.*?)"$/) do |present,access_name|
61
+ check_element_presence("link", access_name, present.empty?)
425
62
  end
426
63
 
427
- Then(/^I should see link not present having text "(.*?)"$/) do |access_name|
428
- check_element_presence("link", access_name, false)
429
- end
430
64
 
431
- Then(/^I should see link present having partial text "(.*?)"$/) do |access_name|
432
- check_element_presence("partial_link_text", access_name, true)
65
+ Then(/^I should see link\s*((?:not)?)\s+present having partial text "(.*?)"$/) do |present,access_name|
66
+ check_element_presence("partial_link_text", access_name, present.empty?)
433
67
  end
434
68
 
435
- Then(/^I should see link not present having partial text "(.*?)"$/) do |access_name|
436
- check_element_presence("partial_link_text", access_name, false)
437
- end
@@ -1,29 +1,10 @@
1
1
  require_relative 'methods/click_elements_methods'
2
2
 
3
3
  # click on web element
4
- #By ID
5
- When(/^I click on element having id "(.*?)"$/) do |access_name|
6
- click("id",access_name)
7
- end
8
4
 
9
- #By NAME
10
- When(/^I click on element having name "(.*?)"$/) do |access_name|
11
- click("name",access_name)
12
- end
13
-
14
- #By CLASS
15
- When(/^I click on element having class "(.*?)"$/) do |access_name|
16
- click("class",access_name)
17
- end
18
-
19
- #By XPATH
20
- When(/^I click on element having xpath "(.*?)"$/) do |access_name|
21
- click("xpath",access_name)
22
- end
23
-
24
- #By CSS
25
- When(/^I click on element having css "(.*?)"$/) do |access_name|
26
- click("css",access_name)
5
+ When(/^I click on element having (.+) "(.*?)"$/) do |type, access_name|
6
+ validate_locator type
7
+ click("id",access_name)
27
8
  end
28
9
 
29
10
  #steps to click on link