spreewald 2.3.0 → 2.7.0
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.
- checksums.yaml +5 -5
- data/.gitignore +1 -1
- data/.travis.yml +14 -15
- data/CHANGELOG.md +33 -4
- data/Gemfile +1 -2
- data/Gemfile.lock +1 -16
- data/Gemfile.ruby266 +9 -0
- data/Gemfile.ruby266.lock +65 -0
- data/README.md +86 -12
- data/Rakefile +22 -7
- data/examples/paths.rb +36 -0
- data/examples/selectors.rb +28 -0
- data/lib/spreewald/all_steps.rb +4 -1
- data/lib/spreewald/browser_tab_steps.rb +91 -0
- data/lib/spreewald/development_steps.rb +1 -1
- data/lib/spreewald/email_steps.rb +11 -4
- data/lib/spreewald/session_steps.rb +18 -0
- data/lib/spreewald/time_steps.rb +102 -0
- data/lib/spreewald/timecop_steps.rb +6 -76
- data/lib/spreewald/web_steps.rb +7 -15
- data/lib/spreewald_support/driver_info.rb +8 -0
- data/lib/spreewald_support/tolerance_for_selenium_sync_issues.rb +9 -3
- data/lib/spreewald_support/version.rb +1 -1
- data/support/step_definition.rb +1 -1
- data/support/step_definition_file.rb +2 -0
- data/tests/rails-3_capybara-1/Gemfile +2 -1
- data/tests/rails-3_capybara-1/Gemfile.lock +3 -1
- data/tests/rails-3_capybara-1/app +1 -1
- data/tests/rails-3_capybara-1/config/cucumber.yml +1 -1
- data/tests/rails-3_capybara-1/config/database.yml +1 -1
- data/tests/rails-3_capybara-1/config/routes.rb +1 -0
- data/tests/rails-3_capybara-1/db +1 -1
- data/tests/rails-3_capybara-1/features/shared +1 -1
- data/tests/rails-3_capybara-1/features/support/paths.rb +1 -1
- data/tests/rails-3_capybara-1/features/support/selectors.rb +1 -1
- data/tests/rails-3_capybara-1/public +1 -1
- data/tests/rails-3_capybara-2/Gemfile +2 -1
- data/tests/rails-3_capybara-2/Gemfile.lock +3 -1
- data/tests/rails-3_capybara-2/Rakefile +1 -1
- data/tests/rails-3_capybara-2/app +1 -1
- data/tests/rails-3_capybara-2/config +1 -1
- data/tests/rails-3_capybara-2/config.ru +1 -1
- data/tests/rails-3_capybara-2/db +1 -1
- data/tests/rails-3_capybara-2/features +1 -1
- data/tests/rails-3_capybara-2/public +1 -1
- data/tests/rails-3_capybara-2/script +1 -1
- data/tests/rails-4_capybara-3/Gemfile +1 -1
- data/tests/rails-4_capybara-3/Gemfile.lock +3 -3
- data/tests/rails-4_capybara-3/app +1 -1
- data/tests/rails-4_capybara-3/config/routes.rb +1 -0
- data/tests/rails-4_capybara-3/db +1 -1
- data/tests/rails-4_capybara-3/features/browser_tab_steps.feature +1 -0
- data/tests/rails-4_capybara-3/features/development_steps.feature +1 -1
- data/tests/rails-4_capybara-3/features/email_steps.feature +1 -1
- data/tests/rails-4_capybara-3/features/overriding.feature +1 -1
- data/tests/rails-4_capybara-3/features/session_steps.feature +1 -0
- data/tests/rails-4_capybara-3/features/step_definitions/overriding_steps.rb +1 -1
- data/tests/rails-4_capybara-3/features/step_definitions/test_steps.rb +1 -1
- data/tests/rails-4_capybara-3/features/support/paths.rb +1 -1
- data/tests/rails-4_capybara-3/features/support/selectors.rb +1 -1
- data/tests/rails-4_capybara-3/features/table_steps.feature +1 -1
- data/tests/rails-4_capybara-3/features/time_steps.feature +1 -0
- data/tests/rails-4_capybara-3/features/web_steps.feature +1 -1
- data/tests/rails-4_capybara-3/public/fixture_files +1 -1
- data/tests/rails-6_capybara-3/.ruby-version +1 -0
- data/tests/rails-6_capybara-3/Gemfile +25 -0
- data/tests/rails-6_capybara-3/Gemfile.lock +264 -0
- data/tests/rails-6_capybara-3/README.md +24 -0
- data/tests/rails-6_capybara-3/Rakefile +6 -0
- data/tests/rails-6_capybara-3/app/controllers +1 -0
- data/tests/rails-6_capybara-3/app/mailers/application_mailer.rb +4 -0
- data/tests/rails-6_capybara-3/app/mailers/spreewald_mailer.rb +30 -0
- data/tests/rails-6_capybara-3/app/models/application_record.rb +3 -0
- data/tests/rails-6_capybara-3/app/views +1 -0
- data/tests/rails-6_capybara-3/bin/bundle +114 -0
- data/tests/rails-6_capybara-3/bin/rails +4 -0
- data/tests/rails-6_capybara-3/bin/rake +4 -0
- data/tests/rails-6_capybara-3/bin/setup +33 -0
- data/tests/rails-6_capybara-3/config.ru +5 -0
- data/tests/rails-6_capybara-3/config/application.rb +35 -0
- data/tests/rails-6_capybara-3/config/boot.rb +3 -0
- data/tests/rails-6_capybara-3/config/cucumber.yml +9 -0
- data/tests/rails-6_capybara-3/config/database.yml +25 -0
- data/tests/rails-6_capybara-3/config/environment.rb +5 -0
- data/tests/rails-6_capybara-3/config/environments/development.rb +48 -0
- data/tests/rails-6_capybara-3/config/environments/test.rb +45 -0
- data/tests/rails-6_capybara-3/config/initializers/application_controller_renderer.rb +8 -0
- data/tests/rails-6_capybara-3/config/initializers/backtrace_silencers.rb +7 -0
- data/tests/rails-6_capybara-3/config/initializers/content_security_policy.rb +28 -0
- data/tests/rails-6_capybara-3/config/initializers/cookies_serializer.rb +5 -0
- data/tests/rails-6_capybara-3/config/initializers/filter_parameter_logging.rb +4 -0
- data/tests/rails-6_capybara-3/config/initializers/inflections.rb +16 -0
- data/tests/rails-6_capybara-3/config/initializers/mime_types.rb +4 -0
- data/tests/rails-6_capybara-3/config/initializers/wrap_parameters.rb +14 -0
- data/tests/rails-6_capybara-3/config/locales/en.yml +33 -0
- data/tests/rails-6_capybara-3/config/routes.rb +1 -0
- data/tests/rails-6_capybara-3/db +1 -0
- data/tests/rails-6_capybara-3/features/browser_tab_steps.feature +1 -0
- data/tests/rails-6_capybara-3/features/development_steps.feature +1 -0
- data/tests/rails-6_capybara-3/features/email_steps.feature +1 -0
- data/tests/rails-6_capybara-3/features/overriding.feature +1 -0
- data/tests/rails-6_capybara-3/features/session_steps.feature +1 -0
- data/tests/{shared/app/views/emails/send_email.haml → rails-6_capybara-3/features/step_definitions/.gitkeep} +0 -0
- data/tests/rails-6_capybara-3/features/step_definitions/overriding_steps.rb +1 -0
- data/tests/rails-6_capybara-3/features/step_definitions/test_steps.rb +1 -0
- data/tests/rails-6_capybara-3/features/support/env.rb +66 -0
- data/tests/rails-6_capybara-3/features/support/paths.rb +1 -0
- data/tests/rails-6_capybara-3/features/support/selectors.rb +1 -0
- data/tests/rails-6_capybara-3/features/support/selenium.rb +3 -0
- data/tests/rails-6_capybara-3/features/table_steps.feature +1 -0
- data/tests/rails-6_capybara-3/features/time_steps.feature +1 -0
- data/tests/rails-6_capybara-3/features/web_steps.feature +1 -0
- data/tests/{shared/db/migrate/.gitignore → rails-6_capybara-3/lib/tasks/.keep} +0 -0
- data/tests/rails-6_capybara-3/lib/tasks/cucumber.rake +76 -0
- data/tests/rails-6_capybara-3/log/.keep +0 -0
- data/tests/rails-6_capybara-3/public/404.html +67 -0
- data/tests/rails-6_capybara-3/public/422.html +67 -0
- data/tests/rails-6_capybara-3/public/500.html +66 -0
- data/tests/rails-6_capybara-3/public/favicon.ico +0 -0
- data/tests/rails-6_capybara-3/public/fixture_files +1 -0
- data/tests/rails-6_capybara-3/script/cucumber +11 -0
- data/tests/shared/app/controllers/application_controller.rb +9 -0
- data/tests/shared/app/controllers/authenticated_controller.rb +10 -2
- data/tests/shared/app/controllers/emails_controller.rb +25 -7
- data/tests/shared/app/controllers/forms_controller.rb +3 -0
- data/tests/shared/app/controllers/static_pages_controller.rb +23 -0
- data/tests/shared/app/models/mailer.rb +16 -0
- data/tests/shared/app/views/layouts/mailer.html.erb +13 -0
- data/tests/shared/app/views/layouts/mailer.text.erb +1 -0
- data/tests/shared/app/views/mailer/{email.haml → email.text.erb} +0 -0
- data/tests/shared/app/views/mailer/html_email_with_links.haml +6 -0
- data/tests/shared/app/views/mailer/text_email_with_links.text.erb +6 -0
- data/tests/shared/app/views/spreewald_mailer +1 -0
- data/tests/shared/app/views/static_pages/session_1.haml +1 -0
- data/tests/shared/app/views/static_pages/session_2.haml +1 -0
- data/tests/shared/app/views/static_pages/session_3.haml +1 -0
- data/tests/shared/app/views/static_pages/tab_1.haml +3 -0
- data/tests/shared/app/views/static_pages/tab_2.haml +2 -0
- data/tests/shared/app/views/static_pages/tab_3.haml +1 -0
- data/tests/shared/app/views/static_pages/time.html.haml +2 -0
- data/tests/shared/app/views/static_pages/visibility.html.haml +8 -1
- data/tests/shared/app/views/static_pages/within.html.haml +3 -0
- data/tests/shared/config/routes.rb +40 -0
- data/tests/shared/db/migrate/.keep +0 -0
- data/tests/shared/features/shared/browser_tab_steps.feature +103 -0
- data/tests/shared/features/shared/email_steps.feature +18 -0
- data/tests/shared/features/shared/session_steps.feature +29 -0
- data/tests/shared/features/shared/time_steps.feature +31 -0
- data/tests/shared/features/shared/web_steps.feature +17 -0
- metadata +166 -12
- data/tests/rails-3_capybara-1/config/routes.rb +0 -5
- data/tests/rails-4_capybara-3/.gitignore +0 -17
- data/tests/rails-4_capybara-3/config/routes.rb +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 02a43b32f16090f64a87cea6adc814baaceb590ef8388863224620f782565e25
|
|
4
|
+
data.tar.gz: d474b73278a9b3c309c0898e83e1238715012f38cce70e3d8d13d77f9bcd8680
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c8c2ca98760710ddbda7a2aca39ec3208a1a01ab57e842a448dd14d5b3ba969834d6dc08638440e6979140f2fa22ef2ee152276ae2ae19363ef7294cad213cf5
|
|
7
|
+
data.tar.gz: 9eea3e603ab1e9cb5d3346c948f09ee3b8c4bbfdd811b76eef3a0fc778c3015c48a85f97c31d6be8833f94e22d2d4ed159ab374b1aa345f51ffeba7d0f5fa23e
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
|
@@ -6,25 +6,24 @@ language: ruby
|
|
|
6
6
|
rvm:
|
|
7
7
|
- 2.1.8
|
|
8
8
|
- 2.4.5
|
|
9
|
-
|
|
10
|
-
gemfile:
|
|
11
|
-
# Test projects
|
|
12
|
-
- tests/rails-3_capybara-1/Gemfile
|
|
13
|
-
- tests/rails-3_capybara-2/Gemfile
|
|
14
|
-
- tests/rails-4_capybara-3/Gemfile
|
|
15
|
-
# Used to run rspec and tests for spreewald binary:
|
|
16
|
-
- Gemfile.ruby218
|
|
17
|
-
- Gemfile.ruby245
|
|
9
|
+
- 2.6.6
|
|
18
10
|
|
|
19
11
|
matrix:
|
|
20
|
-
|
|
12
|
+
include:
|
|
13
|
+
# Test projects
|
|
21
14
|
- gemfile: tests/rails-3_capybara-1/Gemfile
|
|
22
|
-
rvm: 2.
|
|
15
|
+
rvm: 2.1.8
|
|
23
16
|
- gemfile: tests/rails-3_capybara-2/Gemfile
|
|
24
|
-
rvm: 2.4.5
|
|
25
|
-
- gemfile: tests/rails-4_capybara-3/Gemfile
|
|
26
17
|
rvm: 2.1.8
|
|
27
|
-
- gemfile: Gemfile
|
|
18
|
+
- gemfile: tests/rails-4_capybara-3/Gemfile
|
|
28
19
|
rvm: 2.4.5
|
|
29
|
-
- gemfile: Gemfile
|
|
20
|
+
- gemfile: tests/rails-6_capybara-3/Gemfile
|
|
21
|
+
rvm: 2.6.6
|
|
22
|
+
# Used to run rspec and tests for spreewald binary:
|
|
23
|
+
- gemfile: Gemfile.ruby218
|
|
30
24
|
rvm: 2.1.8
|
|
25
|
+
- gemfile: Gemfile.ruby245
|
|
26
|
+
rvm: 2.4.5
|
|
27
|
+
- gemfile: Gemfile.ruby266
|
|
28
|
+
rvm: 2.6.6
|
|
29
|
+
|
data/CHANGELOG.md
CHANGED
|
@@ -3,14 +3,43 @@ All notable changes to this project will be documented in this file.
|
|
|
3
3
|
|
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
5
5
|
|
|
6
|
+
## 2.7.0
|
|
7
|
+
- Add a step modifier to control different Capybara sessions: `... in the browser session "..."`. (see issue [#66](https://github.com/makandra/spreewald/issues/66))
|
|
8
|
+
|
|
9
|
+
## 2.6.0
|
|
10
|
+
- The time steps do now work with the time helpers in ActiveSupport 4.1+ if the timecop gem is not included in the bundle. Please note that the two approaches branch. While ActiveSupport will freeze the time, Timecop will keep it running.
|
|
11
|
+
- The steps in the file `spreewald/timecop.rb` file were moved to `spreewald/time.rb` and importing `spreewald/timecop` directly is deprecated now.
|
|
12
|
+
|
|
13
|
+
## 2.5.0
|
|
14
|
+
- Add a set of steps to control browser tabs (Selenium only):
|
|
15
|
+
* `I open ... in a new browser tab`
|
|
16
|
+
* `I close the browser tab`
|
|
17
|
+
* `I switch to the new browser tab`
|
|
18
|
+
* `I switch to the previous browser tab`
|
|
19
|
+
* `I may open a new browser tab` (required for the following step)
|
|
20
|
+
* `I should( not)? have opened a new browser tab`
|
|
21
|
+
* `there should be (\d+) browser tabs?`
|
|
22
|
+
* `there should be at least (\d+) browser tabs?`
|
|
23
|
+
|
|
24
|
+
## 2.4.2
|
|
25
|
+
- Fix the step `I should( not)? see a link labeled "STRING"`, it is now overridable.
|
|
26
|
+
|
|
27
|
+
## 2.4.1
|
|
28
|
+
|
|
29
|
+
- Adapt `I should get a download with filename "..."` step to also work if the `filename` is not the last attribute in `Content-Disposition` header.
|
|
30
|
+
|
|
31
|
+
## 2.4.0
|
|
32
|
+
|
|
33
|
+
- Fix "I follow the ... link in the email" step for HTML e-mails to only follow URLs from `<a href="...">` links.
|
|
34
|
+
|
|
6
35
|
## 2.3.0
|
|
7
36
|
- Deprecate two steps:
|
|
8
|
-
- (Given) the file ... was attached to the ... above
|
|
9
|
-
- (Then) debugger
|
|
37
|
+
- (Given) the file ... was attached to the ... above
|
|
38
|
+
- (Then) debugger
|
|
10
39
|
|
|
11
40
|
## 2.2.4
|
|
12
41
|
- Fix "..." field should have the error "..." test by removing old should syntax
|
|
13
|
-
- Add single-line mail step to
|
|
42
|
+
- Add single-line mail step to README
|
|
14
43
|
|
|
15
44
|
## 2.2.3
|
|
16
45
|
- Fix 'the window should be titled' step - closes: [#102](https://github.com/makandra/spreewald/issues/102)
|
|
@@ -30,7 +59,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
|
30
59
|
|
|
31
60
|
## 2.2.0
|
|
32
61
|
- Add a new step `I should( not)? see a link labeled "STRING"`.
|
|
33
|
-
- Refer to Capybara 3's new flag `Capybara.default_normalize_ws = true` in the
|
|
62
|
+
- Refer to Capybara 3's new flag `Capybara.default_normalize_ws = true` in the README,
|
|
34
63
|
|
|
35
64
|
## 2.1.3
|
|
36
65
|
The `I should(not )? see /REGEXP/` step no longer refuses slashes as part of the regular expression. You can thus match full domains and more.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
gemika (0.3.4)
|
|
4
|
+
gemika (0.4.0)
|
|
6
5
|
rake (12.3.2)
|
|
7
|
-
rspec (3.8.0)
|
|
8
|
-
rspec-core (~> 3.8.0)
|
|
9
|
-
rspec-expectations (~> 3.8.0)
|
|
10
|
-
rspec-mocks (~> 3.8.0)
|
|
11
|
-
rspec-core (3.8.0)
|
|
12
|
-
rspec-support (~> 3.8.0)
|
|
13
|
-
rspec-expectations (3.8.3)
|
|
14
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
15
|
-
rspec-support (~> 3.8.0)
|
|
16
|
-
rspec-mocks (3.8.0)
|
|
17
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
18
|
-
rspec-support (~> 3.8.0)
|
|
19
|
-
rspec-support (3.8.0)
|
|
20
6
|
|
|
21
7
|
PLATFORMS
|
|
22
8
|
ruby
|
|
@@ -24,7 +10,6 @@ PLATFORMS
|
|
|
24
10
|
DEPENDENCIES
|
|
25
11
|
gemika
|
|
26
12
|
rake
|
|
27
|
-
rspec (>= 2.14.0)
|
|
28
13
|
|
|
29
14
|
BUNDLED WITH
|
|
30
15
|
1.17.3
|
data/Gemfile.ruby266
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
aruba (1.0.0)
|
|
5
|
+
childprocess (~> 3.0)
|
|
6
|
+
contracts (~> 0.16.0)
|
|
7
|
+
cucumber (>= 2.4, < 4.0)
|
|
8
|
+
ffi (~> 1.9)
|
|
9
|
+
rspec-expectations (~> 3.4)
|
|
10
|
+
thor (~> 1.0)
|
|
11
|
+
backports (3.17.0)
|
|
12
|
+
builder (3.2.4)
|
|
13
|
+
childprocess (3.0.0)
|
|
14
|
+
contracts (0.16.0)
|
|
15
|
+
cucumber (3.1.2)
|
|
16
|
+
builder (>= 2.1.2)
|
|
17
|
+
cucumber-core (~> 3.2.0)
|
|
18
|
+
cucumber-expressions (~> 6.0.1)
|
|
19
|
+
cucumber-wire (~> 0.0.1)
|
|
20
|
+
diff-lcs (~> 1.3)
|
|
21
|
+
gherkin (~> 5.1.0)
|
|
22
|
+
multi_json (>= 1.7.5, < 2.0)
|
|
23
|
+
multi_test (>= 0.1.2)
|
|
24
|
+
cucumber-core (3.2.1)
|
|
25
|
+
backports (>= 3.8.0)
|
|
26
|
+
cucumber-tag_expressions (~> 1.1.0)
|
|
27
|
+
gherkin (~> 5.0)
|
|
28
|
+
cucumber-expressions (6.0.1)
|
|
29
|
+
cucumber-tag_expressions (1.1.1)
|
|
30
|
+
cucumber-wire (0.0.1)
|
|
31
|
+
diff-lcs (1.3)
|
|
32
|
+
ffi (1.12.2)
|
|
33
|
+
gemika (0.4.0)
|
|
34
|
+
gherkin (5.1.0)
|
|
35
|
+
multi_json (1.14.1)
|
|
36
|
+
multi_test (0.1.2)
|
|
37
|
+
rspec (3.9.0)
|
|
38
|
+
rspec-core (~> 3.9.0)
|
|
39
|
+
rspec-expectations (~> 3.9.0)
|
|
40
|
+
rspec-mocks (~> 3.9.0)
|
|
41
|
+
rspec-core (3.9.1)
|
|
42
|
+
rspec-support (~> 3.9.1)
|
|
43
|
+
rspec-expectations (3.9.1)
|
|
44
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
45
|
+
rspec-support (~> 3.9.0)
|
|
46
|
+
rspec-mocks (3.9.1)
|
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
48
|
+
rspec-support (~> 3.9.0)
|
|
49
|
+
rspec-support (3.9.2)
|
|
50
|
+
thor (1.0.1)
|
|
51
|
+
|
|
52
|
+
PLATFORMS
|
|
53
|
+
ruby
|
|
54
|
+
|
|
55
|
+
DEPENDENCIES
|
|
56
|
+
aruba
|
|
57
|
+
cucumber
|
|
58
|
+
gemika
|
|
59
|
+
rspec
|
|
60
|
+
|
|
61
|
+
RUBY VERSION
|
|
62
|
+
ruby 2.6.6p146
|
|
63
|
+
|
|
64
|
+
BUNDLED WITH
|
|
65
|
+
2.1.4
|
data/README.md
CHANGED
|
@@ -38,6 +38,7 @@ single files like this:
|
|
|
38
38
|
require 'spreewald/email_steps'
|
|
39
39
|
require 'spreewald/web_steps'
|
|
40
40
|
|
|
41
|
+
Have a look at our [recommended Capybara defaults](#recommended-capybara-defaults) as they impact the behavior of many Spreewald steps.
|
|
41
42
|
|
|
42
43
|
## Spreewald binary
|
|
43
44
|
|
|
@@ -83,7 +84,7 @@ More info [here](https://makandracards.com/makandra/12139-waiting-for-page-load-
|
|
|
83
84
|
Thanks to [cucumber_priority](https://github.com/makandra/cucumber_priority) you can override any step definition from Spreewald with your own pattern. Cucumber will not raise `Cucumber::Ambiguous` if your custom steps collide with a Spreewald step.
|
|
84
85
|
|
|
85
86
|
|
|
86
|
-
##
|
|
87
|
+
## Recommended Capybara defaults
|
|
87
88
|
|
|
88
89
|
If you are upgrading from Capybara 2 to Capybara 3, you might [see failing tests](https://github.com/makandra/spreewald/issues/95) with Spreewald steps like `I should see`. This is caused by a breaking change in [Capybara's Finders](https://www.rubydoc.info/github/jnicklas/capybara/Capybara/Node/Finders) that accept a `:text` option. To activate Capybara 2 behavior globally in your project, enable this flag:
|
|
89
90
|
|
|
@@ -93,6 +94,17 @@ Capybara.default_normalize_ws = true
|
|
|
93
94
|
|
|
94
95
|
This will affect all Spreewald steps that are using Capybara's `:text` option.
|
|
95
96
|
|
|
97
|
+
Furthermore, we recommend setting [Capybara's matching strategy](https://github.com/teamcapybara/capybara/blob/master/README.md#strategy) to `:prefer_exact`. This will positively affect Spreewald steps as it prevents the `Capybara::Ambiguous` error in the edge case when two fields are matching the given name, but one of the matches includes the name only as a substring,
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
Capybara.match = :prefer_exact
|
|
101
|
+
````
|
|
102
|
+
|
|
103
|
+
If you want Spreewald to match fields, links and buttons against the `aria-label` attribute, enable the following global configuration in Capybara 2.8+:
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
Capybara.enable_aria_label = true
|
|
107
|
+
```
|
|
96
108
|
|
|
97
109
|
## Contributing
|
|
98
110
|
|
|
@@ -127,6 +139,54 @@ the step definitions.
|
|
|
127
139
|
|
|
128
140
|
## Steps
|
|
129
141
|
|
|
142
|
+
### browser_tab_steps.rb
|
|
143
|
+
|
|
144
|
+
* **When I open ... in a new browser tab**
|
|
145
|
+
|
|
146
|
+
Opens [the page](https://github.com/makandra/spreewald/blob/master/examples/paths.rb) in a new browser tab and switches to it.
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
* **When I close the browser tab**
|
|
150
|
+
|
|
151
|
+
Closes the current browser tab and switches back to the first tab.
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
* **When I switch to the new(ly opened)? browser tab**
|
|
155
|
+
|
|
156
|
+
Waits for the new browser tab to appear, then switches to it.
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
* **When I switch( back)? to the previous browser tab**
|
|
160
|
+
|
|
161
|
+
Changes the browser context to the second-last browser tab.
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
* **When I may open a new browser tab**
|
|
165
|
+
|
|
166
|
+
Required for the check whether a new browser tab was opened or not.
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
* **Then I should( not)? have opened a new browser tab**
|
|
170
|
+
|
|
171
|
+
Example (positive expectation):
|
|
172
|
+
|
|
173
|
+
When I may open a new browser tab
|
|
174
|
+
And I click on "Open link in new browser tab"
|
|
175
|
+
Then I should have opened a new browser tab
|
|
176
|
+
|
|
177
|
+
Example (negative expectation):
|
|
178
|
+
|
|
179
|
+
When I may open a new browser tab
|
|
180
|
+
And I click on "Open link in current browser tab"
|
|
181
|
+
Then I should not have opened a new browser tab
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
* **Then there should be (\d+) browser tabs?**
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
* **Then there should be at least (\d+) browser tabs?**
|
|
188
|
+
|
|
189
|
+
|
|
130
190
|
### development_steps.rb
|
|
131
191
|
|
|
132
192
|
* **Then it should work...?**
|
|
@@ -141,14 +201,14 @@ the step definitions.
|
|
|
141
201
|
for its job)
|
|
142
202
|
|
|
143
203
|
|
|
144
|
-
* **AfterStep @slow**
|
|
204
|
+
* **AfterStep @slow-motion**
|
|
145
205
|
|
|
146
206
|
Waits 2 seconds after each step
|
|
147
207
|
|
|
148
208
|
|
|
149
|
-
* **AfterStep @single**
|
|
209
|
+
* **AfterStep @single-step**
|
|
150
210
|
|
|
151
|
-
Waits for keypress after each step
|
|
211
|
+
Waits for a keypress after each step
|
|
152
212
|
|
|
153
213
|
|
|
154
214
|
### email_steps.rb
|
|
@@ -226,6 +286,18 @@ the step definitions.
|
|
|
226
286
|
This step is deprecated and will be removed from spreewald. If you still want to use it, copy the code to your project's own steps.
|
|
227
287
|
|
|
228
288
|
|
|
289
|
+
### session_steps.rb
|
|
290
|
+
|
|
291
|
+
* **When ... in the browser session "..."**
|
|
292
|
+
|
|
293
|
+
You can append `in the browser session "name"` to any other step to execute
|
|
294
|
+
the step in a different browser session.
|
|
295
|
+
|
|
296
|
+
You may need to update other steps to allow multiple sessions (e.g. your
|
|
297
|
+
authentication steps have to support multiple logged in users).
|
|
298
|
+
More details [here](https://makandracards.com/makandra/474480-how-to-make-a-cucumber-test-work-with-multiple-browser-sessions).
|
|
299
|
+
|
|
300
|
+
|
|
229
301
|
### table_steps.rb
|
|
230
302
|
|
|
231
303
|
* **Then I should( not)? see a table with (exactly )?the following rows( in any order)?:?**
|
|
@@ -235,11 +307,14 @@ the step definitions.
|
|
|
235
307
|
See [this article](https://makandracards.com/makandra/763-cucumber-step-to-match-table-rows-with-capybara) for details.
|
|
236
308
|
|
|
237
309
|
|
|
238
|
-
###
|
|
310
|
+
### time_steps.rb
|
|
239
311
|
|
|
240
|
-
Steps to travel through time
|
|
312
|
+
Steps to travel through time
|
|
241
313
|
|
|
242
|
-
|
|
314
|
+
This uses [Timecop](https://github.com/jtrupiano/timecop) or Active Support 4.1+ to stub Time.now / Time.current.
|
|
315
|
+
The user is responsible for including one of the two gems.
|
|
316
|
+
|
|
317
|
+
Please note that the two approaches branch. While ActiveSupport will freeze the time, Timecop will keep it running.
|
|
243
318
|
|
|
244
319
|
|
|
245
320
|
* **When the (date|time) is "?(\d{4}-\d{2}-\d{2}( \d{1,2}:\d{2})?)"?**
|
|
@@ -257,7 +332,7 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
|
|
|
257
332
|
Given the time is 13:40
|
|
258
333
|
|
|
259
334
|
|
|
260
|
-
* **When it is (\d+|
|
|
335
|
+
* **When it is (\d+|an?|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)**
|
|
261
336
|
|
|
262
337
|
Example:
|
|
263
338
|
|
|
@@ -265,6 +340,8 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
|
|
|
265
340
|
When it is a few hours earlier
|
|
266
341
|
|
|
267
342
|
|
|
343
|
+
|
|
344
|
+
|
|
268
345
|
### web_steps.rb
|
|
269
346
|
|
|
270
347
|
Most of cucumber-rails' original web steps plus a few of our own.
|
|
@@ -293,7 +370,7 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
|
293
370
|
|
|
294
371
|
* **When ... within ...**
|
|
295
372
|
|
|
296
|
-
You can append `within [selector]` to any other web step.
|
|
373
|
+
You can append `within [selector]` to any other web step, even multiple times.
|
|
297
374
|
Be aware that within will only look at the first element that matches.
|
|
298
375
|
If this is a problem for you following links, you might want to have a look
|
|
299
376
|
at the 'When I follow "..." inside any "..."'-step.
|
|
@@ -638,9 +715,6 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
|
638
715
|
* **When I enter "..." into the browser dialog**
|
|
639
716
|
|
|
640
717
|
|
|
641
|
-
* **When I switch to the new tab**
|
|
642
|
-
|
|
643
|
-
|
|
644
718
|
* **Then the "..." (field|button|checkbox) should( not)? be disabled**
|
|
645
719
|
|
|
646
720
|
Tests that an input, button or checkbox with the given label is disabled.
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env rake
|
|
2
|
-
require
|
|
2
|
+
require 'bundler/gem_tasks'
|
|
3
3
|
|
|
4
4
|
begin
|
|
5
5
|
require 'gemika/tasks'
|
|
@@ -17,7 +17,7 @@ namespace :matrix do
|
|
|
17
17
|
directory = File.dirname(row.gemfile)
|
|
18
18
|
if directory.start_with?('tests')
|
|
19
19
|
# Run integration tests (uses embedded projects)
|
|
20
|
-
system(
|
|
20
|
+
system(cucumber_command(directory, row.ruby))
|
|
21
21
|
else
|
|
22
22
|
# Run specs and tests for spreewald binary
|
|
23
23
|
[
|
|
@@ -44,16 +44,31 @@ task :update_readme do
|
|
|
44
44
|
require 'support/step_manager'
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
readme = File.read(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
readme = File.read(readme_path)
|
|
48
|
+
File.open(readme_path, 'w') do |file|
|
|
49
|
+
start_of_steps_section = readme =~ /^## Steps/
|
|
50
|
+
length_of_steps_section = readme[(start_of_steps_section+1)..-1] =~ /^##[^#]/
|
|
51
|
+
length_of_steps_section ||= readme.size - start_of_steps_section
|
|
52
|
+
step_documentation = StepManager.new('lib/spreewald').to_markdown
|
|
53
|
+
readme[start_of_steps_section, length_of_steps_section] = "## Steps\n\n#{step_documentation}"
|
|
54
|
+
|
|
55
|
+
file.write(readme)
|
|
56
|
+
end
|
|
52
57
|
|
|
53
58
|
system "git diff #{readme_path}"
|
|
54
59
|
puts '', '> Done (diff applied).'
|
|
55
60
|
end
|
|
56
61
|
|
|
62
|
+
def cucumber_command(directory, ruby_version)
|
|
63
|
+
command = "cd #{directory} && BUNDLE_GEMFILE=Gemfile geordi cucumber"
|
|
64
|
+
if Gem::Version.new(ruby_version) > Gem::Version.new('2.5')
|
|
65
|
+
# Modern cucumber sees pending tests as failures.
|
|
66
|
+
# We don't want this.
|
|
67
|
+
command << ' --no-strict-pending'
|
|
68
|
+
end
|
|
69
|
+
command
|
|
70
|
+
end
|
|
71
|
+
|
|
57
72
|
def warn(text)
|
|
58
73
|
puts "\e[31m#{text}\e[0m" # red text
|
|
59
74
|
end
|