selenium-cucumber 2.1.2 → 2.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06ba324f137c7beac5a434968028ac9c2d841a71
4
- data.tar.gz: c0b17d8c1fc7e82d63a7fd65bf712f6fa3ccb2fc
3
+ metadata.gz: 978f25e7c3331d80be1a8b9ccc83e946f1c2212d
4
+ data.tar.gz: 4bb5ec4c155ee84bd930814d423621f96261b76a
5
5
  SHA512:
6
- metadata.gz: 8057e8b7d347b508832c14a95d9170f4b20446b1333e3e5d5422e2e16e46e15ee2427fa911f2e6001b0827d6f3142c95d5910efbfa87619201fba37374040fe6
7
- data.tar.gz: a42178e44886762fba3784f45d66170cd439705dbc4fc628e626576814ff56369525f12f03a72814a3e513228268660e04b976455fd32dc5f16c738415f57bed
6
+ metadata.gz: 16029a28f22f9185cf235eb1b809bfe816be2f72df8b722ee62dd956b4e985bc1d3eff4216f96908b11841af02f2a0ffcd5d85ed26ccd8e4def4679b5f1ff5d0
7
+ data.tar.gz: f214b40b63ccc0f8c3f553891b926b3e3f5535315e67f8e316aa837697997338ee7dbf8675b9c85ee70068a0f49f929fa2d76ad917dc621c6235c0cc2f82be63
@@ -3,13 +3,14 @@
3
3
  selenium-cucumber comes with the following set of predefined steps.
4
4
  You can add your own steps or change the ones you see here.
5
5
 
6
- * [Navigation Steps](https://github.com/sameer49/selenium-cucumber/blob/master/doc/canned_steps.md#navigation-steps)
7
- * [Assertion Steps](https://github.com/sameer49/selenium-cucumber/blob/master/doc/canned_steps.md#assertion-steps)
8
- * [Input Steps](https://github.com/sameer49/selenium-cucumber/blob/master/doc/canned_steps.md#input-steps)
9
- * [Click Steps](https://github.com/sameer49/selenium-cucumber/blob/master/doc/canned_steps.md#click-steps)
10
- * [Progress Steps](https://github.com/sameer49/selenium-cucumber/blob/master/doc/canned_steps.md#progress-steps)
11
- * [Screenshot Steps](https://github.com/sameer49/selenium-cucumber/blob/master/doc/canned_steps.md#screenshot-steps)
12
- * [Configuration Steps](https://github.com/sameer49/selenium-cucumber/blob/master/doc/canned_steps.md#configuration-steps)
6
+ * [Navigation Steps](https://github.com/selenium-cucumber/selenium-cucumber-ruby/blob/dev/doc/canned_steps.md#navigation-steps)
7
+ * [Assertion Steps](https://github.com/selenium-cucumber/selenium-cucumber-ruby/blob/dev/doc/canned_steps.md#assertion-steps)
8
+ * [Input Steps](https://github.com/selenium-cucumber/selenium-cucumber-ruby/blob/dev/doc/canned_steps.md#input-steps)
9
+ * [Click Steps](https://github.com/selenium-cucumber/selenium-cucumber-ruby/blob/dev/doc/canned_steps.md#click-steps)
10
+ * [Progress Steps](https://github.com/selenium-cucumber/selenium-cucumber-ruby/blob/dev/doc/canned_steps.md#progress-steps)
11
+ * [Screenshot Steps](https://github.com/selenium-cucumber/selenium-cucumber-ruby/blob/dev/doc/canned_steps.md#screenshot-steps)
12
+ * [Configuration Steps](https://github.com/selenium-cucumber/selenium-cucumber-ruby/blob/dev/doc/canned_steps.md#configuration-steps)
13
+ * [Mobile steps](https://github.com/selenium-cucumber/selenium-cucumber-ruby/blob/dev/doc/canned_steps.md#Mobile-steps)
13
14
 
14
15
  ## Navigation Steps
15
16
 
@@ -19,9 +20,19 @@ To open/close URL and to navigate between pages use following steps :
19
20
  Then I navigate forward
20
21
  Then I navigate back
21
22
  Then I refresh page
23
+
24
+ To switch between windows use following steps :
25
+
22
26
  Then I switch to new window
23
- Then I close new window
24
27
  Then I switch to previous window
28
+ Then I switch to window having title "(.*?)"
29
+ Then I close new window
30
+ Then I switch to main window
31
+
32
+ To switch between frames use following steps :
33
+
34
+ Then I switch to frame "(.*?)"
35
+ Then I switch to main content
25
36
 
26
37
  To interact with browser use following steps :
27
38
 
@@ -526,9 +537,10 @@ To print testing configuration use following step :
526
537
 
527
538
  Then I print configuration
528
539
 
529
- #Mobile Steps
540
+ ## Mobile Steps
541
+
530
542
 
531
- ##Tap Steps
543
+ ### Tap Steps
532
544
  -----------
533
545
  To tap on app element use following steps :
534
546
 
@@ -536,4 +548,104 @@ To tap on app element use following steps :
536
548
  Then I tap on element having name "(.*?)"
537
549
  Then I tap on element having class "(.*?)"
538
550
  Then I tap on element having xpath "(.*?)"
539
- Then I tap on element having css "(.*?)"
551
+ Then I tap on element having css "(.*?)"
552
+
553
+ To Tap on back button of device use following step :
554
+
555
+ Then I tap on back button of device
556
+ Then I press back button of device
557
+
558
+ ### Gesture Steps
559
+ ------------
560
+ To perform gesture operations on device
561
+
562
+ ### Swipe steps
563
+ ------------
564
+ To perform swipe using app elements use following steps :
565
+
566
+ Then I swipe from element having id "(.*?)" to element having id "(.*?)"
567
+ Then I swipe from element having id "(.*?)" to element having name "(.*?)"
568
+ Then I swipe from element having id "(.*?)" to element having class "(.*?)"
569
+ Then I swipe from element having id "(.*?)" to element having xpath "(.*?)"
570
+
571
+ Then I swipe from element having name "(.*?)" to element having id "(.*?)"
572
+ Then I swipe from element having name "(.*?)" to element having name "(.*?)"
573
+ Then I swipe from element having name "(.*?)" to element having class "(.*?)"
574
+ Then I swipe from element having name "(.*?)" to element having xpath "(.*?)"
575
+
576
+ Then I swipe from element having class "(.*?)" to element having id "(.*?)"
577
+ Then I swipe from element having class "(.*?)" to element having name "(.*?)"
578
+ Then I swipe from element having class "(.*?)" to element having class "(.*?)"
579
+ Then I swipe from element having class "(.*?)" to element having xpath "(.*?)"
580
+
581
+ Then I swipe from element having xpath "(.*?)" to element having id "(.*?)"
582
+ Then I swipe from element having xpath "(.*?)" to element having name "(.*?)"
583
+ Then I swipe from element having xpath "(.*?)" to element having class "(.*?)"
584
+ Then I swipe from element having xpath "(.*?)" to element having xpath "(.*?)"
585
+
586
+ To perform swipe using co-ordinates
587
+
588
+ Then I swipe from co-ordinates "(.*?)","(.*?)" to co-ordinates "(.*?)","(.*?)"
589
+
590
+ To perform swipe using direction
591
+
592
+ Then I swipe right
593
+ Then I swipe left
594
+ Then I swipe up
595
+ Then I swipe down
596
+
597
+ To perform swipe using app element with direction use following steps :
598
+
599
+ Then I swipe element having id "(.*?)" to right
600
+ Then I swipe element having name "(.*?)" to right
601
+ Then I swipe element having class "(.*?)" to right
602
+ Then I swipe element having xpath "(.*?)" to right
603
+
604
+ Then I swipe element having id "(.*?)" to left
605
+ Then I swipe element having name "(.*?)" to left
606
+ Then I swipe element having class "(.*?)" to left
607
+ Then I swipe element having xpath "(.*?)" to left
608
+
609
+ Then I swipe element having id "(.*?)" to up
610
+ Then I swipe element having name "(.*?)" to up
611
+ Then I swipe element having class "(.*?)" to up
612
+ Then I swipe element having xpath "(.*?)" to up
613
+
614
+ Then I swipe element having id "(.*?)" to down
615
+ Then I swipe element having name "(.*?)" to down
616
+ Then I swipe element having class "(.*?)" to down
617
+ Then I swipe element having xpath "(.*?)" to down
618
+
619
+ To perform swipe using co-ordinates with direction use following steps :
620
+ Then I swipe co-ordinates "(.*?)","(.*?)" to left
621
+ Then I swipe co-ordinates "(.*?)","(.*?)" to right
622
+ Then I swipe co-ordinates "(.*?)","(.*?)" to up
623
+ Then I swipe co-ordinates "(.*?)","(.*?)" to down
624
+
625
+
626
+ ### long tap steps
627
+ ------------
628
+ To perform long tap with default duration of 2 seconds on app elements use following steps :
629
+
630
+ Then I long tap on element having id "(.*?)"
631
+ Then I long tap on element having name "(.*?)"
632
+ Then I long tap on element having class "(.*?)"
633
+ Then I long tap on element having xpath "(.*?)"
634
+
635
+ To perform long tap with customized duration of seconds on app elements use following steps :
636
+
637
+ Then I long tap on element having id "(.*?)" for "(.*?)" sec
638
+ Then I long tap on element having name "(.*?)" for "(.*?)" sec
639
+ Then I long tap on element having class "(.*?)" for "(.*?)" sec
640
+ Then I long tap on element having xpath "(.*?)" for "(.*?)" sec
641
+
642
+ To perform long tap with default duration of 2 seconds using co-ordinates use following step :
643
+
644
+ Then I long tap on co\-ordinate "(.*?)","(.*?)
645
+
646
+ To perform long tap with customized duration of seconds using co-ordinates use following step :
647
+
648
+ Then I long tap on co\-ordinate "(.*?)","(.*?)" for "(.*?)" sec
649
+
650
+ ### Close app step
651
+ Then I close app
@@ -31,7 +31,6 @@ When(/^I tap on element having (.+) "(.*?)"$/) do |type, access_name|
31
31
  click(type, access_name)
32
32
  end
33
33
 
34
- Then(/^I long press on element having (.+) "(.*?)"$/) do |type, access_name|
35
- validate_locator type
36
- long_press(type, access_name, duration)
37
- end
34
+
35
+
36
+
@@ -18,10 +18,6 @@ def submit(access_type, access_name)
18
18
  WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.submit
19
19
  end
20
20
 
21
- def long_press(type, access_name, duration)
22
- element = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }
23
- parameters = { "element" => "#{element}", "duration" => "#{duration}" }
24
- args = parameters.select { |k, v| [:element, :duration].include? k }
25
- args = args_with_ele_ref(args)
26
- chain_method(:longPress, args)
27
- end
21
+
22
+
23
+
@@ -0,0 +1,242 @@
1
+ require_relative 'required_files'
2
+
3
+ def swipe_using_elements(access_type1, access_name1, access_type2, access_name2)
4
+
5
+ # to get start x,y co-ordinates
6
+ ele_from = WAIT.until { $driver.find_element(:"#{access_type1}" => "#{access_name1}") }.location
7
+ start_x = ele_from.x
8
+ start_y = ele_from.y
9
+
10
+ # to get end x,y co-ordinates
11
+ ele_to = WAIT.until { $driver.find_element(:"#{access_type2}" => "#{access_name2}") }.location
12
+ end_x = ele_to.x
13
+ end_y = ele_to.y
14
+
15
+ swipe(start_x, start_y, end_x, end_y)
16
+ end
17
+
18
+ def swipe(start_x, start_y, end_x, end_y)
19
+ action = Appium::TouchAction.new.press(x: "#{start_x}", y: "#{start_y}").wait(1000).move_to(x: "#{end_x}", y: "#{end_y}").release()
20
+ action.perform
21
+ end
22
+
23
+ def swipe_direction(direction)
24
+ size = $driver.manage.window.size
25
+ height = size.height.to_i - 10
26
+ width = size.width.to_i - 10
27
+
28
+ if direction == 'right'
29
+ start_x = (width/100) * 15 # 83
30
+ start_y = height/2 # 695
31
+ end_x = (width/100) * 90 # 900
32
+ end_y = height/2 # 630
33
+ elsif direction == 'left'
34
+ start_x = (width/100) * 90
35
+ start_y = height/2
36
+ end_x = (width/100) * 15
37
+ end_y = height/2
38
+ elsif direction == 'up'
39
+ start_x = width/2
40
+ start_y = (height/100) * 90
41
+ end_x = width/2
42
+ end_y = (height/100) * 15
43
+ elsif direction == 'down'
44
+ start_x = width/2
45
+ start_y = (height/100) * 15
46
+ end_x = width/2
47
+ end_y = (height/100) * 90
48
+ else
49
+ raise "invalid direction"
50
+ end
51
+
52
+ swipe(start_x, start_y, end_x, end_y)
53
+ end
54
+
55
+ def swipe_element_with_direction(access_type, access_name, direction)
56
+ ele_from = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.location
57
+ x_start = ele_from.x
58
+ y_start = ele_from.y
59
+
60
+ ele_size = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }
61
+ ele_height = ele_size.size.height.to_i
62
+ ele_width = ele_size.size.width.to_i
63
+ #puts ele_size.width
64
+
65
+ x_end = x_start + ele_width
66
+ y_end = y_start + ele_height
67
+
68
+ puts "[#{x_start},#{y_start}],[#{x_end},#{y_end}]"
69
+
70
+ puts "ele_height : #{ele_height}" # 1776
71
+ puts "ele_width :#{ele_width}" #
72
+
73
+ size = $driver.manage.window.size
74
+ height = size.height.to_i - 5
75
+ puts "height : #{height}" # 1776
76
+ width = size.width.to_i - 5
77
+ puts "width :#{width}" #
78
+
79
+ if direction == 'right'
80
+ start_x = x_start + (ele_width*0.25)
81
+ start_y = (y_start) + (ele_height/2)
82
+ end_x = width # 900
83
+ end_y = (y_start) + (ele_height/2)
84
+ elsif direction == 'left'
85
+ start_x = x_end - 5
86
+ start_y = (y_end) - (ele_height/2)
87
+ end_x = 10
88
+ end_y = (y_end) - (ele_height/2)
89
+ elsif direction == 'up'
90
+ if ele_height > height
91
+ ele_height = height
92
+ end
93
+
94
+ if y_end > height
95
+ y_end = y_start + ele_height
96
+ end
97
+
98
+ puts "ele_height: #{ele_height}"
99
+ puts "ele_height*).75: #{ele_height*0.75}"
100
+ puts y_end
101
+ start_x = x_end - (ele_width/2)
102
+
103
+ start_y = (y_end) - (ele_height*0.75)
104
+
105
+ if start_y < 0
106
+ y_start = 0
107
+ y_end = y_start + ele_height
108
+ start_y = (y_end) - (ele_height*0.75)
109
+ # puts y_end
110
+ # puts "y_start: #{y_start}"
111
+ # puts "ele_height: #{ele_height}"
112
+ # puts "ele_height*0.75: #{ele_height*0.75}"
113
+ end
114
+
115
+ end_x = (x_end/2)
116
+ end_y = 10
117
+ elsif direction == 'down'
118
+ start_x = x_start + (ele_width/2)
119
+ if ele_height > height
120
+ ele_height = height
121
+ end
122
+ start_y = (y_start) + (ele_height*0.25)
123
+ if start_y < 0
124
+ y_start = 0
125
+ if ele_height > height
126
+ ele_height = height
127
+ end
128
+ start_y = (y_start) + (ele_height*0.25)
129
+ # puts y_end
130
+ # puts "y_start: #{y_start}"
131
+ puts "ele_height: #{ele_height}"
132
+ puts "ele_height*0.25: #{ele_height*0.25}"
133
+ end
134
+ end_x = x_start + (ele_width/2)
135
+ if ele_height > height
136
+ ele_height = height
137
+ end
138
+ end_y = ele_height
139
+ else
140
+ raise "invalid direction"
141
+ end
142
+
143
+ puts "start_x: #{start_x}, start_y: #{start_y}"
144
+ puts "end_x: #{end_x}, end_y: #{end_y}"
145
+
146
+ swipe(start_x, start_y, end_x, end_y)
147
+ end
148
+
149
+ def swipe_coordinates_with_direction(start_x, start_y, direction)
150
+
151
+ # ele_from = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.size
152
+ # height = size.height.to_i - 5
153
+ # puts "height : #{height}" # 1776
154
+ # width = size.width.to_i - 5
155
+ # puts "width :#{width}" #
156
+
157
+ size = $driver.manage.window.size
158
+ height = size.height.to_i - 5
159
+ puts "height : #{height}"
160
+ width = size.width.to_i - 5
161
+ puts "width :#{width}"
162
+
163
+ if direction == 'right'
164
+ start_x = start_x
165
+ start_y = start_y
166
+ end_x = width
167
+ end_y = start_y
168
+ elsif direction == 'left'
169
+ start_x = start_x
170
+ start_y = start_y
171
+ end_x = 10
172
+ end_y = start_y
173
+ elsif direction == 'up'
174
+ start_x = start_x
175
+ start_y = start_y
176
+ end_x = start_x
177
+ end_y = 10
178
+ elsif direction == 'down'
179
+ start_x = start_x
180
+ start_y = start_y
181
+ end_x = start_x
182
+ end_y = height
183
+ else
184
+ raise "invalid direction"
185
+ end
186
+
187
+ swipe(start_x, start_y, end_x, end_y)
188
+ end
189
+
190
+
191
+ def long_press_on_element_default_duration(access_type, access_name)
192
+ begin
193
+ ele_from = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.location
194
+ x = ele_from.x
195
+ y = ele_from.y
196
+
197
+ action = Appium::TouchAction.new.press(x: "#{x}", y: "#{y}").wait(2000).move_to(x: "#{x}", y: "#{y}").release()
198
+ action.perform
199
+ rescue Exception => e
200
+ if e.to_s == 'The swipe did not complete successfully'
201
+ print ""
202
+ else
203
+ raise e
204
+ end
205
+ end
206
+ end
207
+
208
+ def long_press_on_element_with_duration(access_type, access_name, duration)
209
+ begin
210
+ ele_from = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.location
211
+ x = ele_from.x
212
+ y = ele_from.y
213
+
214
+ duration = duration.to_i
215
+ duration = duration * 1000
216
+ action = Appium::TouchAction.new.press(x: "#{x}", y: "#{y}").wait("#{duration}").move_to(x: "#{x}", y: "#{y}").release()
217
+ action.perform
218
+ rescue Exception => e
219
+ if e.to_s == 'The swipe did not complete successfully'
220
+ print ""
221
+ else
222
+ raise e
223
+ end
224
+ end
225
+ end
226
+
227
+ def long_press_on_coordinates(x, y)
228
+ action = Appium::TouchAction.new.press(x: "#{x}", y: "#{y}").wait(2000).move_to(x: "#{x}", y: "#{y}").release()
229
+ action.perform
230
+ end
231
+
232
+ def long_press_on_coordinates_with_duration(x, y, duration)
233
+ duration = duration.to_i
234
+ duration = duration * 1000
235
+ puts duration
236
+ action = Appium::TouchAction.new.press(x: "#{x}", y: "#{y}").wait("#{duration}").move_to(x: "#{x}", y: "#{y}").release()
237
+ action.perform
238
+ end
239
+
240
+ def close_app
241
+ $driver.close_app
242
+ end
@@ -19,7 +19,7 @@ def close_driver
19
19
  $driver.quit
20
20
  end
21
21
 
22
- # method to return key by os wise
22
+ # method to return key (control/command) by os wise
23
23
  def get_key
24
24
  os = Selenium::WebDriver::Platform.os
25
25
  if os.to_s == 'windows'
@@ -31,18 +31,40 @@ def get_key
31
31
  end
32
32
  end
33
33
 
34
- # Method to zoom in/out page
35
- def zoom_in_out(in_out)
36
- $driver.action.key_down(:"#{get_key}").send_keys(:"#{in_out}").key_up(:"#{get_key}").perform
34
+ # Method to zoom in/out/reset page
35
+ def zoom_in_out(operation)
36
+ if $driver.capabilities.browser_name == 'chrome'
37
+ actual_zoom = $driver.execute_script "return document.body.style.zoom"
38
+ puts "actual_zoom:#{actual_zoom}"
39
+ if actual_zoom == '' or actual_zoom == nil
40
+ actual_zoom = 100
41
+ else
42
+ actual_zoom = actual_zoom.delete '%'
43
+ actual_zoom = actual_zoom.to_i
44
+ end
45
+
46
+ if operation == 'add'
47
+ actual_zoom += 15 unless actual_zoom >= 500
48
+ elsif operation == 'subtract'
49
+ actual_zoom -= 15 unless actual_zoom <= 25
50
+ else
51
+ actual_zoom = 100
52
+ end
53
+ puts "actual_zoom:#{actual_zoom}"
54
+ $driver.execute_script "document.body.style.zoom='#{actual_zoom}%'"
55
+ else
56
+ html = $driver.find_element(:tag_name => "body")
57
+ $driver.action.send_keys(html, :"#{get_key}", :"#{operation}" ).perform
58
+ end
37
59
  end
38
60
 
39
61
  # Method to zoom in/out web page until web element displyas
40
- def zoom_in_out_till_element_display(access_type, in_out, access_name)
62
+ def zoom_in_out_till_element_display(access_type, operation, access_name)
41
63
  while true
42
64
  if WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.displayed?
43
65
  break
44
66
  else
45
- $driver.action.key_down(:"#{get_key}").send_keys(:"#{in_out}").key_up(:"#{get_key}").perform
67
+ zoom_in_out(operation)
46
68
  end
47
69
  end
48
70
  end
@@ -80,19 +102,35 @@ def scroll_page(to)
80
102
  end
81
103
  end
82
104
 
83
- $old_win = nil
105
+ # Method to switch to old window
106
+ def switch_to_previous_window
107
+ $driver.switch_to.window $previous_window
108
+ end
84
109
 
85
110
  # Method to switch to new window
86
-
87
111
  def switch_to_new_window
88
- $old_win = $driver.window_handle
89
- $driver.switch_to.window($driver.window_handles[1])
112
+ $previous_window = $driver.window_handle
113
+ $driver.switch_to.window($driver.window_handles.last)
90
114
  end
91
115
 
116
+ # Method to switch to main window
117
+ def switch_to_main_window
118
+ $previous_window = $driver.window_handle
119
+ $driver.switch_to.window($driver.window_handles.first)
120
+ end
92
121
 
93
- # Method to switch to old window
94
- def switch_to_old_window
95
- $driver.switch_to.window($old_win)
122
+ # Method to switch to window by title
123
+ def switch_to_window_by_title window_title
124
+ $previous_window = $driver.window_handle
125
+ window_found = false
126
+ $driver.window_handles.each{ |handle|
127
+ $driver.switch_to.window handle
128
+ if $driver.title == window_title
129
+ window_found = true
130
+ break
131
+ end
132
+ }
133
+ raise "Window having title \"#{window_title}\" not found" if not window_found
96
134
  end
97
135
 
98
136
  # Method to close new window
@@ -100,6 +138,16 @@ def close_new_window
100
138
  $driver.close
101
139
  end
102
140
 
141
+ # method to switch frame
142
+ def switch_frame frame
143
+ $driver.switch_to.frame(frame)
144
+ end
145
+
146
+ # method to switch to main window
147
+ def switch_to_main_content
148
+ $driver.switch_to.default_content
149
+ end
150
+
103
151
  =begin
104
152
  def switch_to_new_window
105
153
  win_handles = $driver.window_handles
@@ -0,0 +1,100 @@
1
+ require_relative 'methods/mobile_methods'
2
+ require_relative 'methods/navigate_methods'
3
+
4
+ #---------- swipe with elements
5
+ Then(/^I swipe from element having (.+) "(.*?)" to element having (.+) "(.*?)"$/) do |type1,access_name1,type2,access_name2|
6
+ validate_locator type1
7
+ validate_locator type2
8
+ swipe_using_elements(type1,access_name1,type2,access_name2)
9
+ end
10
+
11
+ #---------- swipe with co-ordinates
12
+ Then(/^I swipe from co\-ordinates "(.*?)","(.*?)" to co\-ordinates "(.*?)","(.*?)"$/) do |start_x, start_y, end_x, end_y|
13
+ swipe(start_x, start_y, end_x, end_y)
14
+ end
15
+
16
+ #---------- Swipe with direction
17
+ Then(/^I swipe left$/) do
18
+ swipe_direction("left")
19
+ end
20
+
21
+ Then(/^I swipe right$/) do
22
+ swipe_direction("right")
23
+ end
24
+
25
+ Then(/^I swipe up$/) do
26
+ swipe_direction("up")
27
+ end
28
+
29
+ Then(/^I swipe down$/) do
30
+ swipe_direction("down")
31
+ end
32
+
33
+ #----------- Swipe element with direction
34
+ Then(/^I swipe element having (.+) "(.*?)" to right$/) do |type, access_name|
35
+ validate_locator type
36
+ swipe_element_with_direction(type, access_name, "right")
37
+ end
38
+
39
+ Then(/^I swipe element having (.+) "(.*?)" to left$/) do |type, access_name|
40
+ swipe_element_with_direction(type, access_name, "left")
41
+ end
42
+
43
+ Then(/^I swipe element having (.+) "(.*?)" to up$/) do |type, access_name|
44
+ swipe_element_with_direction(type, access_name, "up")
45
+ end
46
+
47
+ Then(/^I swipe element having (.+) "(.*?)" to down$/) do |type, access_name|
48
+ swipe_element_with_direction(type, access_name, "down")
49
+ end
50
+
51
+ #swipe co-ordinates with direction
52
+
53
+ Then(/^I swipe co\-ordinates "(.*?)","(.*?)" to left$/) do |start_x, start_y|
54
+ swipe_coordinates_with_direction(start_x, start_y, "left")
55
+ end
56
+
57
+
58
+ Then(/^I swipe co\-ordinates "(.*?)","(.*?)" to right$/) do |start_x, start_y|
59
+ swipe_coordinates_with_direction(start_x, start_y, "right")
60
+ end
61
+
62
+
63
+ Then(/^I swipe co\-ordinates "(.*?)","(.*?)" to up$/) do |start_x, start_y|
64
+ swipe_coordinates_with_direction(start_x, start_y, "up")
65
+ end
66
+
67
+
68
+ Then(/^I swipe co\-ordinates "(.*?)","(.*?)" to down$/) do |start_x, start_y|
69
+ swipe_coordinates_with_direction(start_x, start_y, "down")
70
+ end
71
+
72
+ Then(/^I long tap on element having (.+) "(.*?)"$/) do |type, access_name|
73
+ validate_locator type
74
+ long_press_on_element_default_duration(type, access_name)
75
+ end
76
+
77
+ Then(/^I long tap on element having (.+) "(.*?)" for "(.*?)" sec$/) do |type, access_name, duration|
78
+ validate_locator type
79
+ long_press_on_element_with_duration(type, access_name, duration)
80
+ end
81
+
82
+ Then(/^I long tap on co\-ordinate "(.*?)","(.*?)"$/) do |x, y|
83
+ long_press_on_coordinates(x, y)
84
+ end
85
+
86
+ Then(/^I long tap on co\-ordinate "(.*?)","(.*?)" for "(.*?)" sec$/) do |x, y, duration|
87
+ long_press_on_coordinates_with_duration(x, y, duration)
88
+ end
89
+
90
+ Then(/^I close app$/) do
91
+ close_app
92
+ end
93
+
94
+ Then(/^I tap on back button of device$/) do
95
+ navigate('back')
96
+ end
97
+
98
+ Then(/^I press back button of device$/) do
99
+ navigate('back')
100
+ end
@@ -26,23 +26,45 @@ Then(/^I maximize browser window$/) do
26
26
  maximize_browser
27
27
  end
28
28
 
29
- # steps to refresh page
29
+ # step to refresh page
30
30
  Then(/^I refresh page$/) do
31
31
  $driver.navigate.refresh
32
32
  end
33
33
 
34
+ # step to switch to new window
34
35
  Then(/^I switch to new window$/) do
35
36
  switch_to_new_window
36
37
  end
37
38
 
39
+ # step to switch to previous window
38
40
  Then(/^I switch to previous window$/) do
39
- switch_to_old_window
41
+ switch_to_previous_window
40
42
  end
41
43
 
44
+ # step to switch to main window
45
+ Then(/^I switch to main window$/) do
46
+ switch_to_main_window
47
+ end
48
+
49
+ Then(/^I switch to window having title "(.*?)"$/) do |window_title|
50
+ switch_to_window_by_title window_title
51
+ end
52
+
53
+ # step to close new window
42
54
  Then(/^I close new window$/) do
43
55
  close_new_window
44
56
  end
45
57
 
58
+ # step to switch to main content
59
+ Then(/^I switch to main content$/) do
60
+ switch_to_main_content
61
+ end
62
+
63
+ # step to switch to frame
64
+ Then(/^I switch to frame "(.*?)"$/) do |frame|
65
+ switch_frame frame
66
+ end
67
+
46
68
  # steps to scroll to element
47
69
  Then(/^I scroll to element having (.+) "(.*?)"$/) do |type, access_name|
48
70
  validate_locator type
@@ -70,12 +92,14 @@ Then(/^I zoom out page$/) do
70
92
  zoom_in_out('subtract')
71
93
  end
72
94
 
95
+ # method to reset page view
96
+ Then(/^I reset page view$/) do
97
+ zoom_in_out('numpad0')
98
+ end
99
+
73
100
  # steps to zoom out till element displays
74
101
  Then(/^I zoom out page till I see element having (.+) "(.*?)"$/) do |type, access_name|
75
102
  validate_locator type
76
103
  zoom_in_out_till_element_display(type, 'subtract', access_name)
77
104
  end
78
105
 
79
- Then(/^I reset page view$/) do
80
- zoom_in_out('numpad0')
81
- end
@@ -1,5 +1,5 @@
1
1
  module Selenium
2
2
  module Cucumber
3
- VERSION = '2.1.2'
3
+ VERSION = '2.1.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sameer Sawant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-02 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: 2.0.0
20
20
  - - '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 1.3.18
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '1.3'
29
+ version: 2.0.0
30
30
  - - '>='
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.3.18
@@ -36,7 +36,7 @@ dependencies:
36
36
  requirements:
37
37
  - - ~>
38
38
  - !ruby/object:Gem::Version
39
- version: 2.44.0
39
+ version: 2.45.0
40
40
  - - '>='
41
41
  - !ruby/object:Gem::Version
42
42
  version: 2.41.0
@@ -46,7 +46,7 @@ dependencies:
46
46
  requirements:
47
47
  - - ~>
48
48
  - !ruby/object:Gem::Version
49
- version: 2.44.0
49
+ version: 2.45.0
50
50
  - - '>='
51
51
  - !ruby/object:Gem::Version
52
52
  version: 2.41.0
@@ -126,10 +126,12 @@ files:
126
126
  - lib/selenium-cucumber/methods/input_methods.rb
127
127
  - lib/selenium-cucumber/methods/javascript_handling_methods.rb
128
128
  - lib/selenium-cucumber/methods/misc_methods.rb
129
+ - lib/selenium-cucumber/methods/mobile_methods.rb
129
130
  - lib/selenium-cucumber/methods/navigate_methods.rb
130
131
  - lib/selenium-cucumber/methods/progress_methods.rb
131
132
  - lib/selenium-cucumber/methods/required_files.rb
132
133
  - lib/selenium-cucumber/methods/screenshot_methods.rb
134
+ - lib/selenium-cucumber/mobile_steps.rb
133
135
  - lib/selenium-cucumber/navigation_steps.rb
134
136
  - lib/selenium-cucumber/progress_steps.rb
135
137
  - lib/selenium-cucumber/screenshot_steps.rb
@@ -154,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
156
  version: '0'
155
157
  requirements: []
156
158
  rubyforge_project:
157
- rubygems_version: 2.4.5
159
+ rubygems_version: 2.4.6
158
160
  signing_key:
159
161
  specification_version: 4
160
162
  summary: SELENIUM WEBDRIVER WITH RUBY & CUCUMBER