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.
- checksums.yaml +4 -4
- data/bin/generate.rb +20 -20
- data/bin/helper.rb +50 -50
- data/bin/selenium-cucumber +30 -29
- data/doc/canned_steps.md +8 -0
- data/doc/installation.md +16 -16
- data/doc/selenium-cucumber-help.md +18 -18
- data/example/Gemfile +5 -0
- data/example/Gemfile.lock +36 -0
- data/{Example/image_difference → example/features/actual_images}/test.png +0 -0
- data/{Example → example}/features/assertion_steps_Ex.feature +22 -10
- data/{Example → example}/features/click_steps_Ex.feature +0 -0
- data/{Example → example}/features/configuration_step_Ex.feature +1 -2
- data/example/features/expected_images/logo-PNG.png +0 -0
- data/example/features/expected_images/original_image.jpg +0 -0
- data/{Example/screenshots → example/features/image_difference}/test.png +0 -0
- data/{Example → example}/features/input_steps_Ex.feature +0 -0
- data/{Example → example}/features/javascript_steps_Ex.feature +0 -0
- data/{Example → example}/features/navigation_steps_Ex.feature +3 -3
- data/{Example → example}/features/progress_step_Ex.feature +0 -0
- data/{Example → example}/features/screenshot_step_Ex.feature +5 -1
- data/example/features/screenshots/test.png +0 -0
- data/{Example → example}/features/step_definitions/custom_steps.rb +0 -0
- data/{Example → example}/features/support/env.rb +0 -1
- data/{Example → example}/features/support/hooks.rb +0 -0
- data/example/run_features.rb +42 -0
- data/example/test_page.html +218 -0
- data/features-skeleton/actual_images/test.png +0 -0
- data/features-skeleton/my_first.feature +5 -5
- data/features-skeleton/step_definitions/custom_steps.rb +4 -4
- data/features-skeleton/support/env.rb +38 -38
- data/features-skeleton/support/hooks.rb +37 -33
- data/lib/selenium-cucumber.rb +2 -2
- data/lib/selenium-cucumber/assertion_steps.rb +25 -27
- data/lib/selenium-cucumber/click_elements_steps.rb +9 -12
- data/lib/selenium-cucumber/configuration_steps.rb +3 -4
- data/lib/selenium-cucumber/input_steps.rb +26 -26
- data/lib/selenium-cucumber/javascript_handling_steps.rb +3 -3
- data/lib/selenium-cucumber/methods/assertion_methods.rb +197 -160
- data/lib/selenium-cucumber/methods/click_elements_methods.rb +8 -8
- data/lib/selenium-cucumber/methods/configuration_methods.rb +10 -5
- data/lib/selenium-cucumber/methods/input_methods.rb +32 -45
- data/lib/selenium-cucumber/methods/javascript_handling_methods.rb +7 -7
- data/lib/selenium-cucumber/methods/misc_methods.rb +6 -6
- data/lib/selenium-cucumber/methods/navigate_methods.rb +37 -41
- data/lib/selenium-cucumber/methods/progress_methods.rb +8 -8
- data/lib/selenium-cucumber/methods/required_files.rb +1 -1
- data/lib/selenium-cucumber/methods/screenshot_methods.rb +3 -3
- data/lib/selenium-cucumber/navigation_steps.rb +20 -22
- data/lib/selenium-cucumber/progress_steps.rb +5 -8
- data/lib/selenium-cucumber/screenshot_steps.rb +2 -2
- data/lib/selenium-cucumber/version.rb +1 -1
- metadata +23 -27
- data/Example/expected_images/flower.png +0 -0
- data/Example/expected_images/flower1.png +0 -0
- data/Example/features/new.feature +0 -7
- data/Example/image_difference/difference_20140814210820942.png +0 -0
- data/Example/image_difference/difference_20140815095331224.png +0 -0
- data/Example/image_difference/difference_20140815100021133.png +0 -0
- data/Example/image_difference/difference_20140815100348774.png +0 -0
- data/Example/run_features.rb +0 -42
- data/Example/screenshots/screenshot20140815095553337.png +0 -0
- data/Example/screenshots/screenshot20140815100120197.png +0 -0
- data/Example/screenshots/screenshot20140815100446914.png +0 -0
- data/Example/test_page.html +0 -206
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fafe2faa8ccac6664b653cc839e147012a36fed
|
4
|
+
data.tar.gz: 70a7cfc8e999dbfbaeaf305a5bd2b19c2e1dca5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/bin/selenium-cucumber
CHANGED
@@ -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, "
|
11
|
-
@support_dir = File.join(@features_dir, "
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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,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
|
File without changes
|
@@ -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
|
-
|
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
|
116
|
-
|
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
|
119
|
-
Then actual image having
|
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
|
122
|
-
|
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
|
125
|
-
Then actual image having id "
|
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
|
|
File without changes
|
Binary file
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
@@ -36,10 +36,10 @@ Feature: Navigation Steps
|
|
36
36
|
|
37
37
|
Scenario: Hover over elelment
|
38
38
|
|
39
|
-
Then I hover over element having
|
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
|
File without changes
|