I’ve created some Playwright tests that work locally but when I launch them in Jenkins they are failing. The logs show an infinite loop of "networkidle" event fired
I’ve tried to add this, still without success:
await page.goto('myurl', {
waitUntil: 'networkidle0', timeout: 500000,
});
The relevant code of my test is pretty much that, after the goto, I have a fill instruction that doesn’t begin because of the error
await page.goto('url', {
waitUntil: 'networkidle0', timeout: 500000,
});
await page.getByPlaceholder('Username').fill('user');
Since this is working locally I’m wondering if the problem could be related with network issues, but I don’t have access to the machine where Jenkins is running.
Also, I’m launching this in headless mode, and ignoring https errors, defined with two lines before the code above
test.use({ ignoreHTTPSErrors: true });
test.use({ headless: true });
Any idea about what can be happening or how I could debug this?
1
There’s no networkidle0
, but networkidle
.
await page.goto(url, { waitUntil: "networkidle" });
Also don’t use it as Playwright docs suggest 'networkidle' - DISCOURAGED consider operation to be finished when there are no network connections for at least 500 ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
In your example it will be (if you really need 50s to load it)
await page.goto(url);
await page.getByPlaceholder('Username').fill('user', {timeout: 50_000});
1