playwright: [Question] Error: Timed out waiting 60000ms from config.webServer.
I have playwright.config.ts as following with SvelteKit:
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
fullyParallel: true,
webServer: {
command: 'npm run build && npm run preview',
port: 4173
}
};
export default config;
I got an error Error: Timed out waiting 60000ms from config.webServer., so I set timeout with different values, but I keep getting the same error.
I tried globalTimeout but the it returns the same error.
How to solve this error?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 16 (4 by maintainers)
Commits related to this issue
- WIP: playwright test in leaflet. Not working, maybe linked to https://github.com/microsoft/playwright/issues/16834 — committed to mclaeysb/allmaps by mclaeysb 3 years ago
- use localhost in playwright config https://github.com/microsoft/playwright/issues/16834#issuecomment-1699124292 — committed to Docmaps-Project/docmaps by andrewedstrom 3 years ago
- fix failing test, see microsoft/playwright/issues/16834 — committed to Normal-OJ/new-front-end by uier 3 years ago
- fix failing test, see microsoft/playwright/issues/16834 — committed to Normal-OJ/new-front-end by uier 3 years ago
- Feat/upgrade node ts (#167) * upgrade ts and node * upgrade ts eslint to the version that supports ts 5.4 * upgrade vue-tsc to fix build fail bug * fix failing test, see microsoft/playwright... — committed to Normal-OJ/new-front-end by uier 3 years ago
Had the same issue. Fixed it by using localhost instead of 127.0.0.1:
I also used sveltekit. For me none of the above worked. However, switching out url with port made it work:
Also,
stdout:'pipe'option may give some usefull hints if you’re still stuck.Hi @mklueh,
I had a similar / or maybe the same problem. It was because the webServer command, in your case
pnpm previewmight include a build step which indeed exceeds the timeout. So the solution for us was to raise the timeout. To do so, you have to specify it in the right place:Hope this helps! Cheers, Matthias
I have the problem despite using localhost
Apparently your server doesn’t start or listens to a different port (not 4173). What does
npm run build && npm run previewdo, can you share the code?What is the output of
npm run build && npm run previewif you run it in the terminal? You can see it by running playwright withDEBUG=pw:webserverenvironment variable, it should give you an idea where the server is stuck.Using
portinstead ofurlworked for me! Not sure why the docs don’t mention that. Thanks @kamerat !Hi,
We has this problem now and then but since updating to Playwright 1.48.1 yesterday we can hardly run the service anymore…
Our config file:
locally it all works fine, but when we run it in a github action (run on the github provided runners with os=ubuntu) we get the error:
Any idea what we can do?
Thanks @cesarm-meyersound, changing to localhost is what worked for me!
Same problem with Vue. In Vite config:
I fixed it port in webserver
I had the same issue with Astro 5.0.9, @playwright/test 1.50.1. @kamerat’s solution worked > Removing url and setting port fixed it:
// astro package.json scripts “dev”: “astro dev --host 127.0.0.1”
//playwright.config.ts use: { baseURL: ‘http://127.0.0.1:4321’, trace: ‘on-first-retry’ }, webServer: { command: “npm run dev”, port: 4321, reuseExistingServer: true },
For the benefit of anyone else experiencing a timeout: it looks like there are multiple possible causes here; but in general it’s likely to be a configuration issue. First check that
npm run build && npm run previewruns successfully on the command line and check the reported URL and port.In playwright.config.ts ensure that
webServer.portmatches the reported port (for me explicitly settingwebServer.urlstill resulted in a timeout).If you’re running with https then you’ll need to add the following to your playwright.config:
Server configuration in vite.config.ts is relevant here - e.g. if you override the default preview port. Note that if you set
server.https: truethen preview will also use https (even if you explicitlypreview.https: false).