selenium-cucumber 0.1.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/bin/generate.rb +20 -20
  3. data/bin/helper.rb +50 -50
  4. data/bin/selenium-cucumber +30 -29
  5. data/doc/canned_steps.md +8 -0
  6. data/doc/installation.md +16 -16
  7. data/doc/selenium-cucumber-help.md +18 -18
  8. data/example/Gemfile +5 -0
  9. data/example/Gemfile.lock +36 -0
  10. data/{Example/image_difference → example/features/actual_images}/test.png +0 -0
  11. data/{Example → example}/features/assertion_steps_Ex.feature +22 -10
  12. data/{Example → example}/features/click_steps_Ex.feature +0 -0
  13. data/{Example → example}/features/configuration_step_Ex.feature +1 -2
  14. data/example/features/expected_images/logo-PNG.png +0 -0
  15. data/example/features/expected_images/original_image.jpg +0 -0
  16. data/{Example/screenshots → example/features/image_difference}/test.png +0 -0
  17. data/{Example → example}/features/input_steps_Ex.feature +0 -0
  18. data/{Example → example}/features/javascript_steps_Ex.feature +0 -0
  19. data/{Example → example}/features/navigation_steps_Ex.feature +3 -3
  20. data/{Example → example}/features/progress_step_Ex.feature +0 -0
  21. data/{Example → example}/features/screenshot_step_Ex.feature +5 -1
  22. data/example/features/screenshots/test.png +0 -0
  23. data/{Example → example}/features/step_definitions/custom_steps.rb +0 -0
  24. data/{Example → example}/features/support/env.rb +0 -1
  25. data/{Example → example}/features/support/hooks.rb +0 -0
  26. data/example/run_features.rb +42 -0
  27. data/example/test_page.html +218 -0
  28. data/features-skeleton/actual_images/test.png +0 -0
  29. data/features-skeleton/my_first.feature +5 -5
  30. data/features-skeleton/step_definitions/custom_steps.rb +4 -4
  31. data/features-skeleton/support/env.rb +38 -38
  32. data/features-skeleton/support/hooks.rb +37 -33
  33. data/lib/selenium-cucumber.rb +2 -2
  34. data/lib/selenium-cucumber/assertion_steps.rb +25 -27
  35. data/lib/selenium-cucumber/click_elements_steps.rb +9 -12
  36. data/lib/selenium-cucumber/configuration_steps.rb +3 -4
  37. data/lib/selenium-cucumber/input_steps.rb +26 -26
  38. data/lib/selenium-cucumber/javascript_handling_steps.rb +3 -3
  39. data/lib/selenium-cucumber/methods/assertion_methods.rb +197 -160
  40. data/lib/selenium-cucumber/methods/click_elements_methods.rb +8 -8
  41. data/lib/selenium-cucumber/methods/configuration_methods.rb +10 -5
  42. data/lib/selenium-cucumber/methods/input_methods.rb +32 -45
  43. data/lib/selenium-cucumber/methods/javascript_handling_methods.rb +7 -7
  44. data/lib/selenium-cucumber/methods/misc_methods.rb +6 -6
  45. data/lib/selenium-cucumber/methods/navigate_methods.rb +37 -41
  46. data/lib/selenium-cucumber/methods/progress_methods.rb +8 -8
  47. data/lib/selenium-cucumber/methods/required_files.rb +1 -1
  48. data/lib/selenium-cucumber/methods/screenshot_methods.rb +3 -3
  49. data/lib/selenium-cucumber/navigation_steps.rb +20 -22
  50. data/lib/selenium-cucumber/progress_steps.rb +5 -8
  51. data/lib/selenium-cucumber/screenshot_steps.rb +2 -2
  52. data/lib/selenium-cucumber/version.rb +1 -1
  53. metadata +23 -27
  54. data/Example/expected_images/flower.png +0 -0
  55. data/Example/expected_images/flower1.png +0 -0
  56. data/Example/features/new.feature +0 -7
  57. data/Example/image_difference/difference_20140814210820942.png +0 -0
  58. data/Example/image_difference/difference_20140815095331224.png +0 -0
  59. data/Example/image_difference/difference_20140815100021133.png +0 -0
  60. data/Example/image_difference/difference_20140815100348774.png +0 -0
  61. data/Example/run_features.rb +0 -42
  62. data/Example/screenshots/screenshot20140815095553337.png +0 -0
  63. data/Example/screenshots/screenshot20140815100120197.png +0 -0
  64. data/Example/screenshots/screenshot20140815100446914.png +0 -0
  65. data/Example/test_page.html +0 -206
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d305257fe405a3a6e3fdef64ba0238ac57f2fe3
4
- data.tar.gz: 05c21ef7cb1e6a756f6cc21baee9a5f0442da258
3
+ metadata.gz: 0fafe2faa8ccac6664b653cc839e147012a36fed
4
+ data.tar.gz: 70a7cfc8e999dbfbaeaf305a5bd2b19c2e1dca5f
5
5
  SHA512:
6
- metadata.gz: 96dcf390850fdbfcd240c64bf73e0a6af06289b63fb8d8764e12c6566080dfd4184e30484963accd8aaeb62ffdb4bf1cc569ed7b554fcd9d70ff91a91cdc5488
7
- data.tar.gz: 8165bf844471dfa3cc4545f61a855aaa81c86e7d5b4c8fa8e7668bc3e5f2bcb26bbd005b4ef55d44430fb89bc8693c11a38895b626d516fe49266feed03f9728
6
+ metadata.gz: 76e7c7f5543ca0512f264edc0b8aad03cb8a31e9791a0461b533ab8f0a953e9fefaa22076ca54492103ef89cb81037a7c35da4824dd1d0aba1edb225e568a884
7
+ data.tar.gz: 59666313ef8c2b3df72eaf4da0ca2ca35dbc726694b8c0ab8225eed999eb2e186990a0da51bb41783c50d043d229dcf19cb619b981bd1b6143f4cab7a581e4ee
data/bin/generate.rb CHANGED
@@ -1,20 +1,20 @@
1
-
2
- def selenium_cucumber_scaffold
3
- if File.exists?(@features_dir)
4
- puts "A features directory already exists. Stopping..."
5
- exit 1
6
- end
7
- msg("Question") do
8
- puts "I'm about to create a subdirectory called features."
9
- puts "features will contain all your project tests."
10
- puts "Please hit return to confirm that's what you want."
11
- end
12
- exit 2 unless STDIN.gets.chomp == ''
13
-
14
- FileUtils.cp_r(@source_dir, @features_dir)
15
-
16
- msg("Info") do
17
- puts "features subdirectory created. \n"
18
- end
19
-
20
- end
1
+
2
+ def selenium_cucumber_scaffold
3
+ if File.exists?(@features_dir)
4
+ puts "A features directory already exists. Stopping..."
5
+ exit 1
6
+ end
7
+ msg("Question") do
8
+ puts "I'm about to create a subdirectory called features."
9
+ puts "features will contain all your project tests."
10
+ puts "Please hit return to confirm that's what you want."
11
+ end
12
+ exit 2 unless STDIN.gets.chomp == ''
13
+
14
+ FileUtils.cp_r(@source_dir, @features_dir)
15
+
16
+ msg("Info") do
17
+ puts "features subdirectory created. \n"
18
+ end
19
+
20
+ end
data/bin/helper.rb CHANGED
@@ -1,51 +1,51 @@
1
- require 'tempfile'
2
- require 'json'
3
- require "rubygems"
4
-
5
- def msg(title, &block)
6
- puts "\n" + "-"*10 + title + "-"*10
7
- block.call
8
- puts "-"*10 + "-------" + "-"*10 + "\n"
9
- end
10
-
11
- def print_usage
12
- puts <<EOF
13
-
14
- Usage: selenium-cucumber <command-name> [parameters] [options]
15
-
16
- <command-name> can be one of
17
- help
18
- prints more detailed help information.
19
- gen
20
- generate a features folder structure.
21
- version
22
- prints the gem version
23
-
24
- <options> can be
25
- -v, --verbose Turns on verbose logging
26
- EOF
27
- end
28
-
29
- def print_help
30
- puts <<EOF
31
-
32
- Usage: selenium-cucumber <command-name> [parameters] [options]
33
-
34
- <command-name> can be one of
35
- help
36
- gen
37
- version
38
-
39
- Commands:
40
- help : prints more detailed help information.
41
-
42
- gen : creates a skeleton features dir. This is usually used once when
43
- setting up selnium-cucumber to ensure that the features folder contains
44
- the right step definitions and environment to run with cucumber.
45
-
46
- version : prints the gem version
47
-
48
- <Options>
49
- -v, --verbose Turns on verbose logging
50
- EOF
1
+ require 'tempfile'
2
+ require 'json'
3
+ require "rubygems"
4
+
5
+ def msg(title, &block)
6
+ puts "\n" + "-"*10 + title + "-"*10
7
+ block.call
8
+ puts "-"*10 + "-------" + "-"*10 + "\n"
9
+ end
10
+
11
+ def print_usage
12
+ puts <<EOF
13
+
14
+ Usage: selenium-cucumber <command-name> [parameters] [options]
15
+
16
+ <command-name> can be one of
17
+ help
18
+ prints more detailed help information.
19
+ gen
20
+ generate a features folder structure.
21
+ version
22
+ prints the gem version
23
+
24
+ <options> can be
25
+ -v, --verbose Turns on verbose logging
26
+ EOF
27
+ end
28
+
29
+ def print_help
30
+ puts <<EOF
31
+
32
+ Usage: selenium-cucumber <command-name> [parameters] [options]
33
+
34
+ <command-name> can be one of
35
+ help
36
+ gen
37
+ version
38
+
39
+ Commands:
40
+ help : prints more detailed help information.
41
+
42
+ gen : creates a skeleton features dir. This is usually used once when
43
+ setting up selnium-cucumber to ensure that the features folder contains
44
+ the right step definitions and environment to run with cucumber.
45
+
46
+ version : prints the gem version
47
+
48
+ <Options>
49
+ -v, --verbose Turns on verbose logging
50
+ EOF
51
51
  end
@@ -1,29 +1,30 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative 'helper.rb'
4
- require_relative 'generate.rb'
5
- require 'selenium-cucumber/version'
6
-
7
- @features_dir = File.join(FileUtils.pwd, "features")
8
- @support_dir = File.join(@features_dir, "support")
9
- @support_dir = File.join(@features_dir, "expected_images")
10
- @support_dir = File.join(@features_dir, "image_difference")
11
- @support_dir = File.join(@features_dir, "screenshots")
12
- @source_dir = File.join(File.dirname(__FILE__), '..', 'features-skeleton')
13
-
14
- if (ARGV.length == 0)
15
- print_usage
16
- else
17
- cmd = ARGV.shift
18
-
19
- if cmd == "help"
20
- print_help
21
- elsif cmd == "gen"
22
- selenium_cucumber_scaffold
23
- elsif cmd == "version"
24
- puts Selenium::Cucumber::VERSION
25
- else
26
- print_usage
27
- end
28
- end
29
-
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative 'helper.rb'
4
+ require_relative 'generate.rb'
5
+ require 'selenium-cucumber/version'
6
+
7
+ @features_dir = File.join(FileUtils.pwd, "features")
8
+ @support_dir = File.join(@features_dir, "support")
9
+ @support_dir = File.join(@features_dir, "expected_images")
10
+ @support_dir = File.join(@features_dir, "actual_images")
11
+ @support_dir = File.join(@features_dir, "image_difference")
12
+ @support_dir = File.join(@features_dir, "screenshots")
13
+ @source_dir = File.join(File.dirname(__FILE__), '..', 'features-skeleton')
14
+
15
+ if (ARGV.length == 0)
16
+ print_usage
17
+ else
18
+ cmd = ARGV.shift
19
+
20
+ if cmd == "help"
21
+ print_help
22
+ elsif cmd == "gen"
23
+ selenium_cucumber_scaffold
24
+ elsif cmd == "version"
25
+ puts Selenium::Cucumber::VERSION
26
+ else
27
+ print_usage
28
+ end
29
+ end
30
+
data/doc/canned_steps.md CHANGED
@@ -3,6 +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)
13
+
6
14
  ## Navigation Steps
7
15
 
8
16
  To open/close URL and to navigate between pages use following steps :
data/doc/installation.md CHANGED
@@ -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,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
data/example/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'selenium-cucumber'
4
+ # To run locally
5
+ # gem 'selenium-cucumber', path: 'your local repo path'
@@ -0,0 +1,36 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ builder (3.2.2)
5
+ childprocess (0.5.3)
6
+ ffi (~> 1.0, >= 1.0.11)
7
+ chunky_png (1.3.1)
8
+ cucumber (1.3.16)
9
+ builder (>= 2.1.2)
10
+ diff-lcs (>= 1.1.3)
11
+ gherkin (~> 2.12)
12
+ multi_json (>= 1.7.5, < 2.0)
13
+ multi_test (>= 0.1.1)
14
+ diff-lcs (1.2.5)
15
+ ffi (1.9.3)
16
+ gherkin (2.12.2)
17
+ multi_json (~> 1.3)
18
+ multi_json (1.10.1)
19
+ multi_test (0.1.1)
20
+ rubyzip (1.1.6)
21
+ selenium-cucumber (0.1.1)
22
+ chunky_png
23
+ cucumber
24
+ selenium-webdriver
25
+ selenium-webdriver (2.42.0)
26
+ childprocess (>= 0.5.0)
27
+ multi_json (~> 1.0)
28
+ rubyzip (~> 1.0)
29
+ websocket (~> 1.0.4)
30
+ websocket (1.0.7)
31
+
32
+ PLATFORMS
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ selenium-cucumber
@@ -109,20 +109,32 @@ Feature: Assertion Steps
109
109
  Then I should see alert text as "Press a button!"
110
110
  Then I accept alert
111
111
 
112
- Scenario: verify image by id and id
113
- Then actual image having id "img1" and expected image having id "img1" should be similar
112
+ Scenario: verify image by id and id - jpg image
113
+ Then actual image having id "img1" and expected image having id "img1" should be similar
114
114
 
115
- Scenario: verify image by xpath and xpath
116
- Then actual image having xpath ".//*[@id='img1']" and expected image having xpath ".//*[@id='img1']" should be similar
115
+ Scenario: verify image by id and image_name - jpg image
116
+ Then actual image having id "img1" and expected image having image_name "original_image.jpg" should be similar
117
117
 
118
- Scenario: verify image by id and image_name
119
- Then actual image having id "img1" and expected image having image_name "flower.png" should be similar
118
+ Scenario: verify image by url and image_name - jpg image
119
+ Then actual image having url "http://s27.postimg.org/xlqzpviyr/original_image.jpg" and expected image having image_name "original_image.jpg" should be similar
120
120
 
121
- Scenario: verify image by url and image_name
122
- Then actual image having url "http://shared.ooyala.com.s3.amazonaws.com/dropshadow-flower-pink.png" and expected image having image_name "flower.png" should be similar
121
+ Scenario: verify image by id and image_name - jpg image - negative test
122
+ Then actual image having id "img1_incorrect" and expected image having image_name "original_image.jpg" should be similar
123
123
 
124
- Scenario: verify image by id and image_name - negative test 1
125
- Then actual image having id "img1" and expected image having image_name "flower1.png" should be similar
124
+ Scenario: verify image by id and id - png image
125
+ Then actual image having id "img2" and expected image having id "img2" should be similar
126
+
127
+ Scenario: verify image by xpath and xpath - png image
128
+ Then actual image having xpath ".//*[@id='img2']" and expected image having xpath ".//*[@id='img2']" should be similar
129
+
130
+ Scenario: verify image by id and image_name - png image
131
+ Then actual image having id "img2" and expected image having image_name "logo-PNG.png" should be similar
132
+
133
+ Scenario: verify image by url and image_name - png image
134
+ Then actual image having url "http://s26.postimg.org/itpfqlcop/logo1.png" and expected image having image_name "logo-PNG.png" should be similar
135
+
136
+ Scenario: verify image by id and image_name - png image - negative test
137
+ Then actual image having id "img2_incorrect" and expected image having image_name "logo-PNG.png" should be similar
126
138
 
127
139
 
128
140
 
@@ -5,5 +5,4 @@ Feature: Configuration Printing Step
5
5
  Scenario: Print Configuration
6
6
 
7
7
  Given I print configuration
8
- Given I open test page
9
-
8
+ And I open test page
@@ -36,10 +36,10 @@ Feature: Navigation Steps
36
36
 
37
37
  Scenario: Hover over elelment
38
38
 
39
- Then I hover over element having xpath "html/body/fieldset[8]/p/a[1]"
39
+ Then I hover over element having id "pop_alert"
40
+ Then I accept alert
40
41
 
41
42
  Scenario: Interacting with browser
42
43
 
43
44
  Then I resize browser window size to width 400 and height 400
44
- Then I maximize browser window
45
- #Then I close browser
45
+ Then I maximize browser window
@@ -8,4 +8,8 @@ Feature: Screenshot Step
8
8
 
9
9
  Scenario: take screenshot
10
10
 
11
- Then I take screenshot
11
+ Then I take screenshot
12
+
13
+ Scenario: close browser
14
+
15
+ Then I close browser