selenium-cucumber 2.1.3 → 2.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/doc/canned_steps.md +13 -8
  3. data/example/android/android_app/HinduCalendar.zip +0 -0
  4. data/example/android/android_app/HinduCalendar/HinduCalendar.apk +0 -0
  5. data/example/android/android_app/HinduCalendar/README.md +19 -0
  6. data/example/android/android_app/HinduCalendar/Results.html +472 -0
  7. data/example/android/android_app/HinduCalendar/features/01_HC_homepage_menu_validation.feature +36 -0
  8. data/example/android/android_app/HinduCalendar/features/02_HC_homepage_menu_navigation.feature +71 -0
  9. data/example/android/android_app/HinduCalendar/features/03_HC_Create_Save_View_Delete_Kundali.feature +63 -0
  10. data/example/android/android_app/HinduCalendar/features/actual_images/test.png +0 -0
  11. data/example/android/android_app/HinduCalendar/features/expected_images/test.png +0 -0
  12. data/example/android/android_app/HinduCalendar/features/image_difference/test.png +0 -0
  13. data/example/android/android_app/HinduCalendar/features/my_first.feature +1 -0
  14. data/example/android/android_app/HinduCalendar/features/screenshots/test.png +0 -0
  15. data/example/android/android_app/HinduCalendar/features/step_definitions/01_HC_homepage_menu_validation.rb +81 -0
  16. data/example/android/android_app/HinduCalendar/features/step_definitions/02_HC_homepage_menu_navigation.rb +132 -0
  17. data/example/android/android_app/HinduCalendar/features/step_definitions/03_HC_Create_Save_View_Delete_Kundali.rb +413 -0
  18. data/example/android/android_app/HinduCalendar/features/step_definitions/custom_steps.rb +5 -0
  19. data/example/android/android_app/HinduCalendar/features/support/env.rb +51 -0
  20. data/example/android/android_app/HinduCalendar/features/support/hooks.rb +38 -0
  21. data/example/android/android_app/android_app_calculator.zip +0 -0
  22. data/example/android/android_app/android_app_calculator/AndroidCalculator.apk +0 -0
  23. data/example/android/android_app/android_app_calculator/features/actual_images/test.png +0 -0
  24. data/example/android/android_app/android_app_calculator/features/calculator.feature +36 -0
  25. data/example/android/android_app/android_app_calculator/features/expected_images/test.png +0 -0
  26. data/example/android/android_app/android_app_calculator/features/image_difference/test.png +0 -0
  27. data/example/android/android_app/android_app_calculator/features/my_first.feature +13 -0
  28. data/example/android/android_app/android_app_calculator/features/screenshots/test.png +0 -0
  29. data/example/android/android_app/android_app_calculator/features/step_definitions/custom_steps.rb +5 -0
  30. data/example/android/android_app/android_app_calculator/features/support/env.rb +51 -0
  31. data/example/android/android_app/android_app_calculator/features/support/hooks.rb +38 -0
  32. data/example/android/android_web/android_web_gmail_login.zip +0 -0
  33. data/example/android/android_web/android_web_gmail_login/features/actual_images/test.png +0 -0
  34. data/example/android/android_web/android_web_gmail_login/features/expected_images/test.png +0 -0
  35. data/example/android/android_web/android_web_gmail_login/features/gmail_login.feature +12 -0
  36. data/example/android/android_web/android_web_gmail_login/features/image_difference/test.png +0 -0
  37. data/example/android/android_web/android_web_gmail_login/features/my_first.feature +1 -0
  38. data/example/android/android_web/android_web_gmail_login/features/screenshots/test.png +0 -0
  39. data/example/android/android_web/android_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
  40. data/example/android/android_web/android_web_gmail_login/features/support/env.rb +51 -0
  41. data/example/android/android_web/android_web_gmail_login/features/support/hooks.rb +38 -0
  42. data/example/desktop web/desktop_web_gmail_login.zip +0 -0
  43. data/example/desktop web/desktop_web_gmail_login/features/actual_images/test.png +0 -0
  44. data/example/desktop web/desktop_web_gmail_login/features/expected_images/test.png +0 -0
  45. data/example/desktop web/desktop_web_gmail_login/features/gmail_login.feature +10 -0
  46. data/example/desktop web/desktop_web_gmail_login/features/gmail_multi_login.feature +22 -0
  47. data/example/desktop web/desktop_web_gmail_login/features/image_difference/test.png +0 -0
  48. data/example/desktop web/desktop_web_gmail_login/features/my_first.feature +1 -0
  49. 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
  50. data/example/desktop web/desktop_web_gmail_login/features/screenshots/test.png +0 -0
  51. data/example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
  52. data/example/desktop web/desktop_web_gmail_login/features/support/env.rb +51 -0
  53. data/example/desktop web/desktop_web_gmail_login/features/support/hooks.rb +38 -0
  54. data/example/desktop web/desktop_web_gmail_login/result.html +478 -0
  55. data/lib/selenium-cucumber/methods/assertion_methods.rb +15 -15
  56. data/lib/selenium-cucumber/methods/configuration_methods.rb +1 -1
  57. data/lib/selenium-cucumber/version.rb +1 -1
  58. metadata +71 -43
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,51 @@
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
@@ -0,0 +1,38 @@
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
@@ -0,0 +1,36 @@
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"
@@ -0,0 +1,13 @@
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"
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,51 @@
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
@@ -0,0 +1,38 @@
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
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,51 @@
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
@@ -0,0 +1,38 @@
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
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,51 @@
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