spreewald 2.7.1 → 2.8.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: ff2190f73eb0208f16e61464f60da6e726eac2423f39ad169f862fe2e9c01fb7
4
- data.tar.gz: 149e2142c5f9df868ec19521dfb6404edcbc7267b99eabf0048bfb4a082c55d9
3
+ metadata.gz: 59c446ad46ae093a7bb103d7e4959dbbc7e29327cbc30e5730aff221f8488e36
4
+ data.tar.gz: e23e4bd833a6234e6ce2b4e6ab104f102708bab13ab54f10aad8b97df08cd39b
5
5
  SHA512:
6
- metadata.gz: 8141451a1da482256e7f9246c98e5e23bfb3f758854ee942c007fd59943165ae8802ff0dab9cf69b3c2c69225877f4c4dd8ba8ba457f304e8d2b3b805ddf06d2
7
- data.tar.gz: beaa7a1eb91313d69a9a6f7d5aeecf580a38b65e0cd7ec1de19b6469ccda5f66c52a0e76f75bbe21a7596865f7458550591ed4540d82ce125fe3912816df07ad
6
+ metadata.gz: 8d7b6e7ddd55b75433d7c800045c09f68b7175646de8a3f9ac11a5741ee83ce39c22d8bb5a8b5d9d77b4d22df01eda5de51093de4a76cabf73ae354308b12abc
7
+ data.tar.gz: bc169b566a8878be0ad26b2b1522b960b57772d80d135ffbe4a34476c673282d75b7666d9ccf14a585c229739b3d543620f578c3b59a7e6f62cf036a5df2f90c
@@ -3,6 +3,12 @@ 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.8.0
7
+ - Add radio buttons to the `the "..." (field|button|checkbox|radio button) should( not)? be disabled` step.
8
+
9
+ ## 2.7.2
10
+ - Fix the step `I follow the ... link in the email` if the email contains non-HTTP(S) links
11
+
6
12
  ## 2.7.1
7
13
  - Support RFC-compliant encoding of filenames in `Content-Disposition` header (e.g. send_data), as provided by Rails 6.
8
14
 
data/README.md CHANGED
@@ -247,6 +247,9 @@ the step definitions.
247
247
 
248
248
  * **When I follow the (first|second|third)? link in the e?mail**
249
249
 
250
+ Please note that this step will only follow HTTP and HTTPS links.
251
+ Other links (such as mailto: or ftp:// links) are ignored.
252
+
250
253
 
251
254
  * **Then no e?mail should have been sent**
252
255
 
@@ -680,7 +683,7 @@ deprecation notice. Decide for yourself whether you want to use them:
680
683
 
681
684
  Then "Sponsor" should link to "http://makandra.com/"
682
685
 
683
- Don't forget the trailing slash. Otherwise you'll get the error
686
+ Don't forget the trailing slash. Otherwise you'll get the error
684
687
  expected: /http:\/\/makandra.com(\?[^\/]*)?$/
685
688
  got: "http://makandra.com/" (using =~)
686
689
 
@@ -715,9 +718,9 @@ deprecation notice. Decide for yourself whether you want to use them:
715
718
  * **When I enter "..." into the browser dialog**
716
719
 
717
720
 
718
- * **Then the "..." (field|button|checkbox) should( not)? be disabled**
721
+ * **Then the "..." (field|button|checkbox|radio button) should( not)? be disabled**
719
722
 
720
- Tests that an input, button or checkbox with the given label is disabled.
723
+ Tests that an input, button, checkbox or radio button with the given label is disabled.
721
724
 
722
725
 
723
726
  * **Then the "..." field should( not)? be visible**
@@ -65,6 +65,8 @@ Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]
65
65
  end
66
66
  end.overridable
67
67
 
68
+ # Please note that this step will only follow HTTP and HTTPS links.
69
+ # Other links (such as mailto: or ftp:// links) are ignored.
68
70
  When /^I follow the (first|second|third)? ?link in the e?mail$/ do |index_in_words|
69
71
  mail = @mail || ActionMailer::Base.deliveries.last
70
72
  index = { nil => 0, 'first' => 0, 'second' => 1, 'third' => 2 }[index_in_words]
@@ -72,7 +74,7 @@ When /^I follow the (first|second|third)? ?link in the e?mail$/ do |index_in_wor
72
74
 
73
75
  paths = if mail.html_part
74
76
  dom = Nokogiri::HTML(mail.html_part.body.to_s)
75
- (dom / 'a[href]').map { |a| a['href'].match(url_pattern)[1] }
77
+ (dom / 'a[href]').map { |a| a['href'].match(url_pattern) }.compact.map { |match| match[1] }
76
78
  else
77
79
  mail_body = MailFinder.email_text_body(mail).to_s
78
80
  mail_body.scan(url_pattern).flatten(1)
@@ -606,7 +606,7 @@ end.overridable(priority: -5) # priority lower than within
606
606
  #
607
607
  # Then "Sponsor" should link to "http://makandra.com/"
608
608
  #
609
- # Don't forget the trailing slash. Otherwise you'll get the error
609
+ # Don't forget the trailing slash. Otherwise you'll get the error
610
610
  # expected: /http:\/\/makandra.com(\?[^\/]*)?$/
611
611
  # got: "http://makandra.com/" (using =~)
612
612
  Then /^"([^"]*)" should link to "([^"]*)"$/ do |link_label, target|
@@ -670,23 +670,20 @@ When /^I enter "([^"]*)" into the browser dialog$/ do |text|
670
670
  end
671
671
  end.overridable
672
672
 
673
- # Tests that an input, button or checkbox with the given label is disabled.
674
- Then /^the "([^\"]*)" (field|button|checkbox) should( not)? be disabled$/ do |label, kind, negate|
673
+ # Tests that an input, button, checkbox or radio button with the given label is disabled.
674
+ Then /^the "([^\"]*)" (field|button|checkbox|radio button) should( not)? be disabled$/ do |label, kind, negate|
675
+ element = if kind == 'button'
676
+ find_with_disabled(:button, label)
677
+ else
678
+ find_with_disabled(:field, label)
679
+ end
680
+
675
681
  if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
676
- if kind == 'field' || kind == 'checkbox'
677
- element = find_field(label)
678
- else
679
- element = find_button(label)
680
- end
681
682
  expect(element[:disabled]).send(negate ? :to : :not_to, eq(nil))
682
683
  else
683
- if kind == 'field' || kind == 'checkbox'
684
- element = find_field(label, disabled: !negate)
685
- else
686
- element = find_button(label, disabled: !negate)
687
- end
688
- expect(element).to be_present
684
+ expect(!!element.disabled?).to be !negate
689
685
  end
686
+
690
687
  end.overridable
691
688
 
692
689
  # Tests that a field with the given label is visible.
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '2.7.1'
2
+ VERSION = '2.8.0'
3
3
  end
@@ -1,3 +1,5 @@
1
+ require 'spreewald_support/comparison'
2
+
1
3
  module WebStepsHelpers
2
4
 
3
5
  def assert_visible(options)
@@ -8,6 +10,21 @@ module WebStepsHelpers
8
10
  visibility_test(options.merge(:expectation => :hidden))
9
11
  end
10
12
 
13
+ def find_with_disabled(*args, **options, &optional_filter_block)
14
+ if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.0")
15
+ find(:xpath, XPath::HTML.send(args[0], args[1])) # Versions < 2.0 will find both enabled and disabled fields, nothing to do
16
+ elsif Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.6")
17
+ begin
18
+ find(*args, **options, disabled: false, &optional_filter_block)
19
+ rescue Capybara::ElementNotFound
20
+ find(*args, **options, disabled: true, &optional_filter_block)
21
+ end
22
+ else
23
+ options_with_disabled = { disabled: :all }.merge(options)
24
+ find(*args, **options_with_disabled, &optional_filter_block)
25
+ end
26
+ end
27
+
11
28
  private
12
29
 
13
30
  def visibility_test(options)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.7.1)
4
+ spreewald (2.8.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.7.1)
4
+ spreewald (2.8.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.7.1)
4
+ spreewald (2.8.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.7.1)
4
+ spreewald (2.8.0)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -51,3 +51,21 @@
51
51
 
52
52
  = label_tag 'enabled_field_2', 'Enabled field #2'
53
53
  = text_field_tag 'enabled_field_2', 'value'
54
+
55
+ -# radio buttons
56
+ = form_tag do
57
+ - selected = false
58
+ = label_tag 'disabled_radio_1', 'Disabled radio button #1'
59
+ = radio_button_tag 'disabled_radio', '1', selected, disabled: true
60
+
61
+ = label_tag 'disabled_radio_2', 'Disabled radio button #2'
62
+ = radio_button_tag 'disabled_radio', '2', selected, disabled: ''
63
+
64
+ = label_tag 'disabled_radio_3', 'Disabled radio button #3'
65
+ = radio_button_tag 'disabled_radio', '3', selected, disabled: 'aaa'
66
+
67
+ = label_tag 'enabled_radio_1', 'Enabled radio button #1'
68
+ = radio_button_tag 'enabled_radio', '1', selected, disabled: false
69
+
70
+ = label_tag 'enabled_radio_2', 'Enabled radio button #2'
71
+ = radio_button_tag 'enabled_radio', '2', selected
@@ -3,4 +3,6 @@
3
3
  %body
4
4
  %img(src="https://www.example.com/image.png")
5
5
  %a(href="https://www.example.com/static_pages/link_target") Click me
6
+ %a(href="mailto:user@example.com") mailto links should be ignored
7
+ %a(href="ftp://ftp.example.com/") FTP links are also ignored
6
8
  %a(href="https://www.example.com/static_pages/second_link_target") Other link
@@ -1,6 +1,7 @@
1
1
  Hello!
2
2
 
3
3
  First link: https://www.example.com/static_pages/link_target
4
+ Ignored link: ftp://ftp.example.com/
4
5
  Second link: https://www.example.com/static_pages/second_link_target
5
6
 
6
7
  Bye!
@@ -85,7 +85,7 @@ Feature: Web steps
85
85
  Scenario: /^I go back$/
86
86
  Given I go to "/static_pages/link_to_home"
87
87
  And I follow "Home"
88
-
88
+
89
89
  When I go back
90
90
  Then I should be on "/static_pages/link_to_home"
91
91
 
@@ -341,6 +341,12 @@ Feature: Web steps
341
341
  But the "Enabled field #1" field should not be disabled
342
342
  And the "Enabled field #2" field should not be disabled
343
343
 
344
+ # radio buttons
345
+ And the "Disabled radio button #1" radio button should be disabled
346
+ And the "Disabled radio button #2" radio button should be disabled
347
+ And the "Disabled radio button #3" radio button should be disabled
348
+ But the "Enabled radio button #1" radio button should not be disabled
349
+ And the "Enabled radio button #2" radio button should not be disabled
344
350
 
345
351
  Scenario: /^the window should be titled "([^"]*)"$/
346
352
  When I go to "/static_pages/home"
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.7.1
4
+ version: 2.8.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-09-08 00:00:00.000000000 Z
11
+ date: 2020-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -410,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
410
410
  - !ruby/object:Gem::Version
411
411
  version: '0'
412
412
  requirements: []
413
- rubygems_version: 3.0.3
413
+ rubygems_version: 3.1.2
414
414
  signing_key:
415
415
  specification_version: 4
416
416
  summary: Collection of useful cucumber steps.