spreewald 2.99.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71f40dbc5a327e21940b95c4a4a9b1946e0c30b2090e3f46e927b81f3f44a18b
4
- data.tar.gz: c464bee9033caa6ae2b32984058aa0e37128483a2aa299780e60297b5c81b7d4
3
+ metadata.gz: 64749212dae1262a16bb92a588740444cf7ede78c5980fbdf15f66271a4b081d
4
+ data.tar.gz: 7384baaed65e17289ff4d4c52874e1c257b315b0e9026fac51bbea9a414f4141
5
5
  SHA512:
6
- metadata.gz: a927120e6558399206bbd0c97e08c7410f7af5e700b1756daa091e961f9407c237509496791d4dc8f58a7c3e74ab3b78a6b97bca2b1bffa1dc1824ebf999a040
7
- data.tar.gz: 12964e9c67396df967c29d1fa3925b6e01f0d0ba747ed016d15fa1cbee2c02e8b71173f6cf57e953cec9ad0d3df7dba6caf71d253e54739e3444c1b22687c2ef
6
+ metadata.gz: e06ba20e5252696bd8ce7aecb6f3a6f9f21eb16c3e2f7ba2cb6223bdfdfdf1cb05c34ada79e06bcd94631ea7288e802fab3f9cce98f8d59d34f7b0b9117300c3
7
+ data.tar.gz: d09e69ad26c4e76a09bfaa44989bcd870b1eb160de410be081bf0d40889e3a7ffc901e02c7e208538e8c92719752a3cb7fa396a9f7dada600c257dcbcf72fef3
data/CHANGELOG.md CHANGED
@@ -3,16 +3,40 @@ 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.3
7
- - Introduce wildcard for the beginning of a line. (see issue #155)
8
- - This will allow you to check for a specific sentence inside the body
6
+ ## 3.0.0
9
7
 
10
- ## 2.99.2
11
-
12
- - Fix deduplication of linebreaks for html mails in mail finder. (see issue [#153](https://github.com/makandra/spreewald/issues/153))
13
-
14
- ## 2.99.1
8
+ ### Breaking changes
15
9
 
10
+ - The following steps have been removed:
11
+ - `/^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))
12
+ - `/^the "([^"]*)" field should have no error$/` (see [#134](https://github.com/makandra/spreewald/issues/134))
13
+ - `/^I should get a text response$/` (see [#135](https://github.com/makandra/spreewald/issues/135))
14
+ - `/^I wait for the page to load$/` (see [#136](https://github.com/makandra/spreewald/issues/136))
15
+ - `debugger` (was an alias for `console`)
16
+ - 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)):
17
+ - `/^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/`
18
+ - `/^that e?mail should( not)? have the following lines in the body$/`
19
+ - `/^that e?mail should have the following (?:|content in the )body:$/`
20
+ - 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.
21
+ - 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 "..."`)
22
+ - The file `lib/spreewald/timecop_steps.rb` was removed (was an alias for `lib/spreewald/time_steps.rb`).
23
+ - The step `(an?|no)( HTML| plain-text|) e?mail should have been sent with:` does now require that the whole body is matched.
24
+ - 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.
25
+
26
+ The following steps have been adjusted:
27
+ - `I should( not)? see a field "..."`
28
+ - `the "..." field should( not)? contain "..."`
29
+ - `I should see a form with the following values:`
30
+ - `the "..." field should have the error "..."`
31
+ - `the "..." field should( not)? have an error`
32
+ - `the "..." checkbox should( not)? be checked`
33
+ - `"..." should be selected for "..."`
34
+ - `nothing should be selected for "..."`
35
+ - `"..." should( not)? be an option for "..."`
36
+ - `the "..." field should( not)? be visible`
37
+ - `the "..." select should( not)? be sorted`
38
+
39
+ ### Compatible changes
16
40
  - Reintroduced support for emails with CRLF line ending
17
41
 
18
42
  ## 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
 
@@ -60,7 +60,7 @@ class MailFinder
60
60
  def email_text_body(mail, type = '')
61
61
  body = if mail.html_part && type != 'plain-text'
62
62
  dom = Nokogiri::HTML(mail.html_part.body.to_s)
63
- dom.at_css('body').text.gsub(/[\r\n]+/, "\n")
63
+ dom.at_css('body').text.gsub(/\n\n/, "\n")
64
64
  elsif mail.text_part && type != 'HTML'
65
65
  mail.text_part.body.to_s
66
66
  else
@@ -82,15 +82,12 @@ class MailFinder
82
82
  end
83
83
 
84
84
  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
85
  expected = '\A\n' + Regexp.quote(expected_body.strip) + '\n\Z'
88
86
  expected.gsub! '\n\*\n', '\n[\s\S]*\n'
89
87
  expected.gsub! '\*\n', '.*\n'
90
- expected.gsub! '\n\*', '\n.*'
91
88
 
92
89
  expected.gsub! '\A\n', '\A'
93
- expected.gsub! '\n\Z', '' # Change '' to '\Z' to force that the whole body matches
90
+ expected.gsub! '\n\Z', '\Z'
94
91
 
95
92
  Regexp.new(expected)
96
93
  end
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '2.99.3'
2
+ VERSION = '3.0.0'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.99.3)
4
+ spreewald (3.0.0)
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.3)
4
+ spreewald (3.0.0)
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.3)
4
+ spreewald (3.0.0)
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.3)
4
+ spreewald (3.0.0)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -34,17 +34,5 @@ class SpreewaldMailer < ApplicationMailer
34
34
  email
35
35
  end
36
36
 
37
- def html_email_with_linebreaks
38
- email
39
- end
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
37
  end
50
38
 
@@ -29,21 +29,6 @@ class EmailsController < ApplicationController
29
29
  render_nothing
30
30
  end
31
31
 
32
- def send_html_email_with_linebreaks
33
- deliver :html_email_with_linebreaks
34
- render_nothing
35
- end
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
32
  private
48
33
 
49
34
  def deliver(method_name)
@@ -37,18 +37,6 @@ class Mailer < ActionMailer::Base
37
37
  email
38
38
  end
39
39
 
40
- def html_email_with_linebreaks
41
- email
42
- end
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
40
  else
53
41
 
54
42
  def email
@@ -74,14 +62,6 @@ class Mailer < ActionMailer::Base
74
62
  email
75
63
  end
76
64
 
77
- def html_email_with_specific_line
78
- email
79
- end
80
-
81
- def text_email_with_specific_line
82
- email
83
- end
84
-
85
65
  end
86
66
 
87
67
  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"
@@ -10,9 +10,6 @@ Rails.application.routes.draw do
10
10
  get '/emails/send_email_with_umlauts', to: 'emails#send_email_with_umlauts'
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
- 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
13
 
17
14
  get '/forms/checkbox_form', to: 'forms#checkbox_form'
18
15
  get '/forms/disabled_elements', to: 'forms#disabled_elements'
@@ -130,7 +130,6 @@ Feature: Test Spreewald's email steps
130
130
  breaks
131
131
  '''
132
132
  """
133
-
134
133
  # Test with incorrect To header
135
134
  Then the following multiline step should fail:
136
135
  """
@@ -201,7 +200,7 @@ Feature: Test Spreewald's email steps
201
200
  '''
202
201
  """
203
202
 
204
- # Test body with wildcard not at the end of a line
203
+ # Test body with to few paragraphs
205
204
  Then the following multiline step should fail:
206
205
  """
207
206
  Then an email should have been sent with:
@@ -212,16 +211,13 @@ Feature: Test Spreewald's email steps
212
211
  Subject: SUBJECT
213
212
 
214
213
  Body
215
- t*e
214
+ with
216
215
  line
217
- break
218
216
  '''
219
217
  """
220
218
 
221
- When I clear my emails
222
- And I go to "/emails/send_crlf_email"
223
-
224
- Then the following multiline step should succeed:
219
+ # Test body with wildcard not at the end of a line
220
+ Then the following multiline step should fail:
225
221
  """
226
222
  Then an email should have been sent with:
227
223
  '''
@@ -231,52 +227,17 @@ Feature: Test Spreewald's email steps
231
227
  Subject: SUBJECT
232
228
 
233
229
  Body
234
- with
235
- CRLF
230
+ *th
236
231
  line
237
- breaks
238
- '''
239
- """
240
-
241
- When I clear my emails
242
- And I go to "/emails/send_email_with_umlauts"
243
-
244
- Then the following multiline step should succeed:
245
- """
246
- Then an email should have been sent with:
247
- '''
248
- From: from@example.com
249
- Reply-To: reply-to@example.com
250
- To: to@example.com
251
- Subject: SUBJECT
252
-
253
- Viele Grüße
232
+ break
254
233
  '''
255
234
  """
256
235
 
257
236
  When I clear my emails
258
- And I go to "/emails/send_html_email_with_linebreaks"
237
+ And I go to "/emails/send_crlf_email"
259
238
 
260
239
  Then the following multiline step should succeed:
261
- """
262
- Then an email should have been sent with:
263
- '''
264
- From: from@example.com
265
- Reply-To: reply-to@example.com
266
- To: to@example.com
267
- Subject: SUBJECT
268
-
269
- Hello!
270
- Bye!
271
- '''
272
240
  """
273
-
274
- # Test body with wildcard at the begin of a line
275
- When I clear my emails
276
- And I go to "/emails/send_html_email_with_specific_line"
277
-
278
- Then the following multiline step should succeed:
279
- """
280
241
  Then an email should have been sent with:
281
242
  '''
282
243
  From: from@example.com
@@ -284,14 +245,16 @@ Feature: Test Spreewald's email steps
284
245
  To: to@example.com
285
246
  Subject: SUBJECT
286
247
 
287
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr*
288
- *VERY IMPORTANT SENTENCE*
289
- Ut wisi enim ad minim veniam*
248
+ Body
249
+ with
250
+ CRLF
251
+ line
252
+ breaks
290
253
  '''
291
254
  """
292
255
 
293
256
  When I clear my emails
294
- And I go to "/emails/send_text_email_with_specific_line"
257
+ And I go to "/emails/send_email_with_umlauts"
295
258
 
296
259
  Then the following multiline step should succeed:
297
260
  """
@@ -302,73 +265,7 @@ Feature: Test Spreewald's email steps
302
265
  To: to@example.com
303
266
  Subject: SUBJECT
304
267
 
305
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr*
306
-
307
- *VERY IMPORTANT SENTENCE*
308
-
309
- Ut wisi enim ad minim veniam*
310
- '''
311
- """
312
-
313
- Scenario: Scenario: /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/
314
- When I go to "/emails/send_email"
315
-
316
- # Test with correct conditions
317
- Then the following multiline step should succeed:
318
- """
319
- 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"
320
- """
321
-
322
- # Test with wrong conditions
323
- Then the following multiline step should fail:
324
- """
325
- 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"
326
- """
327
-
328
- Scenario: /^that e?mail should have the following lines in the body:$/
329
- When I go to "/emails/send_email"
330
-
331
- # Test with correct body lines
332
- Then the following multiline step should succeed:
333
- """
334
- Then that email should have the following lines in the body:
335
- '''
336
- with
337
- line
338
- '''
339
- """
340
-
341
- # Test with wrong body lines
342
- Then the following multiline step should fail:
343
- """
344
- Then that email should have the following lines in the body:
345
- '''
346
- wrong
347
- line
348
- '''
349
- """
350
-
351
-
352
- Scenario: /^that e?mail should have the following( content in the)? body$/
353
- When I go to "/emails/send_email"
354
-
355
- # Test with correct body lines
356
- Then the following multiline step should succeed:
357
- """
358
- Then that email should have the following content in the body:
359
- '''
360
- with
361
- line
362
- '''
363
- """
364
-
365
- # Test with wrong body lines
366
- Then the following multiline step should fail:
367
- """
368
- Then that email should have the following body:
369
- '''
370
- wrong
371
- line
268
+ Viele Grüße
372
269
  '''
373
270
  """
374
271
 
@@ -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.3
4
+ version: 3.0.0
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-18 00:00:00.000000000 Z
11
+ date: 2020-10-01 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,11 +348,8 @@ 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
353
- - tests/shared/app/views/mailer/html_email_with_linebreaks.html
354
351
  - tests/shared/app/views/mailer/html_email_with_links.haml
355
- - tests/shared/app/views/mailer/html_email_with_specific_line.haml
356
352
  - tests/shared/app/views/mailer/text_email_with_links.text.erb
357
- - tests/shared/app/views/mailer/text_email_with_specific_line.text.erb
358
353
  - tests/shared/app/views/spreewald_mailer
359
354
  - tests/shared/app/views/static_pages/click_on.html.haml
360
355
  - tests/shared/app/views/static_pages/home.html.haml
@@ -586,11 +581,8 @@ test_files:
586
581
  - tests/shared/app/views/mailer/email.text.erb
587
582
  - tests/shared/app/views/mailer/email_crlf.text.erb
588
583
  - tests/shared/app/views/mailer/email_with_umlauts.text.erb
589
- - tests/shared/app/views/mailer/html_email_with_linebreaks.html
590
584
  - tests/shared/app/views/mailer/html_email_with_links.haml
591
- - tests/shared/app/views/mailer/html_email_with_specific_line.haml
592
585
  - tests/shared/app/views/mailer/text_email_with_links.text.erb
593
- - tests/shared/app/views/mailer/text_email_with_specific_line.text.erb
594
586
  - tests/shared/app/views/spreewald_mailer
595
587
  - tests/shared/app/views/static_pages/click_on.html.haml
596
588
  - 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'
@@ -1,6 +0,0 @@
1
- <p>
2
- Hello!
3
- </p>
4
- <p>
5
- Bye!
6
- </p>
@@ -1,11 +0,0 @@
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.
@@ -1,5 +0,0 @@
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.