selenium-cucumber 2.1.4 → 3.1.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 (88) hide show
  1. checksums.yaml +4 -4
  2. data/bin/generate.rb +19 -20
  3. data/bin/helper.rb +50 -50
  4. data/bin/selenium-cucumber +29 -30
  5. data/doc/canned_steps.md +656 -656
  6. data/doc/installation.md +16 -16
  7. data/doc/selenium-cucumber-API.md +120 -120
  8. data/doc/selenium-cucumber-help.md +18 -18
  9. data/features-skeleton/my_first.feature +5 -5
  10. data/features-skeleton/step_definitions/custom_steps.rb +4 -4
  11. data/features-skeleton/support/env.rb +51 -51
  12. data/features-skeleton/support/hooks.rb +47 -38
  13. data/lib/selenium-cucumber.rb +1 -1
  14. data/lib/selenium-cucumber/assertion_steps.rb +89 -89
  15. data/lib/selenium-cucumber/click_elements_steps.rb +36 -36
  16. data/lib/selenium-cucumber/configuration_steps.rb +6 -6
  17. data/lib/selenium-cucumber/input_steps.rb +69 -69
  18. data/lib/selenium-cucumber/javascript_handling_steps.rb +9 -9
  19. data/lib/selenium-cucumber/methods/assertion_methods.rb +295 -344
  20. data/lib/selenium-cucumber/methods/click_elements_methods.rb +23 -23
  21. data/lib/selenium-cucumber/methods/configuration_methods.rb +35 -35
  22. data/lib/selenium-cucumber/methods/error_handling_methods.rb +86 -86
  23. data/lib/selenium-cucumber/methods/input_methods.rb +67 -67
  24. data/lib/selenium-cucumber/methods/javascript_handling_methods.rb +9 -9
  25. data/lib/selenium-cucumber/methods/misc_methods.rb +34 -34
  26. data/lib/selenium-cucumber/methods/mobile_methods.rb +241 -241
  27. data/lib/selenium-cucumber/methods/navigate_methods.rb +165 -165
  28. data/lib/selenium-cucumber/methods/progress_methods.rb +15 -15
  29. data/lib/selenium-cucumber/methods/required_files.rb +10 -10
  30. data/lib/selenium-cucumber/methods/screenshot_methods.rb +6 -6
  31. data/lib/selenium-cucumber/mobile_steps.rb +99 -99
  32. data/lib/selenium-cucumber/navigation_steps.rb +105 -105
  33. data/lib/selenium-cucumber/progress_steps.rb +18 -18
  34. data/lib/selenium-cucumber/screenshot_steps.rb +5 -5
  35. data/lib/selenium-cucumber/version.rb +5 -5
  36. metadata +69 -91
  37. data/example/android/android_app/HinduCalendar.zip +0 -0
  38. data/example/android/android_app/HinduCalendar/HinduCalendar.apk +0 -0
  39. data/example/android/android_app/HinduCalendar/README.md +0 -19
  40. data/example/android/android_app/HinduCalendar/Results.html +0 -472
  41. data/example/android/android_app/HinduCalendar/features/01_HC_homepage_menu_validation.feature +0 -36
  42. data/example/android/android_app/HinduCalendar/features/02_HC_homepage_menu_navigation.feature +0 -71
  43. data/example/android/android_app/HinduCalendar/features/03_HC_Create_Save_View_Delete_Kundali.feature +0 -63
  44. data/example/android/android_app/HinduCalendar/features/actual_images/test.png +0 -0
  45. data/example/android/android_app/HinduCalendar/features/expected_images/test.png +0 -0
  46. data/example/android/android_app/HinduCalendar/features/image_difference/test.png +0 -0
  47. data/example/android/android_app/HinduCalendar/features/my_first.feature +0 -1
  48. data/example/android/android_app/HinduCalendar/features/screenshots/test.png +0 -0
  49. data/example/android/android_app/HinduCalendar/features/step_definitions/01_HC_homepage_menu_validation.rb +0 -81
  50. data/example/android/android_app/HinduCalendar/features/step_definitions/02_HC_homepage_menu_navigation.rb +0 -132
  51. data/example/android/android_app/HinduCalendar/features/step_definitions/03_HC_Create_Save_View_Delete_Kundali.rb +0 -413
  52. data/example/android/android_app/HinduCalendar/features/step_definitions/custom_steps.rb +0 -5
  53. data/example/android/android_app/HinduCalendar/features/support/env.rb +0 -51
  54. data/example/android/android_app/HinduCalendar/features/support/hooks.rb +0 -38
  55. data/example/android/android_app/android_app_calculator.zip +0 -0
  56. data/example/android/android_app/android_app_calculator/AndroidCalculator.apk +0 -0
  57. data/example/android/android_app/android_app_calculator/features/actual_images/test.png +0 -0
  58. data/example/android/android_app/android_app_calculator/features/calculator.feature +0 -36
  59. data/example/android/android_app/android_app_calculator/features/expected_images/test.png +0 -0
  60. data/example/android/android_app/android_app_calculator/features/image_difference/test.png +0 -0
  61. data/example/android/android_app/android_app_calculator/features/my_first.feature +0 -13
  62. data/example/android/android_app/android_app_calculator/features/screenshots/test.png +0 -0
  63. data/example/android/android_app/android_app_calculator/features/step_definitions/custom_steps.rb +0 -5
  64. data/example/android/android_app/android_app_calculator/features/support/env.rb +0 -51
  65. data/example/android/android_app/android_app_calculator/features/support/hooks.rb +0 -38
  66. data/example/android/android_web/android_web_gmail_login.zip +0 -0
  67. data/example/android/android_web/android_web_gmail_login/features/actual_images/test.png +0 -0
  68. data/example/android/android_web/android_web_gmail_login/features/expected_images/test.png +0 -0
  69. data/example/android/android_web/android_web_gmail_login/features/gmail_login.feature +0 -12
  70. data/example/android/android_web/android_web_gmail_login/features/image_difference/test.png +0 -0
  71. data/example/android/android_web/android_web_gmail_login/features/my_first.feature +0 -1
  72. data/example/android/android_web/android_web_gmail_login/features/screenshots/test.png +0 -0
  73. data/example/android/android_web/android_web_gmail_login/features/step_definitions/custom_steps.rb +0 -5
  74. data/example/android/android_web/android_web_gmail_login/features/support/env.rb +0 -51
  75. data/example/android/android_web/android_web_gmail_login/features/support/hooks.rb +0 -38
  76. data/example/desktop web/desktop_web_gmail_login.zip +0 -0
  77. data/example/desktop web/desktop_web_gmail_login/features/actual_images/test.png +0 -0
  78. data/example/desktop web/desktop_web_gmail_login/features/expected_images/test.png +0 -0
  79. data/example/desktop web/desktop_web_gmail_login/features/gmail_login.feature +0 -10
  80. data/example/desktop web/desktop_web_gmail_login/features/gmail_multi_login.feature +0 -22
  81. data/example/desktop web/desktop_web_gmail_login/features/image_difference/test.png +0 -0
  82. data/example/desktop web/desktop_web_gmail_login/features/my_first.feature +0 -1
  83. data/example/desktop web/desktop_web_gmail_login/features/result.html b/data/example/desktop → web/desktop_web_gmail_login/features/result.html +0 -0
  84. data/example/desktop web/desktop_web_gmail_login/features/screenshots/test.png +0 -0
  85. data/example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb +0 -5
  86. data/example/desktop web/desktop_web_gmail_login/features/support/env.rb +0 -51
  87. data/example/desktop web/desktop_web_gmail_login/features/support/hooks.rb +0 -38
  88. data/example/desktop web/desktop_web_gmail_login/result.html +0 -478
@@ -1,23 +1,23 @@
1
- require_relative 'required_files'
2
-
3
-
4
- def click(access_type, access_name)
5
- WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.click
6
- end
7
-
8
- def click_forcefully(access_type, access_name)
9
- $driver.execute_script('arguments[0].click();', WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") })
10
- end
11
-
12
- def double_click(access_type, access_value)
13
- element = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_value}") }
14
- $driver.action.double_click(element).perform
15
- end
16
-
17
- def submit(access_type, access_name)
18
- WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.submit
19
- end
20
-
21
-
22
-
23
-
1
+ require_relative 'required_files'
2
+
3
+
4
+ def click(access_type, access_name)
5
+ $driver.find_element(:"#{access_type}" => "#{access_name}").click
6
+ end
7
+
8
+ def click_forcefully(access_type, access_name)
9
+ $driver.execute_script('arguments[0].click();', $driver.find_element(:"#{access_type}" => "#{access_name}"))
10
+ end
11
+
12
+ def double_click(access_type, access_value)
13
+ element = $driver.find_element(:"#{access_type}" => "#{access_value}")
14
+ $driver.action.double_click(element).perform
15
+ end
16
+
17
+ def submit(access_type, access_name)
18
+ $driver.find_element(:"#{access_type}" => "#{access_name}").submit
19
+ end
20
+
21
+
22
+
23
+
@@ -1,35 +1,35 @@
1
- require_relative 'required_files'
2
-
3
- # method to print configuration
4
- def print_congifugartion
5
- puts ''
6
- puts "Date : #{Time.now.strftime("%d-%B-%Y")}"
7
- puts "Time : #{Time.now.strftime("%I:%M:%S:%p")}"
8
-
9
- if $platform == 'android' or $platform == 'ios'
10
- print_mobile_configuration
11
- else
12
- print_desktop_configuration
13
- end
14
- end
15
-
16
- # method to print desktop configuration
17
- def print_desktop_configuration
18
- puts 'Platform : ' + $driver.capabilities.platform.to_s.upcase
19
- puts 'Browser : ' + $driver.capabilities.browser_name.to_s.upcase + " " + $driver.capabilities.version.to_s
20
- puts ''
21
- end
22
-
23
- # method to print mobile configuration
24
- def print_mobile_configuration
25
- puts "Platform : #{$platform.upcase}"
26
- puts "OS version : #{$os_version}"
27
- puts "Device : #{$device_name}"
28
-
29
- if $app_path.nil?
30
- puts 'Browser : ' + $driver.capabilities.browser_name.to_s.upcase + " " + $driver.capabilities.version.to_s
31
- else
32
- puts "App Tested : #{$app_path}"
33
- end
34
- puts ''
35
- end
1
+ require_relative 'required_files'
2
+
3
+ # method to print configuration
4
+ def print_congifugartion
5
+ puts ''
6
+ puts "Date : #{Time.now.strftime("%d-%B-%Y")}"
7
+ puts "Time : #{Time.now.strftime("%I:%M:%S:%p")}"
8
+
9
+ if $platform == 'android' or $platform == 'ios'
10
+ print_mobile_configuration
11
+ else
12
+ print_desktop_configuration
13
+ end
14
+ end
15
+
16
+ # method to print desktop configuration
17
+ def print_desktop_configuration
18
+ puts 'Platform : ' + $driver.capabilities.platform.to_s.upcase
19
+ puts 'Browser : ' + $driver.capabilities.browser_name.to_s.upcase + " " + $driver.capabilities.version.to_s
20
+ puts ''
21
+ end
22
+
23
+ # method to print mobile configuration
24
+ def print_mobile_configuration
25
+ puts "Platform : #{$platform.upcase}"
26
+ puts "OS version : #{$os_version}"
27
+ puts "Device : #{$device_name}"
28
+
29
+ if $app_path.nil?
30
+ puts 'Browser : ' + $driver.capabilities.browser_name.to_s.upcase + " " + $driver.capabilities.version.to_s
31
+ else
32
+ puts "App Tested : #{$app_path}"
33
+ end
34
+ puts ''
35
+ end
@@ -1,87 +1,87 @@
1
- # Error handling methods
2
-
3
- # Method to check browser type
4
- def validate_parameters(platform, browser_type, app_path)
5
- if platform == 'desktop'
6
- if !%w(ff ie chrome safari opera).include? browser_type
7
- print_error_desktop
8
- end
9
- elsif platform == 'android'
10
- print_error_android browser_type, app_path
11
- elsif platform == 'iOS'
12
- puts "Not Implemented..."
13
- # print_error_ios browser_type, app_path
14
- else
15
- print_invalid_platform
16
- end
17
- end
18
-
19
- # print error for desktop
20
- def print_error_desktop
21
- puts "\nInappropraite desktop browser : \"#{ENV['BROWSER']}\""
22
- puts "\nUsage : cucumber BROWSER=browser_name"
23
- puts "\nBrowser Supported :\n"
24
- puts "\n1.ie\n2.chrome\n3.ff\n4.safari\n5.opera"
25
- Process.exit(0)
26
- end
27
-
28
- # print error for android
29
- def print_error_android(browser_type, app_path)
30
- if browser_type=='ff' and app_path==nil
31
- puts "\nOops... not mentioned \"Browser\" or \"App path\""
32
- print_error_android_app
33
- print_error_android_web
34
- Process.exit(0)
35
- elsif browser_type!='ff' and !%w(native chrome).include? browser_type
36
- puts "\nOops... not supported browser"
37
- print_error_android_web
38
- Process.exit(0)
39
- end
40
- end
41
-
42
- # print error for android app
43
- def print_error_android_app
44
- puts "\nTo run test on android app"
45
- puts "\n Usage : cucumber PLATFORM=android APP_PATH=path/to/app"
46
- end
47
-
48
- # print error for android web
49
- def print_error_android_web
50
- puts "\nTo run test on android mobile web"
51
- puts "\n Usage : cucumber PLATFORM=android BROWSER=browser_name"
52
- puts "\n Supported browsers are \"chrome\" and \"native\""
53
- end
54
-
55
- # print error for ios
56
- def print_error_ios
57
- if browser_type=='ff' and app_path==nil
58
- puts "\nOops... not mentioned \"Browser\" or \"App path\""
59
- print_error_ios_app
60
- print_error_ios_web
61
- Process.exit(0)
62
- elsif browser_type!='safari'
63
- puts "\nOops... not supported browser"
64
- print_error_ios_app_web
65
- Process.exit(0)
66
- end
67
- end
68
-
69
- # print error for ios app
70
- def print_error_ios_app
71
- puts "\nTo run test on iOS App"
72
- puts "\n Usage : cucumber PLATFORM=iOS APP_PATH=path/to/app"
73
- end
74
-
75
- # print error for ios web
76
- def print_error_ios_web
77
- puts "\nTo run test on iOS mobile web"
78
- puts "\n Usage : cucumber PLATFORM=iOS BROWSER=safari"
79
- end
80
-
81
- # print error if invalid platform
82
- def print_invalid_platform
83
- puts "\nOops... Invalid Platform"
84
- puts "\nSupported platform are \"android\" and \"iOS\"."
85
- puts "\nTo run on Desktop no need to mention platform."
86
- Process.exit(0)
1
+ # Error handling methods
2
+
3
+ # Method to check browser type
4
+ def validate_parameters(platform, browser_type, app_path)
5
+ if platform == 'desktop'
6
+ if !%w(ff ie chrome safari opera).include? browser_type
7
+ print_error_desktop
8
+ end
9
+ elsif platform == 'android'
10
+ print_error_android browser_type, app_path
11
+ elsif platform == 'iOS'
12
+ puts "Not Implemented..."
13
+ # print_error_ios browser_type, app_path
14
+ else
15
+ print_invalid_platform
16
+ end
17
+ end
18
+
19
+ # print error for desktop
20
+ def print_error_desktop
21
+ puts "\nInappropraite desktop browser : \"#{ENV['BROWSER']}\""
22
+ puts "\nUsage : cucumber BROWSER=browser_name"
23
+ puts "\nBrowser Supported :\n"
24
+ puts "\n1.ie\n2.chrome\n3.ff\n4.safari\n5.opera"
25
+ Process.exit(0)
26
+ end
27
+
28
+ # print error for android
29
+ def print_error_android(browser_type, app_path)
30
+ if browser_type=='ff' and app_path==nil
31
+ puts "\nOops... not mentioned \"Browser\" or \"App path\""
32
+ print_error_android_app
33
+ print_error_android_web
34
+ Process.exit(0)
35
+ elsif browser_type!='ff' and !%w(native chrome).include? browser_type
36
+ puts "\nOops... not supported browser"
37
+ print_error_android_web
38
+ Process.exit(0)
39
+ end
40
+ end
41
+
42
+ # print error for android app
43
+ def print_error_android_app
44
+ puts "\nTo run test on android app"
45
+ puts "\n Usage : cucumber PLATFORM=android APP_PATH=path/to/app"
46
+ end
47
+
48
+ # print error for android web
49
+ def print_error_android_web
50
+ puts "\nTo run test on android mobile web"
51
+ puts "\n Usage : cucumber PLATFORM=android BROWSER=browser_name"
52
+ puts "\n Supported browsers are \"chrome\" and \"native\""
53
+ end
54
+
55
+ # print error for ios
56
+ def print_error_ios
57
+ if browser_type=='ff' and app_path==nil
58
+ puts "\nOops... not mentioned \"Browser\" or \"App path\""
59
+ print_error_ios_app
60
+ print_error_ios_web
61
+ Process.exit(0)
62
+ elsif browser_type!='safari'
63
+ puts "\nOops... not supported browser"
64
+ print_error_ios_app_web
65
+ Process.exit(0)
66
+ end
67
+ end
68
+
69
+ # print error for ios app
70
+ def print_error_ios_app
71
+ puts "\nTo run test on iOS App"
72
+ puts "\n Usage : cucumber PLATFORM=iOS APP_PATH=path/to/app"
73
+ end
74
+
75
+ # print error for ios web
76
+ def print_error_ios_web
77
+ puts "\nTo run test on iOS mobile web"
78
+ puts "\n Usage : cucumber PLATFORM=iOS BROWSER=safari"
79
+ end
80
+
81
+ # print error if invalid platform
82
+ def print_invalid_platform
83
+ puts "\nOops... Invalid Platform"
84
+ puts "\nSupported platform are \"android\" and \"iOS\"."
85
+ puts "\nTo run on Desktop no need to mention platform."
86
+ Process.exit(0)
87
87
  end
@@ -1,67 +1,67 @@
1
- require_relative 'required_files'
2
-
3
- # method to enter text into textfield
4
- def enter_text(access_type, text, access_name)
5
- WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.send_keys text
6
- end
7
-
8
- # method to clear text from textfield
9
- def clear_text(access_type, access_name)
10
- WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.clear
11
- end
12
-
13
- # method to select option from dropdwon list
14
- def select_option_from_dropdown(access_type, by, option, access_name)
15
- dropdown = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }
16
- select_list = Selenium::WebDriver::Support::Select.new(dropdown)
17
- select_list.select_by(:"#{by}", "#{option}")
18
- end
19
-
20
- # method to select all option from dropdwon list
21
- def select_all_option_from_multiselect_dropdown(access_type, access_name)
22
- dropdown = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }
23
- select_list = Selenium::WebDriver::Support::Select.new(dropdown)
24
- select_list.select_all
25
- end
26
-
27
- # method to unselect all option from dropdwon list
28
- def unselect_all_option_from_multiselect_dropdown(access_type, access_name)
29
- dropdown = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }
30
- select_list = Selenium::WebDriver::Support::Select.new(dropdown)
31
- select_list.deselect_all
32
- end
33
-
34
- # method to check checkbox
35
- def check_checkbox(access_type, access_name)
36
- checkbox = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }
37
- checkbox.click unless checkbox.selected?
38
- end
39
-
40
- # method to uncheck checkbox
41
- def uncheck_checkbox(access_type, access_name)
42
- checkbox = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }
43
-
44
- if checkbox.selected?
45
- checkbox.click
46
- end
47
- end
48
-
49
- # method to select radio button
50
- def toggle_checkbox(access_type, access_name)
51
- WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }.click
52
- end
53
-
54
- # method to select radio button
55
- def select_radio_button(access_type, access_name)
56
- radio_button = WAIT.until { $driver.find_element(:"#{access_type}" => "#{access_name}") }
57
- radio_button.click unless radio_button.selected?
58
- end
59
-
60
- # method to select option from radio button group
61
- def select_option_from_radio_button_group(access_type, by, option, access_name)
62
- radio_button_group = WAIT.until { $driver.find_elements(:"#{access_type}" => "#{access_name}") }
63
-
64
- getter = ->(rb, by) { by == 'value' ? rb.attribute('value') : rb.text }
65
- ele = radio_button_group.find { |rb| getter.call(rb, by) == option }
66
- ele.click unless ele.selected?
67
- end
1
+ require_relative 'required_files'
2
+
3
+ # method to enter text into textfield
4
+ def enter_text(access_type, text, access_name)
5
+ $driver.find_element(:"#{access_type}" => "#{access_name}").send_keys text
6
+ end
7
+
8
+ # method to clear text from textfield
9
+ def clear_text(access_type, access_name)
10
+ $driver.find_element(:"#{access_type}" => "#{access_name}").clear
11
+ end
12
+
13
+ # method to select option from dropdwon list
14
+ def select_option_from_dropdown(access_type, by, option, access_name)
15
+ dropdown = $driver.find_element(:"#{access_type}" => "#{access_name}")
16
+ select_list = Selenium::WebDriver::Support::Select.new(dropdown)
17
+ select_list.select_by(:"#{by}", "#{option}")
18
+ end
19
+
20
+ # method to select all option from dropdwon list
21
+ def select_all_option_from_multiselect_dropdown(access_type, access_name)
22
+ dropdown = $driver.find_element(:"#{access_type}" => "#{access_name}")
23
+ select_list = Selenium::WebDriver::Support::Select.new(dropdown)
24
+ select_list.select_all
25
+ end
26
+
27
+ # method to unselect all option from dropdwon list
28
+ def unselect_all_option_from_multiselect_dropdown(access_type, access_name)
29
+ dropdown = $driver.find_element(:"#{access_type}" => "#{access_name}")
30
+ select_list = Selenium::WebDriver::Support::Select.new(dropdown)
31
+ select_list.deselect_all
32
+ end
33
+
34
+ # method to check checkbox
35
+ def check_checkbox(access_type, access_name)
36
+ checkbox = $driver.find_element(:"#{access_type}" => "#{access_name}")
37
+ checkbox.click unless checkbox.selected?
38
+ end
39
+
40
+ # method to uncheck checkbox
41
+ def uncheck_checkbox(access_type, access_name)
42
+ checkbox = $driver.find_element(:"#{access_type}" => "#{access_name}")
43
+
44
+ if checkbox.selected?
45
+ checkbox.click
46
+ end
47
+ end
48
+
49
+ # method to select radio button
50
+ def toggle_checkbox(access_type, access_name)
51
+ $driver.find_element(:"#{access_type}" => "#{access_name}").click
52
+ end
53
+
54
+ # method to select radio button
55
+ def select_radio_button(access_type, access_name)
56
+ radio_button = $driver.find_element(:"#{access_type}" => "#{access_name}")
57
+ radio_button.click unless radio_button.selected?
58
+ end
59
+
60
+ # method to select option from radio button group
61
+ def select_option_from_radio_button_group(access_type, by, option, access_name)
62
+ radio_button_group = $driver.find_elements(:"#{access_type}" => "#{access_name}")
63
+
64
+ getter = ->(rb, by) { by == 'value' ? rb.attribute('value') : rb.text }
65
+ ele = radio_button_group.find { |rb| getter.call(rb, by) == option }
66
+ ele.click unless ele.selected?
67
+ end
@@ -1,9 +1,9 @@
1
- require_relative 'required_files'
2
-
3
- def handle_alert(decesion)
4
- if decesion == 'accept'
5
- $driver.switch_to.alert.accept
6
- else
7
- $driver.switch_to.alert.dismiss
8
- end
9
- end
1
+ require_relative 'required_files'
2
+
3
+ def handle_alert(decesion)
4
+ if decesion == 'accept'
5
+ $driver.switch_to.alert.accept
6
+ else
7
+ $driver.switch_to.alert.dismiss
8
+ end
9
+ end
@@ -1,34 +1,34 @@
1
-
2
- # custome exception class
3
- class TestCaseFailed < Exception
4
- end
5
-
6
- # WAIT instance for explicit wait
7
- WAIT = Selenium::WebDriver::Wait.new(:timeout => 30)
8
-
9
- # method to validate locator
10
- def valid_locator_type? type
11
- %w(id class css name xpath).include? type
12
- end
13
-
14
- def validate_locator type
15
- raise "Invalid locator type - #{type}" unless valid_locator_type? type
16
- end
17
-
18
- # method to validate dropdown selector
19
- def valid_option_by? option_by
20
- %w(text value index).include? option_by
21
- end
22
-
23
- def validate_option_by option_by
24
- raise "Invalid option by - #{option_by}" unless valid_option_by? option_by
25
- end
26
-
27
- # Return android device name and android version using adb command
28
- def get_device_info
29
- IO.popen('adb shell getprop ro.product.brand') { |f| $device = f.gets.chomp.upcase}
30
- $device += ' '
31
- IO.popen('adb shell getprop ro.product.model') { |f| $device += f.gets.chomp.upcase}
32
- IO.popen('adb shell getprop ro.build.version.release') { |f| $os_version = f.gets.chomp.upcase}
33
- return $device, $os_version
34
- end
1
+
2
+ # custome exception class
3
+ class TestCaseFailed < Exception
4
+ end
5
+
6
+ # WAIT instance for explicit wait
7
+ WAIT = Selenium::WebDriver::Wait.new(:timeout => 30)
8
+
9
+ # method to validate locator
10
+ def valid_locator_type? type
11
+ %w(id class css name xpath).include? type
12
+ end
13
+
14
+ def validate_locator type
15
+ raise "Invalid locator type - #{type}" unless valid_locator_type? type
16
+ end
17
+
18
+ # method to validate dropdown selector
19
+ def valid_option_by? option_by
20
+ %w(text value index).include? option_by
21
+ end
22
+
23
+ def validate_option_by option_by
24
+ raise "Invalid option by - #{option_by}" unless valid_option_by? option_by
25
+ end
26
+
27
+ # Return android device name and android version using adb command
28
+ def get_device_info
29
+ IO.popen('adb shell getprop ro.product.brand') { |f| $device = f.gets.chomp.upcase}
30
+ $device += ' '
31
+ IO.popen('adb shell getprop ro.product.model') { |f| $device += f.gets.chomp.upcase}
32
+ IO.popen('adb shell getprop ro.build.version.release') { |f| $os_version = f.gets.chomp.upcase}
33
+ return $device, $os_version
34
+ end