-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#515] REFACTOR: command.js.click for more ...
to be event based
- Loading branch information
Showing
2 changed files
with
77 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import time | ||
|
||
from selene import command | ||
from tests.integration.helpers.givenpage import GivenPage | ||
|
||
|
||
def test_command_js_click_does_not_wait_for_no_overlay(session_browser): | ||
browser = session_browser.with_(timeout=0.5) | ||
page = GivenPage(browser.driver) | ||
page.opened_with_body( | ||
''' | ||
<div | ||
id="overlay" | ||
style=' | ||
display:block; | ||
position: fixed; | ||
display: block; | ||
width: 100%; | ||
height: 100%; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: rgba(0,0,0,0.1); | ||
z-index: 2; | ||
cursor: pointer; | ||
' | ||
> | ||
</div> | ||
<a href="#second">go to Heading 2</a> | ||
<h2 id="second">Heading 2</h2> | ||
''' | ||
) | ||
before_call = time.time() | ||
page.execute_script_with_timeout( | ||
''' | ||
document.getElementById('overlay').style.display='none' | ||
''', | ||
0.75, | ||
) | ||
|
||
browser.element('a').perform(command.js.click) | ||
|
||
time_diff = time.time() - before_call | ||
assert time_diff < 0.25 | ||
assert "second" in browser.driver.current_url |