spreewald 2.2.2 → 2.2.3

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
  SHA1:
3
- metadata.gz: dbbb1aa373a4a39fef3fa0919d4d93e1b8e2410a
4
- data.tar.gz: 324f16cba03ab1e80147a95da42a39a24421dd14
3
+ metadata.gz: ddb7fc3c104b505b8cb94e2cbd378f0e53a2a659
4
+ data.tar.gz: ff225609365e6c13e81a987ebd3033dd1558b14b
5
5
  SHA512:
6
- metadata.gz: 755e1efa4859d6e3e749f005e69917719a95a9e45cdbc3358c90b0f12997b2e0501d944a243bc03467701f2fa5ea1a1bf80127af6791271e36f343a231ac1839
7
- data.tar.gz: 1ac713920860234a6b39b2c3fc14de320ff09d4b5634fa757233f63107038a19d042b2004a1bf8e00e9ad06e7539b128bbd82cf50cb04f47569b302cc590dea9
6
+ metadata.gz: 6b8bf83b6e5a7b573c311b79ddc6f3677e9fbb2f60a4d61fc7fccb806a43f210e5b82e6e2ff23b15faa2c86ccc828da021bc6a5da681adb36743c82aad6c8e99
7
+ data.tar.gz: f0f3f6c77b2bc6977a41bca49662b65564511001b6abe472488cb1d98dd2f25cb8ba9e5e32247279eff4c4a155a94607bc69d7627fd9fe8aeb133a0f468133fc
@@ -3,6 +3,10 @@ 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.2.3
7
+ - Fix 'the window should be titled' step - closes: [#102](https://github.com/makandra/spreewald/issues/102)
8
+ - Support old capybara_screenshot versions which require launchy gem
9
+
6
10
  ## 2.2.2
7
11
  - Fix `Then the "something" button should be disabled` (see issue [#18](https://github.com/makandra/spreewald/issues/18))
8
12
  - Improve documentation of emails steps
data/README.md CHANGED
@@ -171,15 +171,13 @@ the step definitions.
171
171
  Message body goes here.
172
172
  """
173
173
 
174
- You can skip lines in the header, of course. Note that the mail body is only checked for
175
- _inclusion_. That means you can only test a prefix of the body. The subject can also be
174
+ You may skip lines in the header, of course. Note that the mail body is only checked for
175
+ _inclusion_. That means you can only test a prefix of the body. The subject may also be
176
176
  a prefix.
177
177
 
178
178
 
179
179
  * **When I follow the (first|second|third)? link in the e?mail**
180
180
 
181
- Only works after you have retrieved the mail using "Then an email should have been sent with:"
182
-
183
181
 
184
182
  * **Then no e?mail should have been sent**
185
183
 
@@ -204,12 +202,12 @@ the step definitions.
204
202
  need to be present
205
203
  """
206
204
 
207
- You can skip lines, of course. Note that the lines are only checked for _inclusion_.
205
+ You may skip lines, of course. Note that you may also omit text at the end of each line.
208
206
 
209
207
 
210
208
  * **Then that e?mail should have the following (|content in the )body:**
211
209
 
212
- Checks that the text should be included in the retrieved email
210
+ Checks that the text should be included anywhere in the retrieved email body
213
211
 
214
212
 
215
213
  ### file_attachment_steps.rb
@@ -1,4 +1,4 @@
1
- # Put this into features/support and require it in your env.rb
1
+ # Put this into features/support
2
2
  #
3
3
  module NavigationHelpers
4
4
  # Maps a name to a path. Used by the
@@ -1,4 +1,4 @@
1
- # Put this into features/support and require it in your env.rb
1
+ # Put this into features/support
2
2
  module HtmlSelectorsHelpers
3
3
  # Maps a name to a selector. Used primarily by the
4
4
  #
@@ -1,4 +1,5 @@
1
1
  # coding: UTF-8
2
+ require 'rspec/matchers'
2
3
 
3
4
  Dir[File.join(File.dirname(__FILE__), '*_steps.rb')].each do |f|
4
5
  name = File.basename(f, '.rb')
@@ -23,8 +23,8 @@ end.overridable
23
23
  # Message body goes here.
24
24
  # """
25
25
  #
26
- # You can skip lines in the header, of course. Note that the mail body is only checked for
27
- # _inclusion_. That means you can only test a prefix of the body. The subject can also be
26
+ # You may skip lines in the header, of course. Note that the mail body is only checked for
27
+ # _inclusion_. That means you can only test a prefix of the body. The subject may also be
28
28
  # a prefix.
29
29
  Then /^(an|no) e?mail should have been sent with:$/ do |mode, raw_data|
30
30
  patiently do
@@ -61,7 +61,6 @@ Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]
61
61
  end
62
62
  end.overridable
63
63
 
64
- # Only works after you have retrieved the mail using "Then an email should have been sent with:"
65
64
  When /^I follow the (first|second|third)? ?link in the e?mail$/ do |index_in_words|
66
65
  mail = @mail || ActionMailer::Base.deliveries.last
67
66
  index = { nil => 0, 'first' => 0, 'second' => 1, 'third' => 2 }[index_in_words]
@@ -102,7 +101,7 @@ end.overridable
102
101
  # need to be present
103
102
  # """
104
103
  #
105
- # You can skip lines, of course. Note that the lines are only checked for _inclusion_.
104
+ # You may skip lines, of course. Note that you may also omit text at the end of each line.
106
105
  Then /^that e?mail should( not)? have the following lines in the body:$/ do |negate, body|
107
106
  expectation = negate ? 'not_to' : 'to'
108
107
  mail = @mail || ActionMailer::Base.deliveries.last
@@ -113,7 +112,7 @@ Then /^that e?mail should( not)? have the following lines in the body:$/ do |neg
113
112
  end
114
113
  end.overridable
115
114
 
116
- # Checks that the text should be included in the retrieved email
115
+ # Checks that the text should be included anywhere in the retrieved email body
117
116
  Then /^that e?mail should have the following (?:|content in the )body:$/ do |body|
118
117
  mail = @mail || ActionMailer::Base.deliveries.last
119
118
  expect(MailFinder.email_text_body(mail)).to include(body.strip)
@@ -30,6 +30,7 @@ require 'spreewald_support/step_fallback'
30
30
  require 'spreewald_support/custom_matchers'
31
31
  require 'spreewald_support/web_steps_helpers'
32
32
  require 'spreewald_support/driver_info'
33
+ require 'spreewald_support/comparison'
33
34
  require 'uri'
34
35
  require 'cgi'
35
36
 
@@ -408,7 +409,7 @@ Then /^the "([^"]*)" checkbox should( not)? be checked( and disabled)?$/ do |lab
408
409
  expectation = negate ? :not_to : :to
409
410
 
410
411
  patiently do
411
- field = if Capybara::VERSION < "2.1"
412
+ field = if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
412
413
  find_field(label)
413
414
  else
414
415
  find_field(label, :disabled => !!disabled)
@@ -443,10 +444,10 @@ end.overridable
443
444
 
444
445
  # Open the current Capybara page using the `launchy` or `capybara_screenshot` gem
445
446
  Then /^show me the page$/ do
446
- if defined? Launchy
447
- save_and_open_page
448
- elsif defined? Capybara::Screenshot
447
+ if defined? Capybara::Screenshot
449
448
  screenshot_and_save_page
449
+ elsif defined? Launchy
450
+ save_and_open_page
450
451
  else
451
452
  raise 'Neither launchy nor capybara_screenshot gem is installed. You have to add at least one of them to your Gemfile to use this step'
452
453
  end
@@ -484,7 +485,7 @@ end.overridable
484
485
 
485
486
  # Checks for the presence of an option in a select
486
487
  Then /^"([^"]*)" should( not)? be an option for "([^"]*)"$/ do |value, negate, field|
487
- finder_arguments = if Capybara::VERSION < "2.12"
488
+ finder_arguments = if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.12")
488
489
  ['option', { :text => value }]
489
490
  else
490
491
  ['option', { :exact_text => value }]
@@ -503,7 +504,11 @@ end.overridable
503
504
 
504
505
  Then /^the window should be titled "([^"]*)"$/ do |title|
505
506
  patiently do
506
- expect(pag).to have_css('title', :text => title)
507
+ if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
508
+ expect(page).to have_selector("title", :content => title)
509
+ else
510
+ expect(page).to have_title(title)
511
+ end
507
512
  end
508
513
  end.overridable
509
514
 
@@ -664,7 +669,7 @@ end.overridable
664
669
 
665
670
  # Tests that an input, button or checkbox with the given label is disabled.
666
671
  Then /^the "([^\"]*)" (field|button|checkbox) should( not)? be disabled$/ do |label, kind, negate|
667
- if Gem::Version.new(Capybara::VERSION) < Gem::Version.new("2.1")
672
+ if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
668
673
  if kind == 'field' || kind == 'checkbox'
669
674
  element = find_field(label)
670
675
  else
@@ -683,7 +688,7 @@ end.overridable
683
688
 
684
689
  # Tests that a field with the given label is visible.
685
690
  Then /^the "([^\"]*)" field should( not)? be visible$/ do |label, hidden|
686
- if Capybara::VERSION < "2.1"
691
+ if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
687
692
  field = find_field(label)
688
693
  else
689
694
  # Capybara 2.1+ won't usually interact with hidden elements,
@@ -0,0 +1,9 @@
1
+ module Spreewald
2
+ module Comparison
3
+
4
+ def self.compare_versions(gem_version, operator, compare_to)
5
+ Gem::Version.new(gem_version).send(operator, Gem::Version.new(compare_to))
6
+ end
7
+
8
+ end
9
+ end
@@ -8,7 +8,7 @@ module PathSelectorFallbacks
8
8
  $1
9
9
  else
10
10
  raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
11
- "Add and require a selectors.rb file (compare #{Spreewald.github_url}/blob/master/examples/selectors.rb)"
11
+ "Add a selectors.rb file (compare #{Spreewald.github_url}/blob/master/examples/selectors.rb)"
12
12
  end
13
13
  end
14
14
 
@@ -22,7 +22,7 @@ module PathSelectorFallbacks
22
22
  self.send(path_components.push('path').join('_').to_sym)
23
23
  rescue NoMethodError, ArgumentError
24
24
  raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
25
- "Add and require a paths.rb file (compare #{Spreewald.github_url}/blob/master/examples/paths.rb)"
25
+ "Add a paths.rb file (compare #{Spreewald.github_url}/blob/master/examples/paths.rb)"
26
26
  end
27
27
  end
28
28
  end
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '2.2.2'
2
+ VERSION = '2.2.3'
3
3
  end
@@ -0,0 +1,12 @@
1
+ require 'spreewald_support/comparison'
2
+
3
+ describe Spreewald::Comparison do
4
+
5
+ describe 'compare_versions' do
6
+ it 'returns true for `2.4.0 < 2.12` ' do
7
+ comp = Spreewald::Comparison.compare_versions('2.4.0', :<, '2.12')
8
+ expect(comp).to be_truthy
9
+ end
10
+ end
11
+
12
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.2.2)
4
+ spreewald (2.2.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.2.2)
4
+ spreewald (2.2.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.2.2)
4
+ spreewald (2.2.3)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -46,7 +46,7 @@ end
46
46
 
47
47
  Then(/^'show me the page' should open the page or take a screenshot$/) do
48
48
  # Projects with Capybara 1 & 2 use the launchy gem
49
- if Capybara::VERSION < "3.0"
49
+ if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "3.0")
50
50
  expect(Launchy).to receive(:open)
51
51
  step 'show me the page'
52
52
  else
@@ -293,3 +293,8 @@ Feature: Web steps
293
293
  And the "Disabled field #3" field should be disabled
294
294
  But the "Enabled field #1" field should not be disabled
295
295
  And the "Enabled field #2" field should not be disabled
296
+
297
+
298
+ Scenario: /^the window should be titled "([^"]*)"$/
299
+ When I go to "/static_pages/home"
300
+ Then the window should be titled "spreewald test application"
@@ -1,5 +1,7 @@
1
1
  !!!
2
2
  %html
3
3
  %head
4
+ %title
5
+ = "spreewald test application"
4
6
  %body
5
7
  = yield
@@ -46,7 +46,7 @@ end
46
46
 
47
47
  Then(/^'show me the page' should open the page or take a screenshot$/) do
48
48
  # Projects with Capybara 1 & 2 use the launchy gem
49
- if Capybara::VERSION < "3.0"
49
+ if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "3.0")
50
50
  expect(Launchy).to receive(:open)
51
51
  step 'show me the page'
52
52
  else
@@ -293,3 +293,8 @@ Feature: Web steps
293
293
  And the "Disabled field #3" field should be disabled
294
294
  But the "Enabled field #1" field should not be disabled
295
295
  And the "Enabled field #2" field should not be disabled
296
+
297
+
298
+ Scenario: /^the window should be titled "([^"]*)"$/
299
+ When I go to "/static_pages/home"
300
+ Then the window should be titled "spreewald test application"
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.2.2
4
+ version: 2.2.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: 2019-07-04 00:00:00.000000000 Z
11
+ date: 2019-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -158,6 +158,7 @@ files:
158
158
  - lib/spreewald/table_steps.rb
159
159
  - lib/spreewald/timecop_steps.rb
160
160
  - lib/spreewald/web_steps.rb
161
+ - lib/spreewald_support/comparison.rb
161
162
  - lib/spreewald_support/compatibility.rb
162
163
  - lib/spreewald_support/custom_matchers.rb
163
164
  - lib/spreewald_support/driver_info.rb
@@ -169,6 +170,7 @@ files:
169
170
  - lib/spreewald_support/version.rb
170
171
  - lib/spreewald_support/web_steps_helpers.rb
171
172
  - spec/spec_helper.rb
173
+ - spec/spreewald_support/comparision_spec.rb
172
174
  - spec/spreewald_support/tolerance_for_selenium_sync_issues_spec.rb
173
175
  - spec/support/world.rb
174
176
  - spreewald.gemspec