[BUG] waitFor set timeout doesn't work in headless mode but does work in headed mode
See original GitHub issueContext:
- Playwright Version: ^1.18.1
- Operating System: Linux
- Node.js version: v16.13.1
- Browser: Chromium
Code Snippet
test('2.4 - Delete a new sandbox', async ({ page }) => {
page.setDefaultTimeout(600000);
const APP = 'baseline-sandbox-delete';
const SANDBOX = 'development';
const applicationPage = new ApplicationPage(page);
await expect(applicationPage.getApplicationTitle(APP)).toBeVisible();
const sandbox = await applicationPage.getSandboxOrBranchElement(SANDBOX);
const sandboxExists = (await sandbox.count()) > 0;
if (!sandboxExists) {
await applicationPage.createSandbox(SANDBOX);
await expect(applicationPage.creatingSandboxOrBranchText).toBeVisible();
const loading = applicationPage.creatingSandboxOrBranchText;
await loading.waitFor({ state: 'hidden', timeout: 600000 });
}
await applicationPage.deleteSandbox(SANDBOX);
await expect(sandbox).toHaveCount(0);
});
Describe the bug
Wen running the test as described above in headed mode with PWDEBUG=1
I can see that the test pauses until the loading element disappears and then continues with the deletion part which is what I expect. However when running the test in headless mode it seems to ignore the timeout thus resulting in the test to fail because the loading state is still visible at that time.
Error:
`Timeout of 30000ms exceeded.
Pending operations:
- locator.waitFor at tests/applications/applications.spec.ts:87:19
locator.waitFor: Target closed
=========================== logs ===========================
waiting for selector "p:has-text("%")" to be hidden
selector resolved to visible <p class="sc-TBWPX joiGzv">0%</p>
============================================================
85 | await expect(applicationPage.creatingSandboxOrBranchText).toBeVisible();
86 | const loading = applicationPage.creatingSandboxOrBranchText;
> 87 | await loading.waitFor({ state: 'hidden', timeout: 600000 });
| ^
88 | }
89 | await applicationPage.deleteSandbox(SANDBOX);
90 | await expect(sandbox).toHaveCount(0);
`
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
waitForSelector with Puppeteer not responding only in ...
When I run puppeteer with headless: false it successfully waits for the selector nameField however with headless: true I just get the timeout...
Read more >How to Get Selenium to Wait for Page Load After a Click
Ever wondered how to set up Selenium so it should just wait until the page has completed loading after you click on a...
Read more >Browser - MarketSquare
Browser library is a browser automation library for Robot Framework. This is the keyword documentation for Browser library.
Read more >SeleniumBase Docs
A complete framework for end-to-end testing with Python, pytest, behave-BDD, and WebDriver.
Read more >From capybara-webkit to Headless Chrome and ChromeDriver
While capybara-webkit did the job for quite some time, the change to a more modern alternative (Chrome's headless mode) will make tests more ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same problem. Code works headed mode but doesn’t in headless mode.
We need more information to act on this report. Please file a new one and link to this issue when you get back to it!