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,16 +1,16 @@
1
- Installation
2
- ============
3
- ### Prerequisites
4
- You need to have Ruby installed.
5
- Verify your installation by running ruby -v in a terminal - it should print "ruby 1.9.3" (or higher).
6
-
7
- You need to have DevKit installed.
8
-
9
- You can get Ruby and DevKit from [RubyInstaller.org](http://rubyinstaller.org/)
10
-
11
- ### Installation
12
-
13
- Install `selenium-cucumber` gem by running
14
-
15
- - `gem install selenium-cucumber`
16
-
1
+ Installation
2
+ ============
3
+ ### Prerequisites
4
+ You need to have Ruby installed.
5
+ Verify your installation by running ruby -v in a terminal - it should print "ruby 1.9.3" (or higher).
6
+
7
+ You need to have DevKit installed.
8
+
9
+ You can get Ruby and DevKit from [RubyInstaller.org](http://rubyinstaller.org/)
10
+
11
+ ### Installation
12
+
13
+ Install `selenium-cucumber` gem by running
14
+
15
+ - `gem install selenium-cucumber`
16
+
@@ -1,121 +1,121 @@
1
- Selenium-Cucumber Ruby API's
2
- ============================
3
-
4
- If you are writing code for your custom steps you can use the following methods :
5
-
6
- Note : For some of the API paramtere values are fixed. Such values for paramaters are mentioned below.
7
-
8
- Navigation API's
9
- ----------------
10
-
11
- navigate_to("link")
12
-
13
- navigate(direction) # direction => "back" / "forward"
14
-
15
- close_driver()
16
-
17
-
18
- Browser Interaction API's
19
- -------------------------
20
-
21
- resize_browser(width, height)
22
-
23
- scroll_page(to) # to => "top" / "end"
24
-
25
- scroll_to_element(by, access_value)
26
-
27
- zoom_in_out(in_out) # in_out => "add" / "subtract"
28
-
29
- zoom_in_out_till_element_display(by, in_out, access_value) # in_out => "add" / "subtract"
30
-
31
-
32
- Input API's
33
- ------------
34
-
35
- click(by, access_value)
36
-
37
- double_click(access_type,access_value)
38
-
39
- click_forcefully(access_type, access_name)
40
-
41
- submit(by, access_value)
42
-
43
- enter_text(by, text, access_value)
44
-
45
- clear_text(by, access_value)
46
-
47
- check_checkbox(by, access_value)
48
-
49
- uncheck_checkbox(by, access_value)
50
-
51
- toggle_checkbox(by, access_value)
52
-
53
- select_radio_button(by, access_value)
54
-
55
- get_page_title()
56
-
57
- get_element_text(by, access_value)
58
-
59
- get_element_attribute(by, access_value, attribute)
60
-
61
- is_element_enabled(by, access_value)
62
-
63
- is_element_displayed(by, access_value)
64
-
65
- hover_over_element(by, access_value)
66
-
67
- by => "locators type" ("id", "name", "class", "xpath", "css")
68
-
69
- access_value => "locator value"
70
-
71
-
72
- Javascript Handling API
73
- -----------------------
74
-
75
- handle_alert(decision) # decision => "accept" / "dismiss"
76
-
77
- get_alert_text
78
-
79
-
80
- Progress API's
81
- --------------
82
-
83
- wait(time_in_sec)
84
-
85
- wait_for_element_to_display(by, access_value, duration)
86
-
87
- wait_for_element_to_enable(by, access_value, duration)
88
-
89
-
90
- by => "locators type" ("id", "name", "class", "xpath", "css")
91
-
92
- access_value => "locator value"
93
-
94
- duration => duration in seconds.
95
-
96
-
97
- Image Comparing API
98
- -------------------
99
-
100
- does_images_similar?(actual_img_by, actual_img_access_value, excp_img_by, excp_img_access_value)
101
-
102
-
103
- actual_img_by => "element locators" ("id", "name", "class", "xpath", "css", "url")
104
-
105
- actual_img_access_value => "locator value"
106
-
107
-
108
- excp_img_by => "image location" ("id", "url", "image_name")
109
-
110
- excp_img_access_value => "value"
111
-
112
-
113
- Screenshot API
114
- --------------
115
- take_screenshots
116
-
117
-
118
- Configuration API
119
- -----------------
120
-
1
+ Selenium-Cucumber Ruby API's
2
+ ============================
3
+
4
+ If you are writing code for your custom steps you can use the following methods :
5
+
6
+ Note : For some of the API paramtere values are fixed. Such values for paramaters are mentioned below.
7
+
8
+ Navigation API's
9
+ ----------------
10
+
11
+ navigate_to("link")
12
+
13
+ navigate(direction) # direction => "back" / "forward"
14
+
15
+ close_driver()
16
+
17
+
18
+ Browser Interaction API's
19
+ -------------------------
20
+
21
+ resize_browser(width, height)
22
+
23
+ scroll_page(to) # to => "top" / "end"
24
+
25
+ scroll_to_element(by, access_value)
26
+
27
+ zoom_in_out(in_out) # in_out => "add" / "subtract"
28
+
29
+ zoom_in_out_till_element_display(by, in_out, access_value) # in_out => "add" / "subtract"
30
+
31
+
32
+ Input API's
33
+ ------------
34
+
35
+ click(by, access_value)
36
+
37
+ double_click(access_type,access_value)
38
+
39
+ click_forcefully(access_type, access_name)
40
+
41
+ submit(by, access_value)
42
+
43
+ enter_text(by, text, access_value)
44
+
45
+ clear_text(by, access_value)
46
+
47
+ check_checkbox(by, access_value)
48
+
49
+ uncheck_checkbox(by, access_value)
50
+
51
+ toggle_checkbox(by, access_value)
52
+
53
+ select_radio_button(by, access_value)
54
+
55
+ get_page_title()
56
+
57
+ get_element_text(by, access_value)
58
+
59
+ get_element_attribute(by, access_value, attribute)
60
+
61
+ is_element_enabled(by, access_value)
62
+
63
+ is_element_displayed(by, access_value)
64
+
65
+ hover_over_element(by, access_value)
66
+
67
+ by => "locators type" ("id", "name", "class", "xpath", "css")
68
+
69
+ access_value => "locator value"
70
+
71
+
72
+ Javascript Handling API
73
+ -----------------------
74
+
75
+ handle_alert(decision) # decision => "accept" / "dismiss"
76
+
77
+ get_alert_text
78
+
79
+
80
+ Progress API's
81
+ --------------
82
+
83
+ wait(time_in_sec)
84
+
85
+ wait_for_element_to_display(by, access_value, duration)
86
+
87
+ wait_for_element_to_enable(by, access_value, duration)
88
+
89
+
90
+ by => "locators type" ("id", "name", "class", "xpath", "css")
91
+
92
+ access_value => "locator value"
93
+
94
+ duration => duration in seconds.
95
+
96
+
97
+ Image Comparing API
98
+ -------------------
99
+
100
+ does_images_similar?(actual_img_by, actual_img_access_value, excp_img_by, excp_img_access_value)
101
+
102
+
103
+ actual_img_by => "element locators" ("id", "name", "class", "xpath", "css", "url")
104
+
105
+ actual_img_access_value => "locator value"
106
+
107
+
108
+ excp_img_by => "image location" ("id", "url", "image_name")
109
+
110
+ excp_img_access_value => "value"
111
+
112
+
113
+ Screenshot API
114
+ --------------
115
+ take_screenshots
116
+
117
+
118
+ Configuration API
119
+ -----------------
120
+
121
121
  print_congifugartion
@@ -1,18 +1,18 @@
1
-
2
- Usage: selenium-cucumber <command-name> [parameters] [options]
3
-
4
- <command-name> can be one of
5
- help
6
- gen
7
- version
8
-
9
- Commands:
10
- help : prints more detailed help information.
11
-
12
- gen : creates a skeleton features dir. This is usually used once when
13
- setting up selnium-cucumber to ensure that the features folder contains
14
- the right step definitions and environment to run with cucumber.
15
-
16
- version : prints the gem version
17
-
18
- Options: -v, --verbose Turns on verbose logging
1
+
2
+ Usage: selenium-cucumber <command-name> [parameters] [options]
3
+
4
+ <command-name> can be one of
5
+ help
6
+ gen
7
+ version
8
+
9
+ Commands:
10
+ help : prints more detailed help information.
11
+
12
+ gen : creates a skeleton features dir. This is usually used once when
13
+ setting up selnium-cucumber to ensure that the features folder contains
14
+ the right step definitions and environment to run with cucumber.
15
+
16
+ version : prints the gem version
17
+
18
+ Options: -v, --verbose Turns on verbose logging
@@ -1,5 +1,5 @@
1
- Feature: Login feature
2
-
3
- Scenario: As a valid user I can log into my web app
4
- When I press "Login"
5
- Then I see "Welcome to coolest web app ever"
1
+ Feature: Login feature
2
+
3
+ Scenario: As a valid user I can log into my web app
4
+ When I press "Login"
5
+ Then I see "Welcome to coolest web app ever"
@@ -1,5 +1,5 @@
1
- require 'selenium-cucumber'
2
-
3
- # Do Not Remove This File
4
- # Add your custom steps here
1
+ require 'selenium-cucumber'
2
+
3
+ # Do Not Remove This File
4
+ # Add your custom steps here
5
5
  # $driver is instance of webdriver use this instance to write your custom code
@@ -1,51 +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
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 +1,47 @@
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
+ #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 |scenario|
14
+ # Do something after each scenario.
15
+ # The +scenario+ argument is optional, but
16
+ # if you use it, you can inspect status with
17
+ # the #failed?, #passed? and #exception methods.
18
+
19
+ if(scenario.failed?)
20
+ #Do something if scenario fails.
21
+ end
22
+ end
23
+
24
+ #Tagged hooks
25
+
26
+ Before('@Ex_tag1, @Ex_tag2') do
27
+ # This will only run before scenarios tagged
28
+ # with @Ex_tag1 OR @Ex_tag2.
29
+ end
30
+
31
+ AfterStep('@Ex_tag1, @Ex_tag2') do |scenario|
32
+ # This will only run after steps within scenarios tagged
33
+ # with @Ex_tag1 AND @Ex_tag2.
34
+ end
35
+
36
+ Around('@Ex_tag1') do |scenario, block|
37
+ # Will round around a scenario
38
+ end
39
+
40
+ AfterConfiguration do |config|
41
+ # Will run after cucumber has been configured
42
+ end
43
+
44
+ # Quit the selenium driver from the example tests.
45
+ at_exit do
46
+
47
+ end