-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: wait for pending navigation to resolve before many actions #32899
Conversation
This comment has been minimized.
This comment has been minimized.
05c1fab
to
7ee0390
Compare
This comment has been minimized.
This comment has been minimized.
This includes all actions that perform locator handler check. Note this makes it impossible to interact with the page while a main frame navigation is ongoing. This was already the case for Chromium, but now WebKit and Firefox align with it. Setting `PLAYWRIGHT_SKIP_NAVIGATION_CHECK` environment variable disables this behavior.
7ee0390
to
361b218
Compare
Test results for "tests 1"2 flaky35759 passed, 680 skipped Merge workflow run. |
Hey @dgozman We have noticed that some of our tests stopped working after bumping our Playwright version from I debugged the issue and I pinned it down to the changes in this pull request. The problem we are having is when we click on a link which triggers the Here is a simple test replicating the error ... const {chromium} = require('playwright');
const {expect} = require('@playwright/test');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.mainFrame().goto('https://www.npmjs.com/');
expect(await page.mainFrame().title()).toStrictEqual('npm | Home');
await page.evaluate(() => {
window.onbeforeunload = () => false;
});
page.on('dialog', async dialog => {
await dialog.dismiss();
});
await page.getByRole('menuitem', {name: 'Teams'}).click({noWaitAfter: true});
await page.evaluate(() => {
window.onbeforeunload = null;
});
// Timeout error will occur here:
await page.getByRole('menuitem', {name: 'Teams'}).click({timeout: 1000});
expect(await page.mainFrame().title()).toStrictEqual('npm | Teams');
await browser.close();
})(); The test fails on the line
During debugging, I noticed the If this line
if (!mainFrame || !mainFrame.pendingDocument() || !mainFrame.pendingDocument().documentId)
return; Is this a genuine issue that should be fixed? |
@chrisbottin This is a genuine issue, I filed #33806 on your behalf. We'll take a look. |
This includes all actions that perform locator handler check.
Note this makes it impossible to interact with the page while a main frame navigation is ongoing. This was already the case for Chromium, but now WebKit and Firefox align with it.
Setting
PLAYWRIGHT_SKIP_NAVIGATION_CHECK
environment variable disables this behavior.