Playwright Intermittent Connection Refused Error
As I have more tests in Playwright, the number of workers required grow and I happened to encounter the following error:
Error: page.goto: NS_ERROR_CONNECTION_REFUSED
And the tests that failed changes every time playwright test is run.
To solve this, I reduce the workers in playwright.config.ts.
from:
workers: process.env.CI ? 1 : undefined,
to:
workers: process.env.CI ? 1 : 8, //8 works fine for me. I will go smaller like 4 or 5 if the issue persists. This defines the max workers
Alternatively, workers can be set when running the test.
npx playwright test --workers 8
For more information:
https://playwright.dev/docs/test-parallel#limit-workers
Comments
Post a Comment