spreewald 2.2.4 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -1
  3. data/.travis.yml +14 -15
  4. data/CHANGELOG.md +34 -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 +76 -34
  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 +2 -1
  16. data/lib/spreewald/email_steps.rb +11 -4
  17. data/lib/spreewald/file_attachment_steps.rb +3 -21
  18. data/lib/spreewald/time_steps.rb +102 -0
  19. data/lib/spreewald/timecop_steps.rb +6 -76
  20. data/lib/spreewald/web_steps.rb +8 -16
  21. data/lib/spreewald_support/driver_info.rb +8 -0
  22. data/lib/spreewald_support/tolerance_for_selenium_sync_issues.rb +9 -3
  23. data/lib/spreewald_support/version.rb +1 -1
  24. data/support/step_definition.rb +1 -1
  25. data/support/step_definition_file.rb +2 -0
  26. data/tests/rails-3_capybara-1/Gemfile +2 -1
  27. data/tests/rails-3_capybara-1/Gemfile.lock +3 -1
  28. data/tests/rails-3_capybara-1/app +1 -1
  29. data/tests/rails-3_capybara-1/config/cucumber.yml +1 -1
  30. data/tests/rails-3_capybara-1/config/database.yml +1 -1
  31. data/tests/rails-3_capybara-1/config/routes.rb +1 -0
  32. data/tests/rails-3_capybara-1/db +1 -1
  33. data/tests/rails-3_capybara-1/features/shared +1 -1
  34. data/tests/rails-3_capybara-1/features/support/paths.rb +1 -1
  35. data/tests/rails-3_capybara-1/features/support/selectors.rb +1 -1
  36. data/tests/rails-3_capybara-1/public +1 -1
  37. data/tests/rails-3_capybara-2/Gemfile +2 -1
  38. data/tests/rails-3_capybara-2/Gemfile.lock +3 -1
  39. data/tests/rails-3_capybara-2/Rakefile +1 -1
  40. data/tests/rails-3_capybara-2/app +1 -1
  41. data/tests/rails-3_capybara-2/config +1 -1
  42. data/tests/rails-3_capybara-2/config.ru +1 -1
  43. data/tests/rails-3_capybara-2/db +1 -1
  44. data/tests/rails-3_capybara-2/features +1 -1
  45. data/tests/rails-3_capybara-2/public +1 -1
  46. data/tests/rails-3_capybara-2/script +1 -1
  47. data/tests/rails-4_capybara-3/Gemfile +1 -1
  48. data/tests/rails-4_capybara-3/Gemfile.lock +3 -3
  49. data/tests/rails-4_capybara-3/app +1 -1
  50. data/tests/rails-4_capybara-3/config/routes.rb +1 -0
  51. data/tests/rails-4_capybara-3/db +1 -1
  52. data/tests/rails-4_capybara-3/features/development_steps.feature +1 -1
  53. data/tests/rails-4_capybara-3/features/email_steps.feature +1 -1
  54. data/tests/rails-4_capybara-3/features/overriding.feature +1 -1
  55. data/tests/rails-4_capybara-3/features/step_definitions/overriding_steps.rb +1 -1
  56. data/tests/rails-4_capybara-3/features/step_definitions/test_steps.rb +1 -1
  57. data/tests/rails-4_capybara-3/features/support/paths.rb +1 -1
  58. data/tests/rails-4_capybara-3/features/support/selectors.rb +1 -1
  59. data/tests/rails-4_capybara-3/features/table_steps.feature +1 -1
  60. data/tests/rails-4_capybara-3/features/time_steps.feature +1 -0
  61. data/tests/rails-4_capybara-3/features/web_steps.feature +1 -1
  62. data/tests/rails-4_capybara-3/public/fixture_files +1 -1
  63. data/tests/rails-6_capybara-3/.ruby-version +1 -0
  64. data/tests/rails-6_capybara-3/Gemfile +25 -0
  65. data/tests/rails-6_capybara-3/Gemfile.lock +264 -0
  66. data/tests/rails-6_capybara-3/README.md +24 -0
  67. data/tests/rails-6_capybara-3/Rakefile +6 -0
  68. data/tests/rails-6_capybara-3/app/controllers +1 -0
  69. data/tests/rails-6_capybara-3/app/mailers/application_mailer.rb +4 -0
  70. data/tests/rails-6_capybara-3/app/mailers/spreewald_mailer.rb +30 -0
  71. data/tests/rails-6_capybara-3/app/models/application_record.rb +3 -0
  72. data/tests/rails-6_capybara-3/app/views +1 -0
  73. data/tests/rails-6_capybara-3/bin/bundle +114 -0
  74. data/tests/rails-6_capybara-3/bin/rails +4 -0
  75. data/tests/rails-6_capybara-3/bin/rake +4 -0
  76. data/tests/rails-6_capybara-3/bin/setup +33 -0
  77. data/tests/rails-6_capybara-3/config.ru +5 -0
  78. data/tests/rails-6_capybara-3/config/application.rb +35 -0
  79. data/tests/rails-6_capybara-3/config/boot.rb +3 -0
  80. data/tests/rails-6_capybara-3/config/cucumber.yml +9 -0
  81. data/tests/rails-6_capybara-3/config/database.yml +25 -0
  82. data/tests/rails-6_capybara-3/config/environment.rb +5 -0
  83. data/tests/rails-6_capybara-3/config/environments/development.rb +48 -0
  84. data/tests/rails-6_capybara-3/config/environments/test.rb +45 -0
  85. data/tests/rails-6_capybara-3/config/initializers/application_controller_renderer.rb +8 -0
  86. data/tests/rails-6_capybara-3/config/initializers/backtrace_silencers.rb +7 -0
  87. data/tests/rails-6_capybara-3/config/initializers/content_security_policy.rb +28 -0
  88. data/tests/rails-6_capybara-3/config/initializers/cookies_serializer.rb +5 -0
  89. data/tests/rails-6_capybara-3/config/initializers/filter_parameter_logging.rb +4 -0
  90. data/tests/rails-6_capybara-3/config/initializers/inflections.rb +16 -0
  91. data/tests/rails-6_capybara-3/config/initializers/mime_types.rb +4 -0
  92. data/tests/rails-6_capybara-3/config/initializers/wrap_parameters.rb +14 -0
  93. data/tests/rails-6_capybara-3/config/locales/en.yml +33 -0
  94. data/tests/rails-6_capybara-3/config/routes.rb +1 -0
  95. data/tests/rails-6_capybara-3/db +1 -0
  96. data/tests/rails-6_capybara-3/features/development_steps.feature +1 -0
  97. data/tests/rails-6_capybara-3/features/email_steps.feature +1 -0
  98. data/tests/rails-6_capybara-3/features/overriding.feature +1 -0
  99. data/tests/{shared/app/views/emails/send_email.haml → rails-6_capybara-3/features/step_definitions/.gitkeep} +0 -0
  100. data/tests/rails-6_capybara-3/features/step_definitions/overriding_steps.rb +1 -0
  101. data/tests/rails-6_capybara-3/features/step_definitions/test_steps.rb +1 -0
  102. data/tests/rails-6_capybara-3/features/support/env.rb +66 -0
  103. data/tests/rails-6_capybara-3/features/support/paths.rb +1 -0
  104. data/tests/rails-6_capybara-3/features/support/selectors.rb +1 -0
  105. data/tests/rails-6_capybara-3/features/support/selenium.rb +3 -0
  106. data/tests/rails-6_capybara-3/features/table_steps.feature +1 -0
  107. data/tests/rails-6_capybara-3/features/time_steps.feature +1 -0
  108. data/tests/rails-6_capybara-3/features/web_steps.feature +1 -0
  109. data/tests/{shared/db/migrate/.gitignore → rails-6_capybara-3/lib/tasks/.keep} +0 -0
  110. data/tests/rails-6_capybara-3/lib/tasks/cucumber.rake +76 -0
  111. data/tests/rails-6_capybara-3/log/.keep +0 -0
  112. data/tests/rails-6_capybara-3/public/404.html +67 -0
  113. data/tests/rails-6_capybara-3/public/422.html +67 -0
  114. data/tests/rails-6_capybara-3/public/500.html +66 -0
  115. data/tests/rails-6_capybara-3/public/favicon.ico +0 -0
  116. data/tests/rails-6_capybara-3/public/fixture_files +1 -0
  117. data/tests/rails-6_capybara-3/script/cucumber +11 -0
  118. data/tests/shared/app/controllers/application_controller.rb +9 -0
  119. data/tests/shared/app/controllers/authenticated_controller.rb +10 -2
  120. data/tests/shared/app/controllers/emails_controller.rb +25 -7
  121. data/tests/shared/app/controllers/forms_controller.rb +3 -0
  122. data/tests/shared/app/controllers/static_pages_controller.rb +23 -0
  123. data/tests/shared/app/models/mailer.rb +16 -0
  124. data/tests/shared/app/views/layouts/mailer.html.erb +13 -0
  125. data/tests/shared/app/views/layouts/mailer.text.erb +1 -0
  126. data/tests/shared/app/views/mailer/{email.haml → email.text.erb} +0 -0
  127. data/tests/shared/app/views/mailer/html_email_with_links.haml +6 -0
  128. data/tests/shared/app/views/mailer/text_email_with_links.text.erb +6 -0
  129. data/tests/shared/app/views/spreewald_mailer +1 -0
  130. data/tests/shared/app/views/static_pages/tab_1.haml +3 -0
  131. data/tests/shared/app/views/static_pages/tab_2.haml +2 -0
  132. data/tests/shared/app/views/static_pages/tab_3.haml +1 -0
  133. data/tests/shared/app/views/static_pages/time.html.haml +2 -0
  134. data/tests/shared/app/views/static_pages/visibility.html.haml +8 -1
  135. data/tests/shared/app/views/static_pages/within.html.haml +3 -0
  136. data/tests/shared/config/routes.rb +37 -0
  137. data/tests/shared/db/migrate/.keep +0 -0
  138. data/tests/shared/features/shared/browser_tab_steps.feature +103 -0
  139. data/tests/shared/features/shared/email_steps.feature +18 -0
  140. data/tests/shared/features/shared/time_steps.feature +31 -0
  141. data/tests/shared/features/shared/web_steps.feature +17 -0
  142. metadata +149 -12
  143. data/tests/rails-3_capybara-1/config/routes.rb +0 -5
  144. data/tests/rails-4_capybara-3/.gitignore +0 -17
  145. data/tests/rails-4_capybara-3/config/routes.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 722a4a8f8f3355dddbbd3abd5df49ba0316c1b57
4
- data.tar.gz: 694c570012da6abd82412c1160342a6c09ebf80d
2
+ SHA256:
3
+ metadata.gz: 782da77b76273a09876285f8cc37e9855cec78b891ae80fdff94413d0b0747d1
4
+ data.tar.gz: 3c85f3a589f466b48d2fce57b99a8bdb468c5672628becba955c69ded5cb642d
5
5
  SHA512:
6
- metadata.gz: d88a0c8e05b5542bdb58eb49954e96d2c15df249110bd548619292015b2c1fc815fc24366c474f0e91c13405c62e6f1b1e992478eaf5ff5cbd2acead55e8f0fc
7
- data.tar.gz: 30942d57ee1f144a0afad41c1eafc5b132128109a2e0cf25afa3738b17c5233a1222f1feefbc383a41fa5af041c11e9d6ed9c2c1f399c1a2a3ec0ef596c3f53e
6
+ metadata.gz: 07de3d07cc658fbbc41f8441d897cbae26f5e2a03de17e159fbad72739f237ac20c3c762e9ab1a56a12d0a61b503a38fc9c49eb16c00481aad63bd267414f3a9
7
+ data.tar.gz: 22c6e544d8555dc5ef1978a8de23595e183ef3288c2fe90006229db5ded468e89f0308998428ee84d437b7810bdc9f79ba7c081dce3e4ed1677573554b7efa3f
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,9 +3,41 @@ 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.6.0
7
+ - 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.
8
+ - The steps in the file `spreewald/timecop.rb` file were moved to `spreewald/time.rb` and importing `spreewald/timecop` directly is deprecated now.
9
+
10
+
11
+ ## 2.5.0
12
+ - Add a set of steps to control browser tabs (Selenium only):
13
+ * `I open ... in a new browser tab`
14
+ * `I close the browser tab`
15
+ * `I switch to the new browser tab`
16
+ * `I switch to the previous browser tab`
17
+ * `I may open a new browser tab` (required for the following step)
18
+ * `I should( not)? have opened a new browser tab`
19
+ * `there should be (\d+) browser tabs?`
20
+ * `there should be at least (\d+) browser tabs?`
21
+
22
+ ## 2.4.2
23
+ - Fix the step `I should( not)? see a link labeled "STRING"`, it is now overridable.
24
+
25
+ ## 2.4.1
26
+
27
+ - Adapt `I should get a download with filename "..."` step to also work if the `filename` is not the last attribute in `Content-Disposition` header.
28
+
29
+ ## 2.4.0
30
+
31
+ - Fix "I follow the ... link in the email" step for HTML e-mails to only follow URLs from `<a href="...">` links.
32
+
33
+ ## 2.3.0
34
+ - Deprecate two steps:
35
+ - (Given) the file ... was attached to the ... above
36
+ - (Then) debugger
37
+
6
38
  ## 2.2.4
7
39
  - Fix "..." field should have the error "..." test by removing old should syntax
8
- - Add single-line mail step to READNE
40
+ - Add single-line mail step to README
9
41
 
10
42
  ## 2.2.3
11
43
  - Fix 'the window should be titled' step - closes: [#102](https://github.com/makandra/spreewald/issues/102)
@@ -25,7 +57,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
25
57
 
26
58
  ## 2.2.0
27
59
  - Add a new step `I should( not)? see a link labeled "STRING"`.
28
- - Refer to Capybara 3's new flag `Capybara.default_normalize_ws = true` in the READNE,
60
+ - Refer to Capybara 3's new flag `Capybara.default_normalize_ws = true` in the README,
29
61
 
30
62
  ## 2.1.3
31
63
  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
@@ -223,27 +283,7 @@ the step definitions.
223
283
 
224
284
  * **Given the file "..." was attached( as (.../)?...)? to the ... above( at "...")?**
225
285
 
226
- Attach a file to the given model's last record.
227
-
228
- Example (Company has a `file` attribute):
229
-
230
- Given the file "image.png" was attached to the company above
231
-
232
- You may specify the attribute under which the file is stored …
233
-
234
- Example (Company has a `logo` attribute):
235
-
236
- Given the file "image.png" was attached as logo to the company above
237
-
238
- … or both a container class and its attribute name
239
-
240
- Example (Company has many `Image`s, `Image` has a `file` attribute)
241
-
242
- Given the file "image.png" was attached as Image/file to the company above
243
-
244
- To simultaneously set the `updated_at` timestamp:
245
-
246
- Given the file "some_file" was attached to the profile above at "2011-11-11 11:11"
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.
247
287
 
248
288
 
249
289
  ### table_steps.rb
@@ -255,11 +295,14 @@ the step definitions.
255
295
  See [this article](https://makandracards.com/makandra/763-cucumber-step-to-match-table-rows-with-capybara) for details.
256
296
 
257
297
 
258
- ### timecop_steps.rb
298
+ ### time_steps.rb
299
+
300
+ Steps to travel through time
259
301
 
260
- Steps to travel through time using [Timecop](https://github.com/jtrupiano/timecop).
302
+ This uses [Timecop](https://github.com/jtrupiano/timecop) or Active Support 4.1+ to stub Time.now / Time.current.
303
+ The user is responsible for including one of the two gems.
261
304
 
262
- See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps-to-travel-through-time-with-timecop) for details.
305
+ Please note that the two approaches branch. While ActiveSupport will freeze the time, Timecop will keep it running.
263
306
 
264
307
 
265
308
  * **When the (date|time) is "?(\d{4}-\d{2}-\d{2}( \d{1,2}:\d{2})?)"?**
@@ -277,7 +320,7 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
277
320
  Given the time is 13:40
278
321
 
279
322
 
280
- * **When it is (\d+|a|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)**
323
+ * **When it is (\d+|an?|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)**
281
324
 
282
325
  Example:
283
326
 
@@ -285,6 +328,8 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
285
328
  When it is a few hours earlier
286
329
 
287
330
 
331
+
332
+
288
333
  ### web_steps.rb
289
334
 
290
335
  Most of cucumber-rails' original web steps plus a few of our own.
@@ -313,7 +358,7 @@ deprecation notice. Decide for yourself whether you want to use them:
313
358
 
314
359
  * **When ... within ...**
315
360
 
316
- You can append `within [selector]` to any other web step.
361
+ You can append `within [selector]` to any other web step, even multiple times.
317
362
  Be aware that within will only look at the first element that matches.
318
363
  If this is a problem for you following links, you might want to have a look
319
364
  at the 'When I follow "..." inside any "..."'-step.
@@ -574,7 +619,7 @@ deprecation notice. Decide for yourself whether you want to use them:
574
619
  Within a selenium test, the browser is asked whether the element is really visible
575
620
  In a non-selenium test, we only check for `.hidden`, `.invisible` or `style: display:none`
576
621
 
577
- The step 'Then (the tag )?"..." should **not** be visible' is ambiguous. Please use 'Then (the tag )?"..." should be hidden' or 'Then I should not see "..."' instead.
622
+ The step 'Then (the tag )?"..." should **not** be visible' is ambiguous. Please use 'Then (the tag )?"..." should be hidden' or 'Then I should not see "..."' instead. Note that the **not** option will be removed in future versions of Spreewald.
578
623
 
579
624
  More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
580
625
 
@@ -658,9 +703,6 @@ deprecation notice. Decide for yourself whether you want to use them:
658
703
  * **When I enter "..." into the browser dialog**
659
704
 
660
705
 
661
- * **When I switch to the new tab**
662
-
663
-
664
706
  * **Then the "..." (field|button|checkbox) should( not)? be disabled**
665
707
 
666
708
  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