spreewald 4.4.4 → 4.5.1

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: be47f16ea0fa8339c8edcb4c262b3af8a45bc4b3dc9c3521418d696e202f0fa3
4
- data.tar.gz: 3d6ee00c9d70a268de045e63b48c7af9f21596a61127f93f1c302d667aacd09c
3
+ metadata.gz: 7fc8c05a08753163728b0fc4f49ba18329fa74982395ccc42f0a846d307808e8
4
+ data.tar.gz: 7601c85d5993c5c82212067422943e818f7ab9b1b0b90f439935fb21d07d922c
5
5
  SHA512:
6
- metadata.gz: d153eaeab487f112100fd45c66bd3f26ddb50d7c6d660a20ade0f18a719bd04095c2a7f8a07ba4af8690a869081085f3c5f70a4c328ff594f8af110e9fe6f007
7
- data.tar.gz: 1f2bbf29fffe40f234634cd111419a80d508c308b15313142642e4f114b82d48addf1d130c979d38b8c08fc8040b92a9039bd1e01f59ab50dcefcc0e776baa43
6
+ metadata.gz: 39deb82f5ad22c87a9291dc9a90fd65da1c867bb662ff35176e371e6034b9d12efa7216d198ca2a5bbca8b8a7fad9a55d603a39c9aca3f951b9b938813c0982c
7
+ data.tar.gz: ff6288ad06c31a8c77ac25071d7f9e627134a898c2c3d5df65ef646d0df07c18412b841efc0dc1bccf81eb5bffb705e10b0f836fab4c1d2873394c5acae2b2d1
data/CHANGELOG.md CHANGED
@@ -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
+ ## 4.5.1
7
+ - Make `I should see an element for` and `I click on the element for` compatible for Ruby 3.0. ([#204](https://github.com/makandra/spreewald/issues/204))
8
+
9
+ ## 4.5.0
10
+ - `patiently` retries one more time in certain edge cases where the alloted time was used up within the last retry of the `patiently` block (usually by Capybara).
11
+
6
12
  ## 4.4.4
7
13
  - Make `When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/` compatible for Ruby 3.0.
8
14
 
@@ -279,7 +279,8 @@ Then /^I should( not)? see (?:an|the) element for (.*?)$/ do |negate, locator|
279
279
  expectation = negate ? :not_to : :to
280
280
  selector = _selector_for(locator)
281
281
  patiently do
282
- expect(page).send(expectation, have_selector(*selector))
282
+ args, kwargs = deconstruct_selector(selector)
283
+ expect(page).send(expectation, have_selector(*args, **kwargs))
283
284
  end
284
285
  end.overridable(:priority => -5) # priority must be lower than the "within" step
285
286
 
@@ -578,7 +579,8 @@ end.overridable
578
579
  When /^I click on the element for (.+?)$/ do |locator|
579
580
  patiently do
580
581
  selector = _selector_for(locator)
581
- page.find(*selector).click
582
+ args, kwargs = deconstruct_selector(selector)
583
+ page.find(*args, **kwargs).click
582
584
  end
583
585
  end.overridable(priority: -5) # priority lower than within
584
586
 
@@ -39,16 +39,17 @@ module ToleranceForSeleniumSyncIssues
39
39
  WAIT_PERIOD = 0.05
40
40
 
41
41
  def patiently(seconds, &block)
42
- started = monotonic_time
42
+ patiently_started = monotonic_time
43
43
  tries = 0
44
44
  begin
45
45
  tries += 1
46
+ block_started = monotonic_time
46
47
  block.call
47
48
  rescue Exception => e
48
49
  raise e unless retryable_error?(e)
49
- raise e if (monotonic_time - started > seconds && tries >= 2)
50
+ raise e if (block_started - patiently_started > seconds && tries >= 2)
50
51
  sleep(WAIT_PERIOD)
51
- raise Capybara::FrozenInTime, "time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead" if monotonic_time == started
52
+ raise Capybara::FrozenInTime, "time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead" if monotonic_time == patiently_started
52
53
  retry
53
54
  end
54
55
  end
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '4.4.4'
2
+ VERSION = '4.5.1'
3
3
  end
@@ -105,6 +105,18 @@ describe ToleranceForSeleniumSyncIssues do
105
105
  expect(count).to be > 1
106
106
  end
107
107
 
108
+ it 'retries the block if the given time has been used within the last retry (see issue #202)' do
109
+ count = 0
110
+ expect {
111
+ subject.patiently do
112
+ count += 1
113
+ sleep wait_time if count == 2
114
+ raise Capybara::ElementNotFound
115
+ end
116
+ }.to raise_error(Capybara::ElementNotFound)
117
+ expect(count).to be > 2
118
+ end
119
+
108
120
  it 'will retry an outer patiently block if an inner patiently block took up all the time' do
109
121
  try = 0
110
122
  expect {
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (4.4.4)
4
+ spreewald (4.5.1)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
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: 4.4.4
4
+ version: 4.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-09 00:00:00.000000000 Z
11
+ date: 2023-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -354,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
354
354
  - !ruby/object:Gem::Version
355
355
  version: '0'
356
356
  requirements: []
357
- rubygems_version: 3.4.6
357
+ rubygems_version: 3.4.20
358
358
  signing_key:
359
359
  specification_version: 4
360
360
  summary: Collection of useful cucumber steps.