selenium-cucumber 2.1.4 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
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,5 +0,0 @@
1
- require 'selenium-cucumber'
2
-
3
- # Do Not Remove This File
4
- # Add your custom steps here
5
- # $driver is instance of webdriver use this instance to write your custom code
@@ -1,51 +0,0 @@
1
- require 'rubygems'
2
- require 'selenium-cucumber'
3
-
4
- # Store command line arguments
5
- $browser_type = ENV['BROWSER'] || 'ff'
6
- $platform = ENV['PLATFORM'] || 'desktop'
7
- $os_version = ENV['OS_VERSION']
8
- $device_name = ENV['DEVICE_NAME']
9
- $udid = ENV['UDID']
10
- $app_path = ENV['APP_PATH']
11
-
12
- # check for valid parameters
13
- validate_parameters $platform, $browser_type, $app_path
14
-
15
- # If platform is android or ios create driver instance for mobile browser
16
- if $platform == 'android' or $platform == 'iOS'
17
-
18
- if $browser_type == 'native'
19
- $browser_type = "Browser"
20
- end
21
-
22
- if $platform == 'android'
23
- $device_name, $os_version = get_device_info
24
- end
25
-
26
- desired_caps = {
27
- caps: {
28
- platformName: $platform,
29
- browserName: $browser_type,
30
- versionNumber: $os_version,
31
- deviceName: $device_name,
32
- udid: $udid,
33
- app: ".//#{$app_path}"
34
- },
35
- }
36
-
37
- begin
38
- $driver = Appium::Driver.new(desired_caps).start_driver
39
- rescue Exception => e
40
- puts e.message
41
- Process.exit(0)
42
- end
43
- else # else create driver instance for desktop browser
44
- begin
45
- $driver = Selenium::WebDriver.for(:"#{$browser_type}")
46
- $driver.manage().window().maximize()
47
- rescue Exception => e
48
- puts e.message
49
- Process.exit(0)
50
- end
51
- end
@@ -1,38 +0,0 @@
1
- #Cucumber provides a number of hooks which allow us to run blocks at various points in the Cucumber test cycle
2
-
3
- Before do
4
- # Do something before each scenario.
5
- end
6
-
7
- Before do |scenario|
8
- # The +scenario+ argument is optional, but if you use it, you can get the title,
9
- # description, or name (title + description) of the scenario that is about to be
10
- # executed.
11
- end
12
-
13
- After do
14
- # Do something after each scenario.
15
- end
16
-
17
- After do |scenario|
18
- # Do something after each scenario.
19
- # The +scenario+ argument is optional, but
20
- # if you use it, you can inspect status with
21
- # the #failed?, #passed? and #exception methods.
22
-
23
- if(scenario.failed?)
24
- #Do something if scenario fails.
25
- end
26
- end
27
-
28
- #Tagged hooks
29
-
30
- Before('@Ex_tag1, @Ex_tag2') do
31
- # This will only run before scenarios tagged
32
- # with @cucumis OR @sativus.
33
- end
34
-
35
- AfterStep('@Ex_tag1, @Ex_tag2') do
36
- # This will only run after steps within scenarios tagged
37
- # with @cucumis AND @sativus.
38
- end
@@ -1,36 +0,0 @@
1
- Feature: Verify Calculator functionalities
2
-
3
- Scenario: Click on OK button
4
- Then I click on element having id "com.android2.calculator3:id/cling_dismiss"
5
-
6
- Scenario: Addirion
7
- Then I click on element having id "com.android2.calculator3:id/digit5"
8
- Then I click on element having id "com.android2.calculator3:id/plus"
9
- Then I click on element having id "com.android2.calculator3:id/digit9"
10
- When I click on element having id "com.android2.calculator3:id/equal"
11
- Then element having xpath "//android.widget.EditText[@index=0]" should have text as "14"
12
-
13
-
14
- Scenario: Substraction
15
- Then I click on element having id "com.android2.calculator3:id/digit9"
16
- Then I click on element having id "com.android2.calculator3:id/minus"
17
- Then I click on element having id "com.android2.calculator3:id/digit5"
18
- When I click on element having id "com.android2.calculator3:id/equal"
19
- Then element having xpath "//android.widget.EditText[@index=0]" should have text as "4"
20
-
21
- Scenario: Multiplication
22
- Then I click on element having id "com.android2.calculator3:id/digit9"
23
- Then I click on element having id "com.android2.calculator3:id/mul"
24
- Then I click on element having id "com.android2.calculator3:id/digit5"
25
- When I click on element having id "com.android2.calculator3:id/equal"
26
- Then element having xpath "//android.widget.EditText[@index=0]" should have text as "45"
27
-
28
- Scenario: Division
29
- Then I click on element having id "com.android2.calculator3:id/digit8"
30
- Then I click on element having id "com.android2.calculator3:id/div"
31
- Then I click on element having id "com.android2.calculator3:id/digit2"
32
- When I click on element having id "com.android2.calculator3:id/equal"
33
- Then element having xpath "//android.widget.EditText[@index=0]" should have text as "4"
34
-
35
- Scenario: Clear output
36
- Then I click on element having id "com.android2.calculator3:id/clear"
@@ -1,13 +0,0 @@
1
- #Scenario: Division
2
- # Then I click on element having id "com.android2.calculator3:id/digit8"
3
- # Then I click on element having id "com.android2.calculator3:id/div"
4
- # Then I click on element having id "com.android2.calculator3:id/digit4"
5
- # When I click on element having id "com.android2.calculator3:id/equal"
6
- # Then element having xpath "//android.widget.EditText[@index=0]" should have text as "2"
7
-
8
- # Scenario: Multiplication
9
- # Then I click on element having id "com.android2.calculator3:id/digit6"
10
- # Then I click on element having id "com.android2.calculator3:id/mul"
11
- # Then I click on element having id "com.android2.calculator3:id/digit5"
12
- # When I click on element having id "com.android2.calculator3:id/equal"
13
- # Then element having xpath "//android.widget.EditText[@index=0]" should have text as "30"
@@ -1,5 +0,0 @@
1
- require 'selenium-cucumber'
2
-
3
- # Do Not Remove This File
4
- # Add your custom steps here
5
- # $driver is instance of webdriver use this instance to write your custom code
@@ -1,51 +0,0 @@
1
- require 'rubygems'
2
- require 'selenium-cucumber'
3
-
4
- # Store command line arguments
5
- $browser_type = ENV['BROWSER'] || 'ff'
6
- $platform = ENV['PLATFORM'] || 'desktop'
7
- $os_version = ENV['OS_VERSION']
8
- $device_name = ENV['DEVICE_NAME']
9
- $udid = ENV['UDID']
10
- $app_path = ENV['APP_PATH']
11
-
12
- # check for valid parameters
13
- validate_parameters $platform, $browser_type, $app_path
14
-
15
- # If platform is android or ios create driver instance for mobile browser
16
- if $platform == 'android' or $platform == 'iOS'
17
-
18
- if $browser_type == 'native'
19
- $browser_type = "Browser"
20
- end
21
-
22
- if $platform == 'android'
23
- $device_name, $os_version = get_device_info
24
- end
25
-
26
- desired_caps = {
27
- caps: {
28
- platformName: $platform,
29
- browserName: $browser_type,
30
- versionNumber: $os_version,
31
- deviceName: $device_name,
32
- udid: $udid,
33
- app: ".//#{$app_path}"
34
- },
35
- }
36
-
37
- begin
38
- $driver = Appium::Driver.new(desired_caps).start_driver
39
- rescue Exception => e
40
- puts e.message
41
- Process.exit(0)
42
- end
43
- else # else create driver instance for desktop browser
44
- begin
45
- $driver = Selenium::WebDriver.for(:"#{$browser_type}")
46
- $driver.manage().window().maximize()
47
- rescue Exception => e
48
- puts e.message
49
- Process.exit(0)
50
- end
51
- end
@@ -1,38 +0,0 @@
1
- #Cucumber provides a number of hooks which allow us to run blocks at various points in the Cucumber test cycle
2
-
3
- Before do
4
- # Do something before each scenario.
5
- end
6
-
7
- Before do |scenario|
8
- # The +scenario+ argument is optional, but if you use it, you can get the title,
9
- # description, or name (title + description) of the scenario that is about to be
10
- # executed.
11
- end
12
-
13
- After do
14
- # Do something after each scenario.
15
- end
16
-
17
- After do |scenario|
18
- # Do something after each scenario.
19
- # The +scenario+ argument is optional, but
20
- # if you use it, you can inspect status with
21
- # the #failed?, #passed? and #exception methods.
22
-
23
- if(scenario.failed?)
24
- #Do something if scenario fails.
25
- end
26
- end
27
-
28
- #Tagged hooks
29
-
30
- Before('@Ex_tag1, @Ex_tag2') do
31
- # This will only run before scenarios tagged
32
- # with @cucumis OR @sativus.
33
- end
34
-
35
- AfterStep('@Ex_tag1, @Ex_tag2') do
36
- # This will only run after steps within scenarios tagged
37
- # with @cucumis AND @sativus.
38
- end
@@ -1,12 +0,0 @@
1
- Feature: Gmail Login mobile web
2
-
3
- Scenario: valid credentials login
4
- Given I navigate to "http://www.gmail.com"
5
- Then I wait for 5 sec
6
- Then I enter "your_email" into input field having id "Email"
7
- Then I enter "your_password" into input field having id "Passwd"
8
- When I click on element having id "signIn"
9
- And I wait for 10 sec
10
- Then element having xpath "//*[@id='tltbt']/div[3]/div/div" should be present
11
- And I wait for 5 sec
12
- Then I close browser
@@ -1,5 +0,0 @@
1
- require 'selenium-cucumber'
2
-
3
- # Do Not Remove This File
4
- # Add your custom steps here
5
- # $driver is instance of webdriver use this instance to write your custom code
@@ -1,51 +0,0 @@
1
- require 'rubygems'
2
- require 'selenium-cucumber'
3
-
4
- # Store command line arguments
5
- $browser_type = ENV['BROWSER'] || 'ff'
6
- $platform = ENV['PLATFORM'] || 'desktop'
7
- $os_version = ENV['OS_VERSION']
8
- $device_name = ENV['DEVICE_NAME']
9
- $udid = ENV['UDID']
10
- $app_path = ENV['APP_PATH']
11
-
12
- # check for valid parameters
13
- validate_parameters $platform, $browser_type, $app_path
14
-
15
- # If platform is android or ios create driver instance for mobile browser
16
- if $platform == 'android' or $platform == 'iOS'
17
-
18
- if $browser_type == 'native'
19
- $browser_type = "Browser"
20
- end
21
-
22
- if $platform == 'android'
23
- $device_name, $os_version = get_device_info
24
- end
25
-
26
- desired_caps = {
27
- caps: {
28
- platformName: $platform,
29
- browserName: $browser_type,
30
- versionNumber: $os_version,
31
- deviceName: $device_name,
32
- udid: $udid,
33
- app: ".//#{$app_path}"
34
- },
35
- }
36
-
37
- begin
38
- $driver = Appium::Driver.new(desired_caps).start_driver
39
- rescue Exception => e
40
- puts e.message
41
- Process.exit(0)
42
- end
43
- else # else create driver instance for desktop browser
44
- begin
45
- $driver = Selenium::WebDriver.for(:"#{$browser_type}")
46
- $driver.manage().window().maximize()
47
- rescue Exception => e
48
- puts e.message
49
- Process.exit(0)
50
- end
51
- end
@@ -1,38 +0,0 @@
1
- #Cucumber provides a number of hooks which allow us to run blocks at various points in the Cucumber test cycle
2
-
3
- Before do
4
- # Do something before each scenario.
5
- end
6
-
7
- Before do |scenario|
8
- # The +scenario+ argument is optional, but if you use it, you can get the title,
9
- # description, or name (title + description) of the scenario that is about to be
10
- # executed.
11
- end
12
-
13
- After do
14
- # Do something after each scenario.
15
- end
16
-
17
- After do |scenario|
18
- # Do something after each scenario.
19
- # The +scenario+ argument is optional, but
20
- # if you use it, you can inspect status with
21
- # the #failed?, #passed? and #exception methods.
22
-
23
- if(scenario.failed?)
24
- #Do something if scenario fails.
25
- end
26
- end
27
-
28
- #Tagged hooks
29
-
30
- Before('@Ex_tag1, @Ex_tag2') do
31
- # This will only run before scenarios tagged
32
- # with @cucumis OR @sativus.
33
- end
34
-
35
- AfterStep('@Ex_tag1, @Ex_tag2') do
36
- # This will only run after steps within scenarios tagged
37
- # with @cucumis AND @sativus.
38
- end
@@ -1,10 +0,0 @@
1
- Feature: Gmail_login
2
-
3
- Scenario: Valid_gmail_login
4
- Given I navigate to "http://www.gmail.com"
5
- And I enter "test@gmail.com" into input field having id "Email"
6
- Then I click on element having id "next"
7
- And I enter "!password*" into input field having id "Passwd"
8
- When I click on element having id "signIn"
9
- And I wait for 10 sec
10
- Then I close browser
@@ -1,22 +0,0 @@
1
- Feature: Gmail_login
2
-
3
- Scenario: Open gmail
4
- Given I navigate to "http://www.gmail.com"
5
-
6
- Scenario Outline: In-valid Login
7
- Then I clear input field having id "Email"
8
- And I enter <username> into input field having id "Email"
9
- Then I click on element having id "next"
10
- Then I clear input field having id "Passwd"
11
- And I enter <password> into input field having id "Passwd"
12
- When I click on element having id "signIn"
13
- Then element having id "errormsg_0_Passwd" should be present
14
-
15
- Examples:
16
- | username | password |
17
- |"test1" |"password1" |
18
- |"test2" |"password2" |
19
- |"test3" |"password3" |
20
-
21
- Scenario: close gmail
22
- Then I close browser
@@ -1,5 +0,0 @@
1
- require 'selenium-cucumber'
2
-
3
- # Do Not Remove This File
4
- # Add your custom steps here
5
- # $driver is instance of webdriver use this instance to write your custom code
@@ -1,51 +0,0 @@
1
- require 'rubygems'
2
- require 'selenium-cucumber'
3
-
4
- # Store command line arguments
5
- $browser_type = ENV['BROWSER'] || 'ff'
6
- $platform = ENV['PLATFORM'] || 'desktop'
7
- $os_version = ENV['OS_VERSION']
8
- $device_name = ENV['DEVICE_NAME']
9
- $udid = ENV['UDID']
10
- $app_path = ENV['APP_PATH']
11
-
12
- # check for valid parameters
13
- validate_parameters $platform, $browser_type, $app_path
14
-
15
- # If platform is android or ios create driver instance for mobile browser
16
- if $platform == 'android' or $platform == 'iOS'
17
-
18
- if $browser_type == 'native'
19
- $browser_type = "Browser"
20
- end
21
-
22
- if $platform == 'android'
23
- $device_name, $os_version = get_device_info
24
- end
25
-
26
- desired_caps = {
27
- caps: {
28
- platformName: $platform,
29
- browserName: $browser_type,
30
- versionNumber: $os_version,
31
- deviceName: $device_name,
32
- udid: $udid,
33
- app: ".//#{$app_path}"
34
- },
35
- }
36
-
37
- begin
38
- $driver = Appium::Driver.new(desired_caps).start_driver
39
- rescue Exception => e
40
- puts e.message
41
- Process.exit(0)
42
- end
43
- else # else create driver instance for desktop browser
44
- begin
45
- $driver = Selenium::WebDriver.for(:"#{$browser_type}")
46
- $driver.manage().window().maximize()
47
- rescue Exception => e
48
- puts e.message
49
- Process.exit(0)
50
- end
51
- end