-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Navigation failed: Timed out waiting for the page load event - breaks our tests #1421
Comments
Hey @shwarcu 👋 Thanks for reporting this, we currently rely on load events and haven't been notified by any users about this issue. So it seems like a very specific issue pertaining to your application. It'll be great if you share a small reproducible example that doesn't need to be your private code, so we could debug and provide support further. For now, I'm going ahead and adding an |
I'm not sure how to create an example where |
@shwarcu This would require us to implement this, and it is currently not planned. |
I'm facing the same issue with percy and playwrite Here is my logs
@shwarcu if you have found for a workaround, could you please share it? |
@itsjwala i can share the reproducible example import { test, expect } from '@playwright/test';
const percySnapshot = require('@percy/playwright');
test.describe('Percy error test @percyerror', () => {
test('Art galleries page', async ({ page }) => {
await page.goto('https://www.yourart.art/galleries');
await expect(page.locator('.Galleries_galleriesList__kYj5z')).toBeVisible();
await page.waitForTimeout(3000);
await percySnapshot(page, 'Art galleries page EN prod');
});
}) configs // @ts-check
const { defineConfig, devices } = require('@playwright/test');
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
/**
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
globalSetup: "./helpers/global-setup",
testDir: './tests',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
timeout: 5 * 60 * 2000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 40000,
},
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
storageState: "storageState.json",
screenshot: "only-on-failure"
},
/* Configure projects for major browsers */
projects: [
{
name: 'Google Chrome',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1440, height: 900 },
},
},
],
}); package.json
percy.yaml
here is the test result with the error:
|
@olgamicollier I haven't found a workaround yet. I discovered that Playwright also has some issues with capturing |
@shwarcu one of the primary reasons for this exception is either bandwidth constrains or cpu constrains on CI machines. You can try adding some more CPU time to the CI pod if possible. |
After few weeks I found root cause of the problem. Application failed to fetch some resources from time to time, it seemed to be problem that happens only in github runners self hosted in k8s. Percy didn't list which requests were unfinished so I had to analyze multiple traces from Playwright. Solution to the problem was to intercept/mock all requests to CDN's. Once all resources were fetched from local host the problem seemed to be resolved. |
The problem
Our Percy tests in Playwright are frequently timing out because of error
Navigation failed: Timed out waiting for the page load event
which is thrown from https://github.com/percy/cli/blob/master/packages/core/src/page.js#L102
In our tests we intentionally do not rely on the
load
event as it seems that during Playwright tests sometimes this event is never fired.Before we take percy snapshot, we are waiting for UI elements that are indicator of page "readiness".
I am reporting this as a bug because
load
event is not reliable source of truth if page is ready for the test. In our case, SPA is fully loaded and rendered, waiting for percy to finish but it never happens as Percy incorrectly waits for load event that doesn't come.Environment
@percy/cli
version: 1.27.3 and 1.27.1"@percy/playwright": "^1.0.4",
npx percy exec
Details
Attaching relevant part of the Playwright report
Our test steps include assertions that make sure UI is ready for visual regression checks.
On video/screenshot, which I cannot share, we can also see that page is fully rendered and ready.
Debug logs
I am checking whether I can share entire logs. Here is most important part
Code to reproduce issue
Cannot disclosure, it would require sharing everything.
The text was updated successfully, but these errors were encountered: