Skip to content

Commit

Permalink
test: Apply currently set wait timeout to waitPageLoad()
Browse files Browse the repository at this point in the history
Commit 49ee017 set a static 15s timeout for the waitPageLoad()
helper, but some tests like `TestIPA.testClientCertAuthentication`
require a longer one.

So support a `timeout=` option, and fall back to 15s if it is not set.
In Browser.open(), pass the currently set timeout in the CDP driver
(i.e. from `Browser.wait_timeout())`.
  • Loading branch information
martinpitt committed Nov 8, 2023
1 parent aa980ce commit ef2eae1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/common/chromium-cdp-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function setupLocalFunctions(client) {
const timeout = setTimeout(() => {
pageLoadHandler = null;
reject("Timeout waiting for page load"); // eslint-disable-line prefer-promise-reject-errors
}, 15000);
}, (args.timeout ?? 15) * 1000);
pageLoadHandler = () => {
clearTimeout(timeout);
pageLoadHandler = null;
Expand Down
2 changes: 1 addition & 1 deletion test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def open(self, href: str, cookie: Optional[Dict[str, str]] = None, tls: bool = F
# But that option has the inverse effect with Chromium (argh)
opts["transitionType"] = "reload"
self.cdp.invoke("Page.navigate", url=href, **opts)
self.cdp.invoke("waitPageLoad")
self.cdp.invoke("waitPageLoad", timeout=self.cdp.timeout)

def set_user_agent(self, ua: str):
"""Set the user agent of the browser
Expand Down

0 comments on commit ef2eae1

Please sign in to comment.