spreewald 2.4.0 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.travis.yml +14 -15
  4. data/CHANGELOG.md +30 -2
  5. data/Gemfile +1 -2
  6. data/Gemfile.lock +1 -16
  7. data/Gemfile.ruby266 +9 -0
  8. data/Gemfile.ruby266.lock +65 -0
  9. data/README.md +86 -12
  10. data/Rakefile +22 -7
  11. data/examples/paths.rb +36 -0
  12. data/examples/selectors.rb +28 -0
  13. data/lib/spreewald/all_steps.rb +4 -1
  14. data/lib/spreewald/browser_tab_steps.rb +91 -0
  15. data/lib/spreewald/development_steps.rb +1 -1
  16. data/lib/spreewald/session_steps.rb +18 -0
  17. data/lib/spreewald/time_steps.rb +102 -0
  18. data/lib/spreewald/timecop_steps.rb +6 -76
  19. data/lib/spreewald/web_steps.rb +18 -15
  20. data/lib/spreewald_support/driver_info.rb +8 -0
  21. data/lib/spreewald_support/tolerance_for_selenium_sync_issues.rb +9 -3
  22. data/lib/spreewald_support/version.rb +1 -1
  23. data/support/step_definition.rb +1 -1
  24. data/support/step_definition_file.rb +2 -0
  25. data/tests/rails-3_capybara-1/Gemfile +2 -1
  26. data/tests/rails-3_capybara-1/Gemfile.lock +3 -1
  27. data/tests/rails-3_capybara-1/config/routes.rb +1 -0
  28. data/tests/rails-3_capybara-2/Gemfile +2 -1
  29. data/tests/rails-3_capybara-2/Gemfile.lock +3 -1
  30. data/tests/rails-4_capybara-3/Gemfile +1 -1
  31. data/tests/rails-4_capybara-3/Gemfile.lock +1 -1
  32. data/tests/rails-4_capybara-3/config/routes.rb +1 -0
  33. data/tests/rails-4_capybara-3/features/browser_tab_steps.feature +1 -0
  34. data/tests/rails-4_capybara-3/features/session_steps.feature +1 -0
  35. data/tests/rails-4_capybara-3/features/time_steps.feature +1 -0
  36. data/tests/rails-6_capybara-3/.ruby-version +1 -0
  37. data/tests/rails-6_capybara-3/Gemfile +25 -0
  38. data/tests/rails-6_capybara-3/Gemfile.lock +264 -0
  39. data/tests/rails-6_capybara-3/README.md +24 -0
  40. data/tests/rails-6_capybara-3/Rakefile +6 -0
  41. data/tests/rails-6_capybara-3/app/controllers +1 -0
  42. data/tests/rails-6_capybara-3/app/mailers/application_mailer.rb +4 -0
  43. data/tests/rails-6_capybara-3/app/mailers/spreewald_mailer.rb +30 -0
  44. data/tests/rails-6_capybara-3/app/models/application_record.rb +3 -0
  45. data/tests/rails-6_capybara-3/app/views +1 -0
  46. data/tests/rails-6_capybara-3/bin/bundle +114 -0
  47. data/tests/rails-6_capybara-3/bin/rails +4 -0
  48. data/tests/rails-6_capybara-3/bin/rake +4 -0
  49. data/tests/rails-6_capybara-3/bin/setup +33 -0
  50. data/tests/rails-6_capybara-3/config.ru +5 -0
  51. data/tests/rails-6_capybara-3/config/application.rb +35 -0
  52. data/tests/rails-6_capybara-3/config/boot.rb +3 -0
  53. data/tests/rails-6_capybara-3/config/cucumber.yml +9 -0
  54. data/tests/rails-6_capybara-3/config/database.yml +25 -0
  55. data/tests/rails-6_capybara-3/config/environment.rb +5 -0
  56. data/tests/rails-6_capybara-3/config/environments/development.rb +48 -0
  57. data/tests/rails-6_capybara-3/config/environments/test.rb +45 -0
  58. data/tests/rails-6_capybara-3/config/initializers/application_controller_renderer.rb +8 -0
  59. data/tests/rails-6_capybara-3/config/initializers/backtrace_silencers.rb +7 -0
  60. data/tests/rails-6_capybara-3/config/initializers/content_security_policy.rb +28 -0
  61. data/tests/rails-6_capybara-3/config/initializers/cookies_serializer.rb +5 -0
  62. data/tests/rails-6_capybara-3/config/initializers/filter_parameter_logging.rb +4 -0
  63. data/tests/rails-6_capybara-3/config/initializers/inflections.rb +16 -0
  64. data/tests/rails-6_capybara-3/config/initializers/mime_types.rb +4 -0
  65. data/tests/rails-6_capybara-3/config/initializers/wrap_parameters.rb +14 -0
  66. data/tests/rails-6_capybara-3/config/locales/en.yml +33 -0
  67. data/tests/rails-6_capybara-3/config/routes.rb +1 -0
  68. data/tests/rails-6_capybara-3/db +1 -0
  69. data/tests/rails-6_capybara-3/features/browser_tab_steps.feature +1 -0
  70. data/tests/rails-6_capybara-3/features/development_steps.feature +1 -0
  71. data/tests/rails-6_capybara-3/features/email_steps.feature +1 -0
  72. data/tests/rails-6_capybara-3/features/overriding.feature +1 -0
  73. data/tests/rails-6_capybara-3/features/session_steps.feature +1 -0
  74. data/tests/{shared/db/migrate/.gitignore → rails-6_capybara-3/features/step_definitions/.gitkeep} +0 -0
  75. data/tests/rails-6_capybara-3/features/step_definitions/overriding_steps.rb +1 -0
  76. data/tests/rails-6_capybara-3/features/step_definitions/test_steps.rb +1 -0
  77. data/tests/rails-6_capybara-3/features/support/env.rb +66 -0
  78. data/tests/rails-6_capybara-3/features/support/paths.rb +1 -0
  79. data/tests/rails-6_capybara-3/features/support/selectors.rb +1 -0
  80. data/tests/rails-6_capybara-3/features/support/selenium.rb +3 -0
  81. data/tests/rails-6_capybara-3/features/table_steps.feature +1 -0
  82. data/tests/rails-6_capybara-3/features/time_steps.feature +1 -0
  83. data/tests/rails-6_capybara-3/features/web_steps.feature +1 -0
  84. data/tests/rails-6_capybara-3/lib/tasks/.keep +0 -0
  85. data/tests/rails-6_capybara-3/lib/tasks/cucumber.rake +76 -0
  86. data/tests/rails-6_capybara-3/log/.keep +0 -0
  87. data/tests/rails-6_capybara-3/public/404.html +67 -0
  88. data/tests/rails-6_capybara-3/public/422.html +67 -0
  89. data/tests/rails-6_capybara-3/public/500.html +66 -0
  90. data/tests/rails-6_capybara-3/public/favicon.ico +0 -0
  91. data/tests/rails-6_capybara-3/public/fixture_files +1 -0
  92. data/tests/rails-6_capybara-3/script/cucumber +11 -0
  93. data/tests/shared/app/controllers/application_controller.rb +9 -0
  94. data/tests/shared/app/controllers/authenticated_controller.rb +10 -2
  95. data/tests/shared/app/controllers/downloads_controller.rb +1 -1
  96. data/tests/shared/app/controllers/emails_controller.rb +8 -5
  97. data/tests/shared/app/controllers/forms_controller.rb +3 -0
  98. data/tests/shared/app/controllers/static_pages_controller.rb +17 -2
  99. data/tests/shared/app/views/layouts/mailer.html.erb +13 -0
  100. data/tests/shared/app/views/layouts/mailer.text.erb +1 -0
  101. data/tests/shared/app/views/spreewald_mailer +1 -0
  102. data/tests/shared/app/views/static_pages/session_1.haml +1 -0
  103. data/tests/shared/app/views/static_pages/session_2.haml +1 -0
  104. data/tests/shared/app/views/static_pages/session_3.haml +1 -0
  105. data/tests/shared/app/views/static_pages/tab_1.haml +3 -0
  106. data/tests/shared/app/views/static_pages/tab_2.haml +2 -0
  107. data/tests/shared/app/views/static_pages/tab_3.haml +1 -0
  108. data/tests/shared/app/views/static_pages/time.html.haml +2 -0
  109. data/tests/shared/config/routes.rb +40 -0
  110. data/tests/shared/db/migrate/.keep +0 -0
  111. data/tests/shared/features/shared/browser_tab_steps.feature +103 -0
  112. data/tests/shared/features/shared/session_steps.feature +29 -0
  113. data/tests/shared/features/shared/time_steps.feature +31 -0
  114. data/tests/shared/features/shared/web_steps.feature +1 -1
  115. metadata +160 -7
  116. data/tests/rails-3_capybara-1/config/routes.rb +0 -5
  117. data/tests/rails-4_capybara-3/.gitignore +0 -17
  118. data/tests/rails-4_capybara-3/config/routes.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18febfccd8fa518df388635fd50815c8255a3970a3b67b7022a0ccca1280d4d1
4
- data.tar.gz: 626984be2ce97aac2144383650319f5240e1e624c3847f9dac1e140d85da18b3
3
+ metadata.gz: ff2190f73eb0208f16e61464f60da6e726eac2423f39ad169f862fe2e9c01fb7
4
+ data.tar.gz: 149e2142c5f9df868ec19521dfb6404edcbc7267b99eabf0048bfb4a082c55d9
5
5
  SHA512:
6
- metadata.gz: 74a4c47fb0e1c33814f1f298eb1dda0f7d1b551f254325e0e26dded66c0dff88e260b6303d3f30d337a9af8d7170d7ae11ff54b0a22079ba2a26cbfa48cb7879
7
- data.tar.gz: 9a55a3db1f0b4f78e701b87fc567e036e1eaa146ce439ed1b4fb4c95a5ef0e646f8019028878d81a34cc3093f9ba25cfd561bca44be0aabfe582dfa1a6717657
6
+ metadata.gz: 8141451a1da482256e7f9246c98e5e23bfb3f758854ee942c007fd59943165ae8802ff0dab9cf69b3c2c69225877f4c4dd8ba8ba457f304e8d2b3b805ddf06d2
7
+ data.tar.gz: beaa7a1eb91313d69a9a6f7d5aeecf580a38b65e0cd7ec1de19b6469ccda5f66c52a0e76f75bbe21a7596865f7458550591ed4540d82ce125fe3912816df07ad
data/.gitignore CHANGED
@@ -11,4 +11,4 @@ InstalledFiles
11
11
  tmp
12
12
  _yardoc
13
13
  *.log
14
- tests/shared/db/test.sqlite3
14
+ tests/shared/db/*.sqlite3
@@ -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
- exclude:
12
+ include:
13
+ # Test projects
21
14
  - gemfile: tests/rails-3_capybara-1/Gemfile
22
- rvm: 2.4.5
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.ruby218
18
+ - gemfile: tests/rails-4_capybara-3/Gemfile
28
19
  rvm: 2.4.5
29
- - gemfile: Gemfile.ruby245
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
+
@@ -3,6 +3,34 @@ 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.1
7
+ - Support RFC-compliant encoding of filenames in `Content-Disposition` header (e.g. send_data), as provided by Rails 6.
8
+
9
+ ## 2.7.0
10
+ - Add a step modifier to control different Capybara sessions: `... in the browser session "..."`. (see issue [#66](https://github.com/makandra/spreewald/issues/66))
11
+
12
+ ## 2.6.0
13
+ - 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.
14
+ - The steps in the file `spreewald/timecop.rb` file were moved to `spreewald/time.rb` and importing `spreewald/timecop` directly is deprecated now.
15
+
16
+ ## 2.5.0
17
+ - Add a set of steps to control browser tabs (Selenium only):
18
+ * `I open ... in a new browser tab`
19
+ * `I close the browser tab`
20
+ * `I switch to the new browser tab`
21
+ * `I switch to the previous browser tab`
22
+ * `I may open a new browser tab` (required for the following step)
23
+ * `I should( not)? have opened a new browser tab`
24
+ * `there should be (\d+) browser tabs?`
25
+ * `there should be at least (\d+) browser tabs?`
26
+
27
+ ## 2.4.2
28
+ - Fix the step `I should( not)? see a link labeled "STRING"`, it is now overridable.
29
+
30
+ ## 2.4.1
31
+
32
+ - Adapt `I should get a download with filename "..."` step to also work if the `filename` is not the last attribute in `Content-Disposition` header.
33
+
6
34
  ## 2.4.0
7
35
 
8
36
  - Fix "I follow the ... link in the email" step for HTML e-mails to only follow URLs from `<a href="...">` links.
@@ -14,7 +42,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
14
42
 
15
43
  ## 2.2.4
16
44
  - Fix "..." field should have the error "..." test by removing old should syntax
17
- - Add single-line mail step to READNE
45
+ - Add single-line mail step to README
18
46
 
19
47
  ## 2.2.3
20
48
  - Fix 'the window should be titled' step - closes: [#102](https://github.com/makandra/spreewald/issues/102)
@@ -34,7 +62,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
34
62
 
35
63
  ## 2.2.0
36
64
  - Add a new step `I should( not)? see a link labeled "STRING"`.
37
- - Refer to Capybara 3's new flag `Capybara.default_normalize_ws = true` in the READNE,
65
+ - Refer to Capybara 3's new flag `Capybara.default_normalize_ws = true` in the README,
38
66
 
39
67
  ## 2.1.3
40
68
  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
@@ -1,5 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
- gem 'gemika'
5
- gem 'rspec', '>=2.14.0'
4
+ gem 'gemika'
@@ -1,22 +1,8 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- diff-lcs (1.3)
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
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ ruby '2.6.6'
4
+
5
+ gem 'rspec'
6
+ gem 'cucumber'
7
+ gem 'aruba'
8
+
9
+ gem 'gemika'
@@ -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
- ## A note on Capybara 3
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
- ### timecop_steps.rb
310
+ ### time_steps.rb
239
311
 
240
- Steps to travel through time using [Timecop](https://github.com/jtrupiano/timecop).
312
+ Steps to travel through time
241
313
 
242
- See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps-to-travel-through-time-with-timecop) for details.
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+|a|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)**
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 "bundler/gem_tasks"
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("cd #{directory} && BUNDLE_GEMFILE=Gemfile geordi cucumber")
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('README.md')
48
- start_of_steps_section = readme =~ /^## Steps/
49
- length_of_steps_section = (readme[(start_of_steps_section+1)..-1] =~ /^##[^#]/) || readme.size - start_of_steps_section
50
- readme[start_of_steps_section, length_of_steps_section] = "## Steps\n\n" + StepManager.new('lib/spreewald').to_markdown
51
- File.open(readme_path, 'w') { |f| f.write(readme) }
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