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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/spreewald/web_steps.rb +4 -2
- data/lib/spreewald_support/tolerance_for_selenium_sync_issues.rb +4 -3
- data/lib/spreewald_support/version.rb +1 -1
- data/spec/spreewald_support/tolerance_for_selenium_sync_issues_spec.rb +12 -0
- data/tests/rails-7_capybara-3/Gemfile.lock +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fc8c05a08753163728b0fc4f49ba18329fa74982395ccc42f0a846d307808e8
|
4
|
+
data.tar.gz: 7601c85d5993c5c82212067422943e818f7ab9b1b0b90f439935fb21d07d922c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/spreewald/web_steps.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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 (
|
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 ==
|
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
|
@@ -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
|
+
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-
|
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.
|
357
|
+
rubygems_version: 3.4.20
|
358
358
|
signing_key:
|
359
359
|
specification_version: 4
|
360
360
|
summary: Collection of useful cucumber steps.
|