[BUG] Always timeout error from toHaveURL when its has already succeeded in Docker Playwright
See original GitHub issueContext:
- Playwright Version: @playwright/test ^1.23.1
- Operating System: Local is Mac, but the spec fail with Docker mcr.microsoft.com/playwright:v1.24.2-focal
- Node.js version: 16.13.1
- Browser: Chromium
Code Snippet
// Calling API and redirects
await expect(page).toHaveURL(`/orders/${createOrderResponse?.order_detail?.id}?orderNature=incoming`);
Describe the bug
Spec ONLY failed when running Bitbucket Pipeline with official Playwright docker image mcr.microsoft.com/playwright:v1.24.2-focal
. I can’t repro this at local.
I tried adding debug mode and noticed the logs are both successfully navigated to the expected URL.
This is the successful logs when running from local:
pw:api => expect.toHaveURL started +5ms
pw:api expect.toHaveURL with timeout 5000ms +2ms
pw:api waiting for selector ":root" +3ms
pw:api selector resolved to <html>…</html> +5ms
pw:api unexpected value "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/" +1ms
pw:api selector resolved to <html>…</html> +101ms
pw:api unexpected value "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/" +1ms
pw:api selector resolved to <html>…</html> +255ms
pw:api unexpected value "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/" +1ms
pw:api "networkidle" event fired +124ms
pw:api selector resolved to <html>…</html> +383ms
pw:api unexpected value "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/" +2ms
pw:api navigated to "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/orders/400?orderNature=incoming" +161ms
pw:api selector resolved to <html class=" ">…</html> +848ms
pw:api <= expect.toHaveURL succeeded +14ms
pw:api => browserContext.close started +8ms
pw:api <= browserContext.close succeeded +16ms
pw:api => browser.close started +13ms
pw:api <= browser.close succeeded +22ms
This is logs from the same code but run by Bitbucket Pipeline with Playwright Docker image:
pw:api => expect.toHaveURL started +4ms
pw:api expect.toHaveURL with timeout 5000ms +1ms
pw:api waiting for selector ":root" +1ms
pw:api selector resolved to <html>…</html> +8ms
pw:api unexpected value "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/" +1ms
pw:api selector resolved to <html>…</html> +100ms
pw:api unexpected value "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/" +1ms
pw:api selector resolved to <html>…</html> +250ms
pw:api unexpected value "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/" +1ms
pw:api "networkidle" event fired +133ms
pw:api selector resolved to <html>…</html> +367ms
pw:api unexpected value "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/" +1ms
pw:api navigated to "https://backoffice-runchise-git-fix-wbo-220-runchise-go.vercel.app/orders/399?orderNature=incoming" +230ms
pw:api => browserContext.close started +301ms
pw:api <= expect.toHaveURL succeeded +8ms
pw:api <= browserContext.close succeeded +10ms
pw:api => browser.close started +1ms
pw:api <= browser.close succeeded +33ms
But at the end Playwright will return errors with timeout. I have tried increasing the timeout duration but still failed.

Not sure what more can I debug when the playwright API already said it succeeded but somehow still return as timeout error. Any info/help is appreciated, thank you.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How To Run End-to-End Tests Using Playwright and Docker
In this tutorial, you will set up an environment to use Playwright with Typescript for end-to-end testing, write and execute the tests, ...
Read more >On Migrating from Cypress to Playwright - mtlynch.io
I've been using Cypress since I saw it demoed at a dev meetup in 2018. Before discovering Cypress, I had begrudgingly used Selenium....
Read more >Getting an error wrapping Playwright in a Docker image
As you have already stated, this is a bug (which is now in a feature request), since the docker file given by MS...
Read more >E2E testing with Playwright and Docker | by Beppe Catanese
Playwright is a modern framework that simplifies the creation and maintenance of web application end-to-end (E2E) testing. The landscape of e2e testing ...
Read more >Release notes
Browser Versions. Chromium 109.0.5414.46; Mozilla Firefox 107.0; WebKit 16.4. This version was also tested against the following stable channels: Google ...
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
exactly! Happy to hear, closing by that.
Hi @mxschmitt thankyou for that! I tried increasing the test timeouts to 60 seconds and now all the test passed without any timeout error.
So I guess the issue is my local run the test faster than the bitbucket pipeline? 😅