-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support freezing the page with Chrome
- Loading branch information
Showing
9 changed files
with
54 additions
and
4 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
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
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,30 @@ | ||
# frozen_string_literal: true | ||
|
||
Capybara::SpecHelper.spec 'Driver' do | ||
context 'freeze_page', requires: %i[freeze js] do | ||
it 'can pause a page' do | ||
@session.visit('/with_js') | ||
@session.find(:css, '#clickable').click | ||
sleep 0.1 | ||
@session.driver.freeze_page | ||
|
||
expect(@session).to have_css('#clickable-processing') | ||
sleep 3 # Time needs to be longer than click action delay | ||
expect(@session).not_to have_css('#has-been-clicked') | ||
expect(@session).to have_css('#clickable-processing') | ||
|
||
@session.driver.thaw_page | ||
expect(@session).to have_css('#has-been-clicked').and(have_no_css('#clickable-processing')) | ||
end | ||
|
||
it "doesn't prevent driver JS" do | ||
@session.visit('/with_js') | ||
@session.find(:css, '#clickable') | ||
@session.driver.freeze_page | ||
|
||
expect(@session.evaluate_script('1==1')).to eq true | ||
|
||
@session.driver.thaw_page | ||
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