-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix "nested element" case for FieldWithErrorFinder; speed it up; use …
…XPath library to construct xpaths
- Loading branch information
Showing
9 changed files
with
138 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Spreewald | ||
class CapybaraWrapper | ||
def self.default_max_wait_time | ||
if Capybara.respond_to?(:default_max_wait_time) | ||
Capybara.default_max_wait_time | ||
else | ||
Capybara.default_wait_time | ||
end | ||
end | ||
|
||
def self.default_max_wait_time=(value) | ||
if Capybara.respond_to?(:default_max_wait_time=) | ||
Capybara.default_max_wait_time = value | ||
else | ||
Capybara.default_wait_time = value | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'spreewald_support/capybara_wrapper' | ||
|
||
module Spreewald | ||
module WithoutWaiting | ||
def without_waiting | ||
prior_max_wait_time = CapybaraWrapper.default_max_wait_time | ||
CapybaraWrapper.default_max_wait_time = 0 | ||
yield | ||
ensure | ||
CapybaraWrapper.default_max_wait_time = prior_max_wait_time | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
spec/spreewald_support/tolerance_for_selenium_sync_issues_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'spreewald_support/without_waiting' | ||
|
||
describe Spreewald::WithoutWaiting do | ||
|
||
subject do | ||
Class.new do | ||
include Spreewald::WithoutWaiting | ||
end.new | ||
end | ||
|
||
describe '#without_waiting' do | ||
it 'calls the block while setting the Capybara wait time to 0' do | ||
wait_time_in_block = nil | ||
subject.without_waiting do | ||
wait_time_in_block = Capybara.default_max_wait_time | ||
end | ||
expect(wait_time_in_block).to eq(0) | ||
end | ||
|
||
it 'resets the prior wait time' do | ||
prior = Capybara.default_max_wait_time | ||
Capybara.default_max_wait_time = 4 | ||
subject.without_waiting {} | ||
expect(Capybara.default_max_wait_time).to eq(4) | ||
Capybara.default_max_wait_time = prior | ||
end | ||
|
||
it 'resets the prior wait time on exceptions' do | ||
prior = Capybara.default_max_wait_time | ||
Capybara.default_max_wait_time = 4 | ||
expect do | ||
subject.without_waiting do | ||
raise 'error' | ||
end | ||
end.to raise_error('error') | ||
expect(Capybara.default_max_wait_time).to eq(4) | ||
Capybara.default_max_wait_time = prior | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters