dkdeploy-cucumber 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rubocop.yml +18 -0
  4. data/.travis.yml +15 -0
  5. data/CHANGELOG.md +12 -0
  6. data/CONTRIBUTORS.md +16 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE +7 -0
  9. data/README.md +57 -0
  10. data/Rakefile +1 -0
  11. data/assets/dkdeploy-logo.png +0 -0
  12. data/config/cucumber.yml +4 -0
  13. data/dkdeploy-cucumber.gemspec +35 -0
  14. data/features/click.feature +52 -0
  15. data/features/content.feature +95 -0
  16. data/features/form.feature +136 -0
  17. data/features/htdocs/click.html +18 -0
  18. data/features/htdocs/click1.html +20 -0
  19. data/features/htdocs/click2.html +10 -0
  20. data/features/htdocs/content.html +17 -0
  21. data/features/htdocs/content.json +3 -0
  22. data/features/htdocs/form.html +26 -0
  23. data/features/htdocs/misc.html +13 -0
  24. data/features/htdocs/url.html +10 -0
  25. data/features/misc.feature +18 -0
  26. data/features/support/env.rb +35 -0
  27. data/features/url.feature +28 -0
  28. data/lib/dkdeploy/cucumber.rb +1 -0
  29. data/lib/dkdeploy/cucumber/step_definitions/click_steps.rb +39 -0
  30. data/lib/dkdeploy/cucumber/step_definitions/content_steps.rb +88 -0
  31. data/lib/dkdeploy/cucumber/step_definitions/form_steps.rb +146 -0
  32. data/lib/dkdeploy/cucumber/step_definitions/images.rb +11 -0
  33. data/lib/dkdeploy/cucumber/step_definitions/misc_steps.rb +105 -0
  34. data/lib/dkdeploy/cucumber/step_definitions/url_steps.rb +31 -0
  35. data/lib/dkdeploy/cucumber/steps.rb +2 -0
  36. data/lib/dkdeploy/cucumber/support.rb +3 -0
  37. data/lib/dkdeploy/cucumber/support/path.rb +13 -0
  38. data/lib/dkdeploy/cucumber/support/selectors.rb +15 -0
  39. data/lib/dkdeploy/cucumber/support/with.rb +9 -0
  40. data/lib/dkdeploy/cucumber/version.rb +15 -0
  41. metadata +257 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7135d6e3e6154ea1750e7d6b204626c6423762a0
4
+ data.tar.gz: f2ecbe2f3042dd4800e54e2e64b7f2227b088767
5
+ SHA512:
6
+ metadata.gz: a0368ff4e44c97fcaf05d1edef2b282798386b3ea62adf5fa3d09135678be051903659a27c3cfab97c17bb31679657902e0b409a7ef3c934735de21190703bcc
7
+ data.tar.gz: 8356310b85611335244e5227b7ecfcd65ef803f990b93481d5e5cec77c6c1797230a2ead6a51fa2305984400439739625cb71c23b28e2bc724db1ec25ca6b527
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ InstalledFiles
7
+ _yardoc
8
+ coverage
9
+ doc/
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
17
+ .lock
18
+ Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,18 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'tmp/**/*'
4
+ - 'config/**/*'
5
+ - 'vendor/**/*'
6
+ TargetRubyVersion: 2.2
7
+ GlobalVars:
8
+ AllowedVariables: []
9
+ MethodLength:
10
+ Max: 25
11
+ LineLength:
12
+ Max: 200
13
+ SpecialGlobalVars:
14
+ Enabled: false
15
+ BracesAroundHashParameters:
16
+ Enabled: false
17
+ CyclomaticComplexity:
18
+ Max: 10
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.2
6
+ - 2.3.4
7
+ - 2.4.1
8
+
9
+ before_install:
10
+ - gem install bundler --no-document
11
+
12
+ script:
13
+ - bundle exec rubocop --display-cop-names --extra-details
14
+ - bundle exec cucumber
15
+ - bundle exec cucumber --profile negative
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## [4.0.0]- 2017-08-28
7
+ ### Summary
8
+
9
+ - first public release
10
+
11
+ [Unreleased]: https://github.com/dkdeploy/dkdeploy-cucumber/compare/master...develop
12
+ [4.0.0]: https://github.com/dkdeploy/dkdeploy-cucumber/releases/tag/v4.0.0
data/CONTRIBUTORS.md ADDED
@@ -0,0 +1,16 @@
1
+ # dkdeploy CONTRIBUTORS
2
+
3
+ The dkdeploy core maintainers would like to recognize following contributors (in alphabetic order):
4
+
5
+ - Sascha Egerer
6
+ - Christoph Gerold
7
+ - Johannes Goslar
8
+ - Kieran Hayes
9
+ - Wilfried Irßlinger
10
+ - Thomas Jahnke
11
+ - Gleb Levitin
12
+ - Luka Lüdicke
13
+ - Nicolai Reuschling
14
+ - Lars Tode
15
+ - Timo Webler
16
+ - Mike Zaschka
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dkdeploy-cucumber.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2014-2017 dkd Internet Service GmbH, Frankfurt am Main (Germany), https://dkd.de
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ ![dkdeploy](assets/dkdeploy-logo.png)
2
+
3
+ # Dkdeploy::Cucumber
4
+
5
+ [![Build Status](https://api.travis-ci.org/dkdeploy/dkdeploy-cucumber.svg?branch=develop)](https://travis-ci.org/repositories/dkdeploy/dkdeploy-cucumber)
6
+ [![Gem Version](https://badge.fury.io/rb/dkdeploy-cucumber.svg)](https://badge.fury.io/rb/dkdeploy-cucumber) [![Inline docs](http://inch-ci.org/github/dkdeploy/dkdeploy-cucumber.svg?branch=develop)](http://inch-ci.org/github/dkdeploy/dkdeploy-cucumber)
7
+
8
+ ## Description
9
+
10
+ This Rubygem `dkdeploy-cucumber` defines Cucumber steps for browser tests.
11
+ Tests are run with `capybara` and PhantomJS.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'dkdeploy-cucumber', '~> 4.0'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install dkdeploy-cucumber
26
+
27
+ ## Usage
28
+
29
+ You can see usage examples in the `features` directory.
30
+
31
+ ## Testing
32
+
33
+ ## Prerequisite
34
+
35
+ `rvm` to test against multiple Ruby versions.
36
+
37
+ ### Running tests
38
+
39
+ 1. Run `bundle exec rubocop`
40
+ 2. Run `bundle exec cucumber`
41
+ 3. Run `bundle exec cucumber --profile negative`
42
+
43
+ ### Running tests
44
+
45
+ 1. Checking coding styles (`rubocop`)
46
+ 2. Running Cucumber tests (`cucumber`)
47
+
48
+ ## Contributing
49
+
50
+ 1. Install [git flow](https://github.com/nvie/gitflow)
51
+ 2. If project is not checked out already do git clone `git@github.com:dkdeploy/dkdeploy-cucumber.git`
52
+ 3. Checkout origin develop branch (`git checkout --track -b develop origin/develop`)
53
+ 4. Git flow initialze `git flow init -d`
54
+ 5. Installing gems `bundle update`
55
+ 6. Create new feature branch (`git flow feature start my-new-feature`)
56
+ 7. Run tests (README.md Testing)
57
+ 8. Commit your changes (`git commit -am 'Add some feature'`)
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
Binary file
@@ -0,0 +1,4 @@
1
+ ---
2
+ default: --profile normal
3
+ normal: --tags ~@should_fail
4
+ negative: --tags @should_fail --wip # Run test that check correct negative outcomes
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'dkdeploy/cucumber/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'dkdeploy-cucumber'
9
+ spec.version = Dkdeploy::Cucumber::Version
10
+ spec.license = 'MIT'
11
+ spec.authors = ['Gleb Levitin', 'Timo Webler', 'Johannes Goslar', 'Luka Lüdicke']
12
+ spec.email = %w[gleb.levitin@dkd.de timo.webler@dkd.de johannes.goslar@dkd.de luka.luedicke@dkd.de]
13
+ spec.description = 'dkdeploy Cucumber step definitions'
14
+ spec.summary = 'Cucumber step definitions for browser tests'
15
+ spec.homepage = 'https://github.com/dkdeploy/dkdeploy-cucumber'
16
+ spec.required_ruby_version = '~> 2.2'
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rack', '~> 2.0'
26
+ spec.add_development_dependency 'rubocop', '~> 0.48.1'
27
+ spec.add_development_dependency 'rspec', '~> 3.6'
28
+ spec.add_development_dependency 'capybara', '~> 2.15.1'
29
+ spec.add_development_dependency 'phantomjs', '~> 2.1.1.0'
30
+ spec.add_development_dependency 'poltergeist', '~> 1.16.0'
31
+
32
+ spec.add_dependency 'cucumber', '~> 2.4'
33
+ spec.add_dependency 'rspec-expectations', '~> 3.6'
34
+ spec.add_dependency 'launchy', '~> 2.4.3'
35
+ end
@@ -0,0 +1,52 @@
1
+ Feature: Click
2
+ Background:
3
+ Given I am on "click.html"
4
+
5
+ Scenario: click button
6
+ Then I should not see "changed"
7
+ When I press "b1"
8
+ Then I should see "changed"
9
+
10
+ @should_fail
11
+ Scenario: click button fail
12
+ When I press "b3"
13
+
14
+ Scenario: click button within context
15
+ Then I should not see "changed2"
16
+ When I press "b2" within "#scope"
17
+ Then I should see "changed2"
18
+
19
+ @should_fail
20
+ Scenario: click button within context fail
21
+ When I press "b1" within "#wrong"
22
+
23
+ Scenario: click on element
24
+ Then I should not see "changed3"
25
+ When I click on element "#clickelement"
26
+ Then I should see "changed3"
27
+
28
+ @should_fail
29
+ Scenario: click on element fail
30
+ When I click on element "#clickelement123"
31
+
32
+ Scenario: follow link
33
+ Given I am on "click1.html"
34
+ Then I should not see "link2site"
35
+ When I follow "link"
36
+ Then I should see "link2site"
37
+
38
+ @should_fail
39
+ Scenario: follow link fail
40
+ Given I am on "click1.html"
41
+ When I follow "link123"
42
+
43
+ Scenario: click xpath
44
+ Given I am on "click1.html"
45
+ Then I should not see "link2site"
46
+ When I click xpath "/html/body/ul/li[2]/a"
47
+ Then I should see "link2site"
48
+
49
+ @should_fail
50
+ Scenario: click xpath fail
51
+ Given I am on "click1.html"
52
+ When I click xpath "/html/body/ul/li[5]/a"
@@ -0,0 +1,95 @@
1
+ Feature: Content Checks
2
+ Background:
3
+ Given I am on "content.html"
4
+
5
+ Scenario: see something
6
+ Then I should see "something"
7
+
8
+ @should_fail
9
+ Scenario: see something fail
10
+ Then I should see "otherthing"
11
+
12
+ Scenario: do not see something
13
+ Then I should not see "otherthing"
14
+
15
+ @should_fail
16
+ Scenario: do not see something fail
17
+ Then I should not see "something"
18
+
19
+ Scenario: see regexp
20
+ Then I should see /so.{2}th.ng/
21
+
22
+ @should_fail
23
+ Scenario: see regexp fail
24
+ Then I should see /so.{3}th.ng/
25
+
26
+ Scenario: not see regexp
27
+ Then I should not see /murks/
28
+
29
+ @should_fail
30
+ Scenario: not see regexp fail
31
+ Then I should not see /thing/
32
+
33
+ Scenario: Date
34
+ Then I should see a date within "#date"
35
+
36
+ @should_fail
37
+ Scenario: Date fail
38
+ Then I should see a date within "#falsedate"
39
+
40
+ Scenario: Visible
41
+ Then the element "#p1" should be visible
42
+
43
+ @should_fail
44
+ Scenario: Visible fail
45
+ Then the element "#p2" should be visible
46
+
47
+ Scenario: Invisible
48
+ Then the element "#p2" should not be visible
49
+
50
+ @should_fail
51
+ Scenario: Invisible fail
52
+ Then the element "#p1" should not be visible
53
+
54
+ Scenario: Hover
55
+ Then I should see "before" within "#p3"
56
+ When I hover over "#hover"
57
+ Then I should see "after" within "#p3"
58
+
59
+ @should_fail
60
+ Scenario: Hover fail
61
+ Then I should see "before" within "#p3"
62
+ When I hover over "#hover3"
63
+
64
+ Scenario: At least
65
+ Then I should have at least 6 "p" within "body"
66
+
67
+
68
+ Scenario: JSON content
69
+ Given I am on "content.json"
70
+ Then I should see JSON:
71
+ """
72
+ {
73
+ "test": 1
74
+ }
75
+ """
76
+
77
+ @should_fail
78
+ Scenario: JSON content fail
79
+ Given I am on "content.json"
80
+ Then I should see JSON:
81
+ """
82
+ {
83
+ "test": 2
84
+ }
85
+ """
86
+
87
+ Scenario: exact page title
88
+ Given I am on "content.html"
89
+ Then the page should have a title of "Empty html"
90
+
91
+ Scenario: page title matching regex
92
+ Given I am on "content.html"
93
+ Then the page title should match /Empty/
94
+ Then the page title should match /(\s){1}/
95
+ Then the page title should match /html/
@@ -0,0 +1,136 @@
1
+ Feature: Forms
2
+ Scenario: Single Fill
3
+ Given I am on "form.html"
4
+ Then "Timo" should be contained in field "developer"
5
+ When I fill in "Johnny" for "developer"
6
+ Then "Johnny" should be contained in field "developer"
7
+
8
+ @should_fail
9
+ Scenario: Single Fill fail
10
+ Given I am on "form.html"
11
+ Then "Timo" should be contained in field "developer"
12
+ When I fill in "Peter" for "developer"
13
+ Then "Johnny" should be contained in field "developer"
14
+
15
+ Scenario: Single Fill Exactly
16
+ Given I am on "form.html"
17
+ When I fill in "Johnny Timo" for "developer"
18
+ Then "Johnny" should not be equal to field "developer"
19
+ Then "Johnny Timo" should be equal to field "developer"
20
+
21
+ @should_fail
22
+ Scenario: Single Fill Exactly Fail
23
+ Given I am on "form.html"
24
+ When I fill in "Johnny Timo" for "developer"
25
+ Then "Johnny" should be equal to field "developer"
26
+
27
+ Scenario: Multi
28
+ Given I am on "form.html"
29
+ Then "Alex" should be contained in field "manager"
30
+ Then "Timo" should be contained in field "developer"
31
+ When I fill in the following:
32
+ | developer | Alex |
33
+ | manager | Johnny |
34
+ Then "Johnny" should be contained in field "manager"
35
+ Then "Alex" should be contained in field "developer"
36
+
37
+ @should_fail
38
+ Scenario: Multi fail
39
+ Given I am on "form.html"
40
+ When I fill in the following:
41
+ | developer_fail | Alex |
42
+ | manager_fail | Johnny |
43
+
44
+ Scenario: Select
45
+ Given I am on "form.html"
46
+ Then "value2" should be contained in field "selection"
47
+ When I select "Value 1" from "selection"
48
+ Then "value1" should be contained in field "selection"
49
+
50
+ @should_fail
51
+ Scenario: Select
52
+ Given I am on "form.html"
53
+ When I select "Value 3" from "selection"
54
+ Then "value1" should be contained in field "selection"
55
+
56
+ Scenario: Checkbox
57
+ Given I am on "form.html"
58
+ Then should not be checked "validation"
59
+ When I check "validation"
60
+ Then should be checked "validation"
61
+
62
+ @should_fail
63
+ Scenario: Checkbox fail
64
+ Given I am on "form.html"
65
+ When I check "validation_fail"
66
+
67
+ Scenario: Uncheck
68
+ Given I am on "form.html"
69
+ Then should not be checked "validation"
70
+ When I check "validation"
71
+ Then should be checked "validation"
72
+ When I uncheck "validation"
73
+ Then should not be checked "validation"
74
+
75
+ @should_fail
76
+ Scenario: Uncheck fail
77
+ Given I am on "form.html"
78
+ When I check "validation"
79
+ When I uncheck "validation2"
80
+
81
+ Scenario: Radio
82
+ Given I am on "form.html"
83
+ When I choose "radio1"
84
+ Then should be checked "radio1"
85
+ Then should not be checked "radio2"
86
+ When I choose "radio2"
87
+ Then should be checked "radio2"
88
+ Then should not be checked "radio1"
89
+
90
+ @should_fail
91
+ Scenario: Radio fail
92
+ Given I am on "form.html"
93
+ When I choose "radio1"
94
+ Then should be checked "radio2"
95
+
96
+ Scenario: File
97
+ Given I am on "form.html"
98
+ When I attach the file "features/htdocs/form.html" to "file1"
99
+ Then "C:\fakepath\form.html" should be equal to field "file1"
100
+
101
+ @should_fail
102
+ Scenario: File fail
103
+ Given I am on "form.html"
104
+ When I attach the file "features/htdocs/form.htm" to "file1"
105
+
106
+ Scenario: Blurer
107
+ Given I am on "form.html"
108
+ Then "before" should be contained in field "blurer"
109
+ When I leave the field "blurer"
110
+ Then "after" should be contained in field "blurer"
111
+
112
+ @should_fail
113
+ Scenario: Blurer fail
114
+ Given I am on "form.html"
115
+ When I leave the field "radio1"
116
+ Then "after" should be contained in field "blurer"
117
+
118
+ Scenario: Submit
119
+ Given I am on "form.html"
120
+ When I submit form "f1"
121
+ When I wait for 1 second
122
+ Then I should have the following query string:
123
+ | developer | Timo |
124
+ | manager | Alex |
125
+ | selection | value2 |
126
+
127
+ @should_fail
128
+ Scenario: Submit fail
129
+ Given I am on "form.html"
130
+ When I choose "radio1"
131
+ When I submit form "f1"
132
+ When I wait for 1 second
133
+ Then I should have the following query string:
134
+ | developer | Timo |
135
+ | manager | Alex |
136
+ | selection | value2 |