spreewald 2.99.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -2
  3. data/README.md +3 -33
  4. data/features/binary.feature +2 -2
  5. data/lib/spreewald/development_steps.rb +1 -8
  6. data/lib/spreewald/email_steps.rb +0 -42
  7. data/lib/spreewald/web_steps.rb +17 -61
  8. data/lib/spreewald_support/mail_finder.rb +7 -3
  9. data/lib/spreewald_support/version.rb +1 -1
  10. data/tests/rails-3_capybara-1/Gemfile.lock +1 -1
  11. data/tests/rails-3_capybara-2/Gemfile.lock +1 -1
  12. data/tests/rails-4_capybara-3/Gemfile.lock +1 -1
  13. data/tests/rails-6_capybara-3/Gemfile.lock +1 -1
  14. data/tests/rails-6_capybara-3/app/mailers/spreewald_mailer.rb +24 -0
  15. data/tests/shared/app/controllers/emails_controller.rb +30 -0
  16. data/tests/shared/app/models/mailer.rb +48 -0
  17. data/tests/shared/app/views/forms/checkbox_form.html.haml +3 -0
  18. data/tests/shared/app/views/forms/disabled_elements.html.haml +1 -0
  19. data/tests/shared/app/views/forms/form1.html.haml +4 -1
  20. data/tests/shared/app/views/forms/invalid_form.html.haml +3 -0
  21. data/tests/shared/app/views/mailer/html_email_for_failed_test_without_header.haml +5 -0
  22. data/tests/shared/app/views/mailer/html_email_for_successful_test_without_header.haml +7 -0
  23. data/tests/shared/app/views/mailer/html_email_with_specific_line.haml +11 -0
  24. data/tests/shared/app/views/mailer/text_email_for_failed_test_without_header.text.erb +1 -0
  25. data/tests/shared/app/views/mailer/text_email_for_successful_test_without_header.text.erb +3 -0
  26. data/tests/shared/app/views/mailer/text_email_with_specific_line.text.erb +5 -0
  27. data/tests/shared/config/routes.rb +6 -0
  28. data/tests/shared/features/shared/email_steps.feature +169 -56
  29. data/tests/shared/features/shared/web_steps.feature +15 -10
  30. metadata +14 -4
  31. data/lib/spreewald/file_attachment_steps.rb +0 -22
  32. data/lib/spreewald/timecop_steps.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04e59902ff7a473603ddb7619f350b34de83072a81e36afc5767480e837c4345
4
- data.tar.gz: 5dfc9a6630cc0332228024528a55025f7d672140bd0acabbffecbafbcd18188c
3
+ metadata.gz: 6a51defb2267ab0f0f6e9123b474e0069758e59eaa3f18cadefdfdb81a5f5760
4
+ data.tar.gz: f47297c29b676ee194c1dbc2f335eab608afefa9730e124e8811d4542089031e
5
5
  SHA512:
6
- metadata.gz: 21eed3d8dab955f4da45fa3a30fda49c1d3f6ca2b462736cb4e171725a7c685f6e6149a1a261646028fcb1310fb9a070e68679426a670d77271d3c2e2926ca58
7
- data.tar.gz: 299c23ccc3f6f751b850e0d776da679c6f2c4480cb1e150ff655cc31aaaffd33008f592b5b3d53a4f9bae543391ec75943f42805949b5be690f1d383a25bfed4
6
+ metadata.gz: 3b93c18acce9d744364898f65e6f3597d06b37ed85d69bb81e3593521d0433bc56338b974c32133c0fce749190ee8af63c146b355e12601397b3641d4424380d
7
+ data.tar.gz: b675ad24c9c6e9836880d9111f1538d8f3b5c2d91e390dc5ee5165842cb19298d039fa428405dd47df20daa40b59234f641fcc3e4cab2cf0f6405449ecad981c
@@ -3,12 +3,53 @@ 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.99.2
6
+ ## 3.0.3
7
+
8
+ - The `an email should have been sent with` step now interprets all lines as body when not specifying headers (see issue [#157](https://github.com/makandra/spreewald/issues/157))
9
+
10
+ ## 3.0.2
11
+
12
+ - Introduce wildcard for the beginning of a line. (see issue [#155](https://github.com/makandra/spreewald/issues/155))
13
+ - This will allow you to check for a specific sentence inside the body
14
+
15
+ ## 3.0.1
7
16
 
8
17
  - Fix deduplication of linebreaks for html mails in mail finder. (see issue [#153](https://github.com/makandra/spreewald/issues/153))
9
18
 
10
- ## 2.99.1
19
+ ## 3.0.0
11
20
 
21
+ ### Breaking changes
22
+
23
+ - The following steps have been removed:
24
+ - `/^the file "([^"]*)" was attached(?: as (?:([^"]*)\/)?([^"]*))? to the ([^"]*) above(?: at "([^"]*)")?$/` (see [#106](https://github.com/makandra/spreewald/issues/106), this functionality was moved to [CucumberFactory](https://github.com/makandra/cucumber_factory))
25
+ - `/^the "([^"]*)" field should have no error$/` (see [#134](https://github.com/makandra/spreewald/issues/134))
26
+ - `/^I should get a text response$/` (see [#135](https://github.com/makandra/spreewald/issues/135))
27
+ - `/^I wait for the page to load$/` (see [#136](https://github.com/makandra/spreewald/issues/136))
28
+ - `debugger` (was an alias for `console`)
29
+ - These email steps have been removed in favor of `(an?|no)( HTML| plain-text|) e?mail should have been sent with:` (see [#132](https://github.com/makandra/spreewald/issues/132#issuecomment-631457290)):
30
+ - `/^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/`
31
+ - `/^that e?mail should( not)? have the following lines in the body$/`
32
+ - `/^that e?mail should have the following (?:|content in the )body:$/`
33
+ - The `and disabled` modifier of the step `the "..." checkbox should( not)? be checked` has been removed. Use the step without the modifier together with the step `the "..." checkbox should be disabled` to achieve the old behavior.
34
+ - The step `/^(the tag )?"([^\"]+)" should( not)? be visible$/` lost its `not` modifier (Use `Then (the tag )?"..." should be hidden` or `Then I should not see "..."`)
35
+ - The file `lib/spreewald/timecop_steps.rb` was removed (was an alias for `lib/spreewald/time_steps.rb`).
36
+ - The step `(an?|no)( HTML| plain-text|) e?mail should have been sent with:` does now require that the whole body is matched.
37
+ - All web steps interacting with forms will now find both enabled and disabled fields. We encourage you to assert the "disabled" state in a separate step when needed, Spreewald offers these steps as well.
38
+
39
+ The following steps have been adjusted:
40
+ - `I should( not)? see a field "..."`
41
+ - `the "..." field should( not)? contain "..."`
42
+ - `I should see a form with the following values:`
43
+ - `the "..." field should have the error "..."`
44
+ - `the "..." field should( not)? have an error`
45
+ - `the "..." checkbox should( not)? be checked`
46
+ - `"..." should be selected for "..."`
47
+ - `nothing should be selected for "..."`
48
+ - `"..." should( not)? be an option for "..."`
49
+ - `the "..." field should( not)? be visible`
50
+ - `the "..." select should( not)? be sorted`
51
+
52
+ ### Compatible changes
12
53
  - Reintroduced support for emails with CRLF line ending
13
54
 
14
55
  ## 2.99.0
data/README.md CHANGED
@@ -197,8 +197,7 @@ the step definitions.
197
197
  * **Then console**
198
198
 
199
199
  Pauses test execution and opens an IRB shell with current context. Does not halt the application-
200
- under-test. (Replaces the "Then debugger" step that has never been adequate
201
- for its job)
200
+ under-test.
202
201
 
203
202
 
204
203
  * **AfterStep @slow-motion**
@@ -238,9 +237,6 @@ the step definitions.
238
237
 
239
238
  """
240
239
 
241
- Because of backwards-compatibility, the body currently only has to be a prefix
242
- of the real body. However, this is deprecated and will be removed in a future
243
- version. Use wildcards instead.
244
240
  You may skip lines in the header, of course.
245
241
 
246
242
 
@@ -269,13 +265,6 @@ the step definitions.
269
265
  This uses the same syntax as `Then an email should have been sent with:`
270
266
 
271
267
 
272
- ### file_attachment_steps.rb
273
-
274
- * **Given the file "..." was attached( as (.../)?...)? to the ... above( at "...")?**
275
-
276
- 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.
277
-
278
-
279
268
  ### session_steps.rb
280
269
 
281
270
  * **When ... in the browser session "..."**
@@ -330,8 +319,6 @@ Please note that the two approaches branch. While ActiveSupport will freeze the
330
319
  When it is a few hours earlier
331
320
 
332
321
 
333
-
334
-
335
322
  ### web_steps.rb
336
323
 
337
324
  Most of cucumber-rails' original web steps plus a few of our own.
@@ -559,10 +546,7 @@ deprecation notice. Decide for yourself whether you want to use them:
559
546
  * **Then the "..." field should( not)? have an error**
560
547
 
561
548
 
562
- * **Then the "..." field should have no error**
563
-
564
-
565
- * **Then the "..." checkbox should( not)? be checked( and disabled)?**
549
+ * **Then the "..." checkbox should( not)? be checked?**
566
550
 
567
551
 
568
552
  * **Then the radio button "..." should( not)? be (checked|selected)**
@@ -615,14 +599,12 @@ deprecation notice. Decide for yourself whether you want to use them:
615
599
  * **When I reload the page**
616
600
 
617
601
 
618
- * **Then (the tag )?"..." should( not)? be visible**
602
+ * **Then (the tag )?"..." should be visible**
619
603
 
620
604
  Checks that an element is actually present and visible, also considering styles.
621
605
  Within a selenium test, the browser is asked whether the element is really visible
622
606
  In a non-selenium test, we only check for `.hidden`, `.invisible` or `style: display:none`
623
607
 
624
- 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.
625
-
626
608
  More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
627
609
 
628
610
 
@@ -675,11 +657,6 @@ deprecation notice. Decide for yourself whether you want to use them:
675
657
  got: "http://makandra.com/" (using =~)
676
658
 
677
659
 
678
- * **Then I should get a text response**
679
-
680
- Checks that the result has content type `text/plain`
681
-
682
-
683
660
  * **When I follow "..." inside any "..."**
684
661
 
685
662
  Click a link within an element matching the given selector. Will try to be clever
@@ -715,13 +692,6 @@ deprecation notice. Decide for yourself whether you want to use them:
715
692
  Tests that a field with the given label is visible.
716
693
 
717
694
 
718
- * **When I wait for the page to load**
719
-
720
- Waits for the page to finish loading and AJAX requests to finish.
721
-
722
- More details [here](https://makandracards.com/makandra/12139-waiting-for-page-loads-and-ajax-requests-to-finish-with-capybara).
723
-
724
-
725
695
  * **When I perform basic authentication as ".../..." and go to ...**
726
696
 
727
697
  Performs HTTP basic authentication with the given credentials and visits the given path.
@@ -240,7 +240,7 @@ Feature: The `spreewald` binary
240
240
 
241
241
  Scenario: Print version
242
242
  When I run `spreewald --version`
243
- Then the output should contain "Spreewald 2."
243
+ Then the output should contain "Spreewald 3."
244
244
 
245
245
  When I run `spreewald -v`
246
- Then the output should contain "Spreewald 2."
246
+ Then the output should contain "Spreewald 3."
@@ -5,15 +5,8 @@ Then /^it should work(.+?)?$/ do |message|
5
5
  pending(message)
6
6
  end.overridable
7
7
 
8
- # nodoc
9
- Then 'debugger' do
10
- warn 'The step "Then debugger" will be removed in future versions of Spreewald. Please use "Then console" instead.'
11
- step 'console' # Alias
12
- end.overridable
13
-
14
8
  # Pauses test execution and opens an IRB shell with current context. Does not halt the application-
15
- # under-test. (Replaces the "Then debugger" step that has never been adequate
16
- # for its job)
9
+ # under-test.
17
10
  Then 'console' do
18
11
  require 'irb'
19
12
  ARGV.clear # IRB takes ARGV as its own arguments
@@ -30,9 +30,6 @@ end.overridable
30
30
  #
31
31
  # """
32
32
  #
33
- # Because of backwards-compatibility, the body currently only has to be a prefix
34
- # of the real body. However, this is deprecated and will be removed in a future
35
- # version. Use wildcards instead.
36
33
  # You may skip lines in the header, of course.
37
34
  Then /^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/ do |mode, type, raw_data|
38
35
  patiently do
@@ -70,26 +67,6 @@ ERROR
70
67
  end
71
68
  end.overridable
72
69
 
73
- # nodoc (deprecated)
74
- Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/ do |mode, query|
75
- warn "The step `an email should have been sent (from ...) (to ...) (cc ...) ...` has been deprecated in favor of `(an?|no)( HTML| plain-text|) e?mail should have been sent with:`"
76
- patiently do
77
- filename_method = Rails::VERSION::MAJOR < 3 ? 'original_filename' : 'filename'
78
- @mail = ActionMailer::Base.deliveries.find do |mail|
79
- [ query =~ /to "([^"]+)"/ && !mail.to.include?(MailFinder.resolve_email $1),
80
- query =~ /cc "([^"]+)"/ && !mail.cc.include?(MailFinder.resolve_email $1),
81
- query =~ /bcc "([^"]+)"/ && !mail.bcc.include?(MailFinder.resolve_email $1),
82
- query =~ /from "([^"]+)"/ && !mail.from.include?(MailFinder.resolve_email $1),
83
- query =~ /reply_to "([^"]+)"/ && !mail.reply_to.include?(MailFinder.resolve_email $1),
84
- query =~ /subject "([^"]+)"/ && !mail.subject.include?($1),
85
- query =~ /the attachments "([^"]+)"/ && $1.split(/\s*,\s*/).sort != Array(mail.attachments).collect(&:"#{filename_method}").sort
86
- ].none?
87
- end
88
- expectation = mode == 'no' ? 'not_to' : 'to'
89
- expect(@mail).send(expectation, be_present)
90
- end
91
- end.overridable
92
-
93
70
  # Please note that this step will only follow HTTP and HTTPS links.
94
71
  # Other links (such as mailto: or ftp:// links) are ignored.
95
72
  When /^I follow the (first|second|third)? ?link in the e?mail$/ do |index_in_words|
@@ -141,22 +118,3 @@ Then /^show me the e?mail( header)?s with:$/ do |only_header, raw_data|
141
118
 
142
119
  print MailFinder.show_mails(results.mails, only_header)
143
120
  end.overridable
144
-
145
- # nodoc (deprecated)
146
- Then /^that e?mail should( not)? have the following lines in the body:$/ do |negate, body|
147
- warn "The step /^that e?mail should( not)? have the following lines in the body:$/ has been deprecated in favor of the updated step /^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/."
148
- expectation = negate ? 'not_to' : 'to'
149
- mail = @mail || ActionMailer::Base.deliveries.last
150
- email_text_body = MailFinder.email_text_body(mail)
151
-
152
- body.to_s.strip.split(/\n/).each do |line|
153
- expect(email_text_body).send(expectation, include(line.strip))
154
- end
155
- end.overridable
156
-
157
- # nodoc (deprecated)
158
- Then /^that e?mail should have the following (?:|content in the )body:$/ do |body|
159
- warn "The step /^that e?mail should have the following( content in the)? body:$/ has been deprecated in favor of the updated step /^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/."
160
- mail = @mail || ActionMailer::Base.deliveries.last
161
- expect(MailFinder.email_text_body(mail)).to include(body.strip)
162
- end.overridable
@@ -201,10 +201,10 @@ Then /^I should( not)? see a field "([^"]*)"$/ do |negate, name|
201
201
  expectation = negate ? :not_to : :to
202
202
  patiently do
203
203
  begin
204
- # In old Capybaras find_field returns nil, so we assign it to `field`
205
- field = find_field(name)
204
+ # In old Capybaras find returns nil, so we assign it to `field`
205
+ field = find_with_disabled(:field, name)
206
206
  rescue Capybara::ElementNotFound
207
- # In Capybara 0.4+ #find_field raises an error instead of returning nil
207
+ # In Capybara 0.4+ #find raises an error instead of returning nil
208
208
  # We must explicitely reset the field variable from a previous patiently iteration
209
209
  field = nil
210
210
  end
@@ -327,7 +327,7 @@ end.overridable
327
327
  # Checks that an input field contains some value (allowing * as wildcard character)
328
328
  Then /^the "([^"]*)" field should (not )?contain "([^"]*)"$/ do |label, negate, expected_string|
329
329
  patiently do
330
- field = find_field(label)
330
+ field = find_with_disabled(:field, label)
331
331
  field_value = case field.tag_name
332
332
  when 'select'
333
333
  options = field.all('option')
@@ -347,7 +347,7 @@ end.overridable
347
347
  # Checks that a multiline textarea contains some value (allowing * as wildcard character)
348
348
  Then(/^the "(.*?)" field should (not )?contain:$/) do |label, negate, expected_string|
349
349
  patiently do
350
- field = find_field(label)
350
+ field = find_with_disabled(:field, label)
351
351
  expect(field.value.chomp).send(negate ? :not_to : :to, contain_with_wildcards(expected_string))
352
352
  end
353
353
  end.overridable
@@ -369,7 +369,7 @@ end.overridable
369
369
  # Checks that an input field was wrapped with a validation error
370
370
  Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_message|
371
371
  patiently do
372
- element = find_field(field)
372
+ element = find_with_disabled(:field, field)
373
373
  classes = element.find(:xpath, '..')[:class].split(' ')
374
374
 
375
375
  form_for_input = element.find(:xpath, 'ancestor::form[1]')
@@ -390,35 +390,17 @@ end.overridable
390
390
  Then /^the "([^\"]*)" field should( not)? have an error$/ do |label, negate|
391
391
  patiently do
392
392
  expectation = negate ? :not_to : :to
393
- field = find_field(label)
393
+ field = find_with_disabled(:field, label)
394
394
  expect(field[:id]).to be_present # prevent bad CSS selector if field lacks id
395
395
  expect(page).send(expectation, have_css(".field_with_errors ##{field[:id]}"))
396
396
  end
397
397
  end.overridable
398
398
 
399
- Then /^the "([^"]*)" field should have no error$/ do |field|
400
- warn 'The step /^the "([^"]*)" field should have no error$/ is deprecated and scheduled for removal. Use the step /^the "([^\"]*)" field should( not)? have an error$/ instead.'
401
- patiently do
402
- element = find_field(field)
403
- classes = element.find(:xpath, '..')[:class].split(' ')
404
- expect(classes).not_to include('field_with_errors')
405
- expect(classes).not_to include('error')
406
- end
407
- end.overridable
408
-
409
- Then /^the "([^"]*)" checkbox should( not)? be checked( and disabled)?$/ do |label, negate, disabled|
399
+ Then /^the "([^"]*)" checkbox should( not)? be checked?$/ do |label, negate|
410
400
  expectation = negate ? :not_to : :to
411
401
 
412
- if disabled
413
- warn 'The step /^the "([^"]*)" checkbox should( not)? be checked( and disabled)?$/ will lose the `and disabled` modifier in Spreewald 3. In that version, the step will find a checkbox regardless of whether it is disabled.'
414
- end
415
-
416
402
  patiently do
417
- field = if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
418
- find_field(label)
419
- else
420
- find_field(label, :disabled => !!disabled)
421
- end
403
+ field = find_with_disabled(:field, label)
422
404
  expect(field).send expectation, be_checked
423
405
  end
424
406
  end.overridable
@@ -489,7 +471,7 @@ end.overridable
489
471
 
490
472
  Then /^nothing should be selected for "([^"]*)"$/ do |field|
491
473
  patiently do
492
- select = find_field(field)
474
+ select = find_with_disabled(:field, field)
493
475
  begin
494
476
  selected_option = select.find(:xpath, ".//option[@selected = 'selected']") || select.all(:css, 'option').first
495
477
  value = selected_option ? selected_option.value : nil
@@ -509,11 +491,11 @@ Then /^"([^"]*)" should( not)? be an option for "([^"]*)"$/ do |value, negate, f
509
491
  patiently do
510
492
  if negate
511
493
  begin
512
- expect(find_field(field)).to have_no_css(*finder_arguments)
494
+ expect(find_with_disabled(:field, field)).to have_no_css(*finder_arguments)
513
495
  rescue Capybara::ElementNotFound
514
496
  end
515
497
  else
516
- expect(find_field(field)).to have_css(*finder_arguments)
498
+ expect(find_with_disabled(:field, field)).to have_css(*finder_arguments)
517
499
  end
518
500
  end
519
501
  end.overridable
@@ -542,18 +524,12 @@ end.overridable
542
524
  # Within a selenium test, the browser is asked whether the element is really visible
543
525
  # In a non-selenium test, we only check for `.hidden`, `.invisible` or `style: display:none`
544
526
  #
545
- # 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.
546
- #
547
527
  # More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
548
- Then /^(the tag )?"([^\"]+)" should( not)? be visible$/ do |tag, selector_or_text, hidden|
549
- if hidden
550
- warn "The step 'Then ... should not be visible' is prone to misunderstandings. Please use 'Then ... should be hidden' or 'Then I should not see ...' instead."
551
- end
552
-
528
+ Then /^(the tag )?"([^\"]+)" should be visible$/ do |tag, selector_or_text|
553
529
  options = {}
554
530
  tag ? options.store(:selector, selector_or_text) : options.store(:text, selector_or_text)
555
531
 
556
- hidden ? assert_hidden(options) : assert_visible(options)
532
+ assert_visible(options)
557
533
  end.overridable
558
534
 
559
535
  # Checks that an element is actually present and hidden, also considering styles.
@@ -621,12 +597,6 @@ Then /^"([^"]*)" should link to "([^"]*)"$/ do |link_label, target|
621
597
  end
622
598
  end.overridable
623
599
 
624
- # Checks that the result has content type `text/plain`
625
- Then /^I should get a text response$/ do
626
- warn 'The step /^I should get a text response$/ is deprecated and scheduled for removal. Use `I should get a response with content-type "text/plain"` instead.'
627
- step 'I should get a response with content-type "text/plain"'
628
- end.overridable
629
-
630
600
  # Click a link within an element matching the given selector. Will try to be clever
631
601
  # and disregard elements that don't contain a matching link.
632
602
  #
@@ -695,11 +665,11 @@ end.overridable
695
665
  # Tests that a field with the given label is visible.
696
666
  Then /^the "([^\"]*)" field should( not)? be visible$/ do |label, hidden|
697
667
  if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
698
- field = find_field(label)
668
+ field = find_with_disabled(:field, label)
699
669
  else
700
670
  # Capybara 2.1+ won't usually interact with hidden elements,
701
671
  # but we can override this behavior by passing { visible: false }
702
- field = find_field(label, :visible => false)
672
+ field = find_with_disabled(:field, label, :visible => false)
703
673
  end
704
674
 
705
675
  selector = "##{field['id']}"
@@ -711,20 +681,6 @@ Then /^the "([^\"]*)" field should( not)? be visible$/ do |label, hidden|
711
681
  end
712
682
  end.overridable
713
683
 
714
- # Waits for the page to finish loading and AJAX requests to finish.
715
- #
716
- # More details [here](https://makandracards.com/makandra/12139-waiting-for-page-loads-and-ajax-requests-to-finish-with-capybara).
717
- When /^I wait for the page to load$/ do
718
- warn 'The step /^I wait for the page to load$/ is deprecated and scheduled for removal. Please see https://github.com/makandra/spreewald/issues/136'
719
- if javascript_capable?
720
- patiently do
721
- # when no jQuery is loaded, we assume there are no pending AJAX requests
722
- page.execute_script("return typeof jQuery === 'undefined' || $.active == 0;").should == true
723
- end
724
- end
725
- page.has_content? ''
726
- end.overridable
727
-
728
684
  # Performs HTTP basic authentication with the given credentials and visits the given path.
729
685
  #
730
686
  # More details [here](https://makandracards.com/makandra/971-perform-http-basic-authentication-in-cucumber).
@@ -761,7 +717,7 @@ end.overridable
761
717
  # Tests whether a select field is sorted. Uses Array#natural_sort, if defined;
762
718
  # Array#sort else.
763
719
  Then /^the "(.*?)" select should( not)? be sorted$/ do |label, negate|
764
- select = find_field(label)
720
+ select = find_with_disabled(:field, label)
765
721
  options = select.all('option').reject { |o| o.value.blank? }
766
722
  option_texts = options.collect(&:text)
767
723
 
@@ -15,6 +15,11 @@ class MailFinder
15
15
  end
16
16
  end
17
17
 
18
+ # Interpret all lines as body if there are no header-link lines
19
+ if conditions.blank?
20
+ body = [header, body].join("\n\n")
21
+ end
22
+
18
23
  filename_method = Rails::VERSION::MAJOR < 3 ? 'original_filename' : 'filename'
19
24
  matching_header = ActionMailer::Base.deliveries.select do |mail|
20
25
  [ conditions[:to].nil? || mail.to.include?(resolve_email conditions[:to]),
@@ -82,14 +87,13 @@ class MailFinder
82
87
  end
83
88
 
84
89
  def expected_body_regex(expected_body)
85
- # To stay backwards-compatible, this will only check whether an email
86
- # starts with the expected body.
87
90
  expected = '\A\n' + Regexp.quote(expected_body.strip) + '\n\Z'
88
91
  expected.gsub! '\n\*\n', '\n[\s\S]*\n'
89
92
  expected.gsub! '\*\n', '.*\n'
93
+ expected.gsub! '\n\*', '\n.*'
90
94
 
91
95
  expected.gsub! '\A\n', '\A'
92
- expected.gsub! '\n\Z', '' # Change '' to '\Z' to force that the whole body matches
96
+ expected.gsub! '\n\Z', '\Z'
93
97
 
94
98
  Regexp.new(expected)
95
99
  end
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '2.99.2'
2
+ VERSION = '3.0.3'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.99.2)
4
+ spreewald (3.0.3)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.99.2)
4
+ spreewald (3.0.3)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.99.2)
4
+ spreewald (3.0.3)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.99.2)
4
+ spreewald (3.0.3)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -38,5 +38,29 @@ class SpreewaldMailer < ApplicationMailer
38
38
  email
39
39
  end
40
40
 
41
+ def html_email_with_specific_line
42
+ email
43
+ end
44
+
45
+ def text_email_with_specific_line
46
+ email
47
+ end
48
+
49
+ def html_email_for_successful_test_without_header
50
+ email
51
+ end
52
+
53
+ def text_email_for_successful_test_without_header
54
+ email
55
+ end
56
+
57
+ def html_email_for_failed_test_without_header
58
+ email
59
+ end
60
+
61
+ def text_email_for_failed_test_without_header
62
+ email
63
+ end
64
+
41
65
  end
42
66
 
@@ -34,6 +34,36 @@ class EmailsController < ApplicationController
34
34
  render_nothing
35
35
  end
36
36
 
37
+ def send_html_email_with_specific_line
38
+ deliver :html_email_with_specific_line
39
+ render_nothing
40
+ end
41
+
42
+ def send_text_email_with_specific_line
43
+ deliver :text_email_with_specific_line
44
+ render_nothing
45
+ end
46
+
47
+ def send_html_email_for_successful_test_without_header
48
+ deliver :html_email_for_successful_test_without_header
49
+ render_nothing
50
+ end
51
+
52
+ def send_text_email_for_successful_test_without_header
53
+ deliver :text_email_for_successful_test_without_header
54
+ render_nothing
55
+ end
56
+
57
+ def send_html_email_for_failed_test_without_header
58
+ deliver :html_email_for_failed_test_without_header
59
+ render_nothing
60
+ end
61
+
62
+ def send_text_email_for_failed_test_without_header
63
+ deliver :text_email_for_failed_test_without_header
64
+ render_nothing
65
+ end
66
+
37
67
  private
38
68
 
39
69
  def deliver(method_name)
@@ -41,6 +41,30 @@ class Mailer < ActionMailer::Base
41
41
  email
42
42
  end
43
43
 
44
+ def html_email_with_specific_line
45
+ email
46
+ end
47
+
48
+ def text_email_with_specific_line
49
+ email
50
+ end
51
+
52
+ def html_email_for_successful_test_without_header
53
+ email
54
+ end
55
+
56
+ def text_email_for_successful_test_without_header
57
+ email
58
+ end
59
+
60
+ def html_email_for_failed_test_without_header
61
+ email
62
+ end
63
+
64
+ def text_email_for_failed_test_without_header
65
+ email
66
+ end
67
+
44
68
  else
45
69
 
46
70
  def email
@@ -66,6 +90,30 @@ class Mailer < ActionMailer::Base
66
90
  email
67
91
  end
68
92
 
93
+ def html_email_with_specific_line
94
+ email
95
+ end
96
+
97
+ def text_email_with_specific_line
98
+ email
99
+ end
100
+
101
+ def html_email_for_successful_test_without_header
102
+ email
103
+ end
104
+
105
+ def text_email_for_successful_test_without_header
106
+ email
107
+ end
108
+
109
+ def html_email_for_failed_test_without_header
110
+ email
111
+ end
112
+
113
+ def text_email_for_failed_test_without_header
114
+ email
115
+ end
116
+
69
117
  end
70
118
 
71
119
  end
@@ -4,6 +4,9 @@
4
4
  = label_tag 'checked_name', 'Checked'
5
5
  = check_box_tag 'checked_name', 'value', checked
6
6
 
7
+ = label_tag 'checked_disabled_name', 'Checked disabled'
8
+ = check_box_tag 'checked_disabled_name', 'value', checked, disabled: true
9
+
7
10
  - checked = false
8
11
  = label_tag 'unchecked_name', 'Unchecked'
9
12
  = check_box_tag 'unchecked_name', 'value', checked
@@ -69,3 +69,4 @@
69
69
 
70
70
  = label_tag 'enabled_radio_2', 'Enabled radio button #2'
71
71
  = radio_button_tag 'enabled_radio', '2', selected
72
+
@@ -3,6 +3,9 @@
3
3
  = label_tag 'text_control', 'Text control'
4
4
  = text_field_tag 'text_control', 'Text control value'
5
5
 
6
+ = label_tag 'disabled_text_control', 'Disabled text control'
7
+ = text_field_tag 'disabled_text_control', 'Disabled text control value', disabled: true
8
+
6
9
  = label_tag 'select_control', 'Select control'
7
10
  = select_tag 'select_control', options_for_select([['Label 1', 'value1'], ['Label 2', 'value2'], ['Label 3', 'value3']], 'value2')
8
11
 
@@ -26,4 +29,4 @@
26
29
  = label_tag 'radio_button_control_radio1', 'Radio 1'
27
30
  = radio_button_tag 'radio_button_control', 'radio1'
28
31
  = label_tag 'radio_button_control_radio2', 'Radio 2'
29
- = radio_button_tag 'radio_button_control', 'radio2'
32
+ = radio_button_tag 'radio_button_control', 'radio2'
@@ -5,6 +5,9 @@
5
5
  .form-group.field_with_errors
6
6
  = label_tag 'textarea_control_1', 'B is invalid'
7
7
  = text_area_tag 'textarea_control_1', "Textarea control line 1\nTextarea control line 2\n"
8
+ .form-group.field_with_errors
9
+ = label_tag 'disabled_control', 'Disabled is invalid'
10
+ = text_field_tag 'disabled_control', "Disabled control value", disabled: true
8
11
  .form-group
9
12
  = label_tag 'textarea_control_2', 'C'
10
13
  = text_area_tag 'textarea_control_2', "Textarea control line 1\nTextarea control line 2\n"
@@ -0,0 +1,5 @@
1
+ !!!
2
+ %html(lang="en" xmlns="http://www.w3.org/1999/xhtml")
3
+ %body
4
+ %p
5
+ Bye
@@ -0,0 +1,7 @@
1
+ !!!
2
+ %html(lang="en" xmlns="http://www.w3.org/1999/xhtml")
3
+ %body
4
+ %p
5
+ Hello
6
+ %p
7
+ Bye
@@ -0,0 +1,11 @@
1
+ !!!
2
+ %html(lang="en" xmlns="http://www.w3.org/1999/xhtml")
3
+ %body
4
+ %p
5
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
6
+
7
+ %p
8
+ Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. VERY IMPORTANT SENTENCE. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
9
+
10
+ %p
11
+ Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
@@ -0,0 +1,5 @@
1
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
2
+
3
+ Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. VERY IMPORTANT SENTENCE. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
4
+
5
+ Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
@@ -11,6 +11,12 @@ Rails.application.routes.draw do
11
11
  get '/emails/send_html_email_with_links', to: 'emails#send_html_email_with_links'
12
12
  get '/emails/send_text_email_with_links', to: 'emails#send_text_email_with_links'
13
13
  get '/emails/send_html_email_with_linebreaks', to: 'emails#send_html_email_with_linebreaks'
14
+ get '/emails/send_html_email_with_specific_line', to: 'emails#send_html_email_with_specific_line'
15
+ get '/emails/send_text_email_with_specific_line', to: 'emails#send_text_email_with_specific_line'
16
+ get '/emails/send_html_email_for_successful_test_without_header', to: 'emails#send_html_email_for_successful_test_without_header'
17
+ get '/emails/send_text_email_for_successful_test_without_header', to: 'emails#send_text_email_for_successful_test_without_header'
18
+ get '/emails/send_html_email_for_failed_test_without_header', to: 'emails#send_html_email_for_failed_test_without_header'
19
+ get '/emails/send_text_email_for_failed_test_without_header', to: 'emails#send_text_email_for_failed_test_without_header'
14
20
 
15
21
  get '/forms/checkbox_form', to: 'forms#checkbox_form'
16
22
  get '/forms/disabled_elements', to: 'forms#disabled_elements'
@@ -200,7 +200,7 @@ Feature: Test Spreewald's email steps
200
200
  '''
201
201
  """
202
202
 
203
- # Test body with wildcard not at the end of a line
203
+ # Test body with to few paragraphs
204
204
  Then the following multiline step should fail:
205
205
  """
206
206
  Then an email should have been sent with:
@@ -211,71 +211,25 @@ Feature: Test Spreewald's email steps
211
211
  Subject: SUBJECT
212
212
 
213
213
  Body
214
- *th
215
- line
216
- break
217
- '''
218
- """
219
-
220
- Scenario: Scenario: /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/
221
- When I go to "/emails/send_email"
222
-
223
- # Test with correct conditions
224
- Then the following multiline step should succeed:
225
- """
226
- Then an email should have been sent from "from@example.com" to "to@example.com" cc "cc@example.com" bcc "bcc@example.com" and the subject "SUBJECT" and the attachments "attached_file.pdf"
227
- """
228
-
229
- # Test with wrong conditions
230
- Then the following multiline step should fail:
231
- """
232
- Then an email should have been sent from "from@example.com" to "to@example.com" cc "cc@example.com" bcc "wrong_bcc@example.com" and the subject "SUBJECT" and the attachments "attached_file.pdf"
233
- """
234
-
235
- Scenario: /^that e?mail should have the following lines in the body:$/
236
- When I go to "/emails/send_email"
237
-
238
- # Test with correct body lines
239
- Then the following multiline step should succeed:
240
- """
241
- Then that email should have the following lines in the body:
242
- '''
243
214
  with
244
215
  line
245
216
  '''
246
217
  """
247
218
 
248
- # Test with wrong body lines
219
+ # Test body with wildcard not at the end of a line
249
220
  Then the following multiline step should fail:
250
221
  """
251
- Then that email should have the following lines in the body:
252
- '''
253
- wrong
254
- line
255
- '''
256
- """
257
-
258
-
259
- Scenario: /^that e?mail should have the following( content in the)? body$/
260
- When I go to "/emails/send_email"
261
-
262
- # Test with correct body lines
263
- Then the following multiline step should succeed:
264
- """
265
- Then that email should have the following content in the body:
266
- '''
267
- with
268
- line
222
+ Then an email should have been sent with:
269
223
  '''
270
- """
224
+ From: from@example.com
225
+ Reply-To: reply-to@example.com
226
+ To: to@example.com
227
+ Subject: SUBJECT
271
228
 
272
- # Test with wrong body lines
273
- Then the following multiline step should fail:
274
- """
275
- Then that email should have the following body:
276
- '''
277
- wrong
229
+ Body
230
+ *th
278
231
  line
232
+ break
279
233
  '''
280
234
  """
281
235
 
@@ -332,6 +286,165 @@ Feature: Test Spreewald's email steps
332
286
  '''
333
287
  """
334
288
 
289
+ When I clear my emails
290
+ And I go to "/emails/send_html_email_with_specific_line"
291
+
292
+ Then the following multiline step should succeed:
293
+ """
294
+ Then an email should have been sent with:
295
+ '''
296
+ From: from@example.com
297
+ Reply-To: reply-to@example.com
298
+ To: to@example.com
299
+ Subject: SUBJECT
300
+
301
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr*
302
+ *VERY IMPORTANT SENTENCE*
303
+ Ut wisi enim ad minim veniam*
304
+ '''
305
+ """
306
+
307
+ When I clear my emails
308
+ And I go to "/emails/send_text_email_with_specific_line"
309
+
310
+ Then the following multiline step should succeed:
311
+ """
312
+ Then an email should have been sent with:
313
+ '''
314
+ From: from@example.com
315
+ Reply-To: reply-to@example.com
316
+ To: to@example.com
317
+ Subject: SUBJECT
318
+
319
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr*
320
+
321
+ *VERY IMPORTANT SENTENCE*
322
+
323
+ Ut wisi enim ad minim veniam*
324
+ '''
325
+ """
326
+
327
+ # Tests without header
328
+ When I clear my emails
329
+ And I go to "/emails/send_text_email_for_successful_test_without_header"
330
+ Then the following multiline step should succeed:
331
+ """
332
+ Then an email should have been sent with:
333
+ '''
334
+ Hello
335
+
336
+ Bye
337
+ '''
338
+ """
339
+ And the following multiline step should succeed:
340
+ """
341
+ Then an email should have been sent with:
342
+ '''
343
+ To: to@example.com
344
+
345
+ Hello
346
+
347
+ Bye
348
+ '''
349
+ """
350
+ But the following multiline step should fail:
351
+ """
352
+ Then an email should have been sent with:
353
+ '''
354
+ To: wrong-guy@example.com
355
+
356
+ Hello
357
+
358
+ Bye
359
+ '''
360
+ """
361
+
362
+ When I clear my emails
363
+ And I go to "/emails/send_text_email_for_failed_test_without_header"
364
+ Then the following multiline step should fail:
365
+ """
366
+ Then an email should have been sent with:
367
+ '''
368
+ Hello
369
+
370
+ Bye
371
+ '''
372
+ """
373
+ But the following multiline step should succeed:
374
+ """
375
+ Then an email should have been sent with:
376
+ '''
377
+ Bye
378
+ '''
379
+ """
380
+ And the following multiline step should succeed:
381
+ """
382
+ Then an email should have been sent with:
383
+ '''
384
+ To: to@example.com
385
+
386
+ Bye
387
+ '''
388
+ """
389
+
390
+ When I clear my emails
391
+ And I go to "/emails/send_html_email_for_successful_test_without_header"
392
+ Then the following multiline step should succeed:
393
+ """
394
+ Then an email should have been sent with:
395
+ '''
396
+ Hello
397
+ Bye
398
+ '''
399
+ """
400
+ And the following multiline step should succeed:
401
+ """
402
+ Then an email should have been sent with:
403
+ '''
404
+ To: to@example.com
405
+
406
+ Hello
407
+ Bye
408
+ '''
409
+ """
410
+ But the following multiline step should fail:
411
+ """
412
+ Then an email should have been sent with:
413
+ '''
414
+ To: wrong-guy@example.com
415
+
416
+ Hello
417
+ Bye
418
+ '''
419
+ """
420
+
421
+ When I clear my emails
422
+ And I go to "/emails/send_html_email_for_failed_test_without_header"
423
+ Then the following multiline step should fail:
424
+ """
425
+ Then an email should have been sent with:
426
+ '''
427
+ Hello
428
+ Bye
429
+ '''
430
+ """
431
+ But the following multiline step should succeed:
432
+ """
433
+ Then an email should have been sent with:
434
+ '''
435
+ Bye
436
+ '''
437
+ """
438
+ And the following multiline step should succeed:
439
+ """
440
+ Then an email should have been sent with:
441
+ '''
442
+ To: to@example.com
443
+
444
+ Bye
445
+ '''
446
+ """
447
+
335
448
  Scenario: /^I follow the (first|second|third)? ?link in the e?mail$/ (HTML e-mail body)
336
449
  When I go to "/emails/send_html_email_with_links"
337
450
  And I follow the first link in the email
@@ -4,6 +4,7 @@ Feature: Web steps
4
4
  When I go to "/forms/form1"
5
5
  Then the "Text control" field should contain "Text control value"
6
6
  Then the "Text control" field should not contain "false text"
7
+ Then the "Disabled text control" field should contain "Disabled text control value"
7
8
  Then the "Select control" field should contain "Label 2"
8
9
  Then the "Select control without selection" field should contain "Label 1"
9
10
  Then the "Textarea control" field should contain "Textarea control value"
@@ -35,17 +36,14 @@ Feature: Web steps
35
36
  When I go to "/forms/invalid_form"
36
37
  Then the "A" field should have an error
37
38
  Then the "B" field should have an error
39
+ Then the "Disabled" field should have an error
38
40
  Then the "C" field should not have an error
39
41
 
40
42
  Scenario: /^the "([^"]*)" field should have the error "([^"]*)"$/
41
43
  When I go to "/forms/invalid_form"
42
44
  Then the "A" field should have the error "is invalid"
43
45
  Then the "B" field should have the error "is invalid"
44
-
45
-
46
- Scenario: /^the "([^"]*)" field should have no error$/
47
- When I go to "/forms/invalid_form"
48
- Then the "C" field should have no error
46
+ Then the "Disabled" field should have the error "is invalid"
49
47
 
50
48
 
51
49
  Scenario: /^I should see a form with the following values:$/
@@ -93,6 +91,7 @@ Feature: Web steps
93
91
  Scenario: /^the "([^"]*)" checkbox should( not)? be checked$/
94
92
  When I go to "/forms/checkbox_form"
95
93
  Then the "Checked" checkbox should be checked
94
+ And the "Checked disabled" checkbox should be checked
96
95
  And the "Unchecked" checkbox should not be checked
97
96
 
98
97
 
@@ -135,7 +134,7 @@ Feature: Web steps
135
134
  But the "unsorted" select should not be sorted
136
135
 
137
136
 
138
- Scenario: /^Then (the tag )?"..." should( not)? be visible$/
137
+ Scenario: /^Then (the tag )?"..." should be visible$/
139
138
  When I go to "/static_pages/visibility"
140
139
  Then "hidden ümläüt" should be hidden
141
140
  And "visible ümläüt" should be visible
@@ -145,13 +144,13 @@ Feature: Web steps
145
144
 
146
145
 
147
146
  @javascript
148
- Scenario: /^Then (the tag )?"..." should( not)? be visible$/ with javascript
147
+ Scenario: /^Then (the tag )?"..." should be visible$/ with javascript
149
148
  When I go to "/static_pages/visibility"
150
- Then "hidden ümläüt" should not be visible
149
+ Then "hidden ümläüt" should be hidden
151
150
  And "visible ümläüt" should be visible
152
151
  And a hidden string with quotes should not be visible
153
152
  And a visible string with quotes should be visible
154
- And "hidden ümläüt" should not be visible
153
+ And "hidden ümläüt" should be hidden
155
154
 
156
155
 
157
156
  Scenario: /^the "([^\"]*)" field should( not)? be visible$/
@@ -161,7 +160,7 @@ Feature: Web steps
161
160
 
162
161
  Scenario: /^the "([^\"]*)" field should( not)? be visible within (.*[^:])$/
163
162
  When I go to "/static_pages/visibility"
164
- Then "content" should not be visible within ".inside"
163
+ Then "content" should be hidden within ".inside"
165
164
  But "content" should be visible within ".outside"
166
165
 
167
166
  @javascript
@@ -302,6 +301,12 @@ Feature: Web steps
302
301
  And I should not see a link labeled "First visible link" within ".unrelated-element"
303
302
 
304
303
 
304
+ Scenario: /^I should( not)? see a field "([^"]*)"$/
305
+ When I go to "/forms/disabled_elements"
306
+ Then I should see a field "Enabled field #1"
307
+ And I should see a field "Disabled field #1"
308
+
309
+
305
310
  Scenario: /^I should( not)? see the (?:number|amount) ([\-\d,\.]+)(?: (.*?))?$/
306
311
  When I am on "/static_pages/numbers"
307
312
  Then I should see the number 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreewald
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.99.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-04 00:00:00.000000000 Z
11
+ date: 2021-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -157,11 +157,9 @@ files:
157
157
  - lib/spreewald/browser_tab_steps.rb
158
158
  - lib/spreewald/development_steps.rb
159
159
  - lib/spreewald/email_steps.rb
160
- - lib/spreewald/file_attachment_steps.rb
161
160
  - lib/spreewald/session_steps.rb
162
161
  - lib/spreewald/table_steps.rb
163
162
  - lib/spreewald/time_steps.rb
164
- - lib/spreewald/timecop_steps.rb
165
163
  - lib/spreewald/web_steps.rb
166
164
  - lib/spreewald_support/comparison.rb
167
165
  - lib/spreewald_support/compatibility.rb
@@ -350,9 +348,15 @@ files:
350
348
  - tests/shared/app/views/mailer/email.text.erb
351
349
  - tests/shared/app/views/mailer/email_crlf.text.erb
352
350
  - tests/shared/app/views/mailer/email_with_umlauts.text.erb
351
+ - tests/shared/app/views/mailer/html_email_for_failed_test_without_header.haml
352
+ - tests/shared/app/views/mailer/html_email_for_successful_test_without_header.haml
353
353
  - tests/shared/app/views/mailer/html_email_with_linebreaks.html
354
354
  - tests/shared/app/views/mailer/html_email_with_links.haml
355
+ - tests/shared/app/views/mailer/html_email_with_specific_line.haml
356
+ - tests/shared/app/views/mailer/text_email_for_failed_test_without_header.text.erb
357
+ - tests/shared/app/views/mailer/text_email_for_successful_test_without_header.text.erb
355
358
  - tests/shared/app/views/mailer/text_email_with_links.text.erb
359
+ - tests/shared/app/views/mailer/text_email_with_specific_line.text.erb
356
360
  - tests/shared/app/views/spreewald_mailer
357
361
  - tests/shared/app/views/static_pages/click_on.html.haml
358
362
  - tests/shared/app/views/static_pages/home.html.haml
@@ -584,9 +588,15 @@ test_files:
584
588
  - tests/shared/app/views/mailer/email.text.erb
585
589
  - tests/shared/app/views/mailer/email_crlf.text.erb
586
590
  - tests/shared/app/views/mailer/email_with_umlauts.text.erb
591
+ - tests/shared/app/views/mailer/html_email_for_failed_test_without_header.haml
592
+ - tests/shared/app/views/mailer/html_email_for_successful_test_without_header.haml
587
593
  - tests/shared/app/views/mailer/html_email_with_linebreaks.html
588
594
  - tests/shared/app/views/mailer/html_email_with_links.haml
595
+ - tests/shared/app/views/mailer/html_email_with_specific_line.haml
596
+ - tests/shared/app/views/mailer/text_email_for_failed_test_without_header.text.erb
597
+ - tests/shared/app/views/mailer/text_email_for_successful_test_without_header.text.erb
589
598
  - tests/shared/app/views/mailer/text_email_with_links.text.erb
599
+ - tests/shared/app/views/mailer/text_email_with_specific_line.text.erb
590
600
  - tests/shared/app/views/spreewald_mailer
591
601
  - tests/shared/app/views/static_pages/click_on.html.haml
592
602
  - tests/shared/app/views/static_pages/home.html.haml
@@ -1,22 +0,0 @@
1
- # 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.
2
- Given /^the file "([^"]*)" was attached(?: as (?:([^"]*)\/)?([^"]*))? to the ([^"]*) above(?: at "([^"]*)")?$/ do
3
- |path_to_file, container_name, relation_name, model_name, time_string|
4
-
5
- warn "The step 'the file ... was attached to the ... above' will soon be removed from Spreewald, because we want Spreewald to be a library of steps that interact with a user interface and instead of manipulating the database directly. If you wish to further use this step please copy it over to your project's own steps."
6
-
7
- object = model_name.camelize.constantize.last
8
- time = Time.parse(time_string) if time_string.present?
9
- relation_name ||= 'file'
10
-
11
- if container_name.present?
12
- container = container_name.camelize.constantize.new # Image.file = File... owner: gallery
13
- container.owner = object
14
- container.created_at = time if time
15
- else
16
- container = object # Person.avatar = File...
17
- end
18
-
19
- container.send("#{relation_name}=", File.new(path_to_file))
20
- container.updated_at = time if time
21
- container.save!
22
- end.overridable
@@ -1,9 +0,0 @@
1
- # nodoc
2
- # FILE_COMMENT_END
3
-
4
- warn <<-WARNING
5
- Warning: The file spreewald/timecop_steps.rb is deprecated. It was moved to
6
- spreewald/time_steps.rb. Please require the new file instead.
7
- WARNING
8
-
9
- require 'spreewald/time_steps'