spreewald 4.4.4 → 4.5.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: be47f16ea0fa8339c8edcb4c262b3af8a45bc4b3dc9c3521418d696e202f0fa3
4
- data.tar.gz: 3d6ee00c9d70a268de045e63b48c7af9f21596a61127f93f1c302d667aacd09c
3
+ metadata.gz: 1920d9013d22c925f9b9b49058dc46d84228d74e79eb61cece32f1ab747e245e
4
+ data.tar.gz: 4ded87963d399820eed78316462402f2ded9c46384c073dd60dd7c24d7210f01
5
5
  SHA512:
6
- metadata.gz: d153eaeab487f112100fd45c66bd3f26ddb50d7c6d660a20ade0f18a719bd04095c2a7f8a07ba4af8690a869081085f3c5f70a4c328ff594f8af110e9fe6f007
7
- data.tar.gz: 1f2bbf29fffe40f234634cd111419a80d508c308b15313142642e4f114b82d48addf1d130c979d38b8c08fc8040b92a9039bd1e01f59ab50dcefcc0e776baa43
6
+ metadata.gz: d6a16084fc64d3063c095a4eb036a236c1fdf6c395bcfb42d8f418d6cf2de7a08be7628d797ca0ebadd0786eb48ee5964a5f54577eacf05dda33ac4182b1a977
7
+ data.tar.gz: 14e2db739ec6f716f23ca78a83d8b8480e889b10517776547352533919adc3f58f7225e8aa666b78520b8d4c839f7c9a2046d88c14d796621707f06da9666628
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@ 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.0
7
+ - `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).
8
+
6
9
  ## 4.4.4
7
10
  - Make `When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/` compatible for Ruby 3.0.
8
11
 
@@ -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.0'
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 {
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.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: 2023-02-09 00:00:00.000000000 Z
11
+ date: 2023-04-27 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.1
358
358
  signing_key:
359
359
  specification_version: 4
360
360
  summary: Collection of useful cucumber steps.