Skip to content

Test timeout of 30000ms exceeded error #20212

@iamAfrontendDev

Description

@iamAfrontendDev

I have a playwright test case where I want to get a web vital score called cumulative layout shift from Layout Instability API but when I run the test case I am getting error of timeout exceeded as I tried to increase the time of the test case in the config file as well but the result is same error.
Screenshot 2023-01-19 at 1 15 05 PM

export const CumulativeLayoutShift = async (page: Page) => {
  const cummulativeLayoutShift: any = await page.evaluate(() => {
    return new Promise((resolve) => {
      const observer = new PerformanceObserver((list: any) => {
        const result = list.getEntries();
        resolve(result[0]);
      });

      observer.observe({ type: 'layout-shift', buffered: true });
    });
  });
  console.log(`SHIFT - ${cummulativeLayoutShift}`);
  return cummulativeLayoutShift;
};
test('network throttling fast 3g', async ({ page }) => {
  await page.goto(HOME_PAGE_URL, { timeout: 50000 });

  const client = await page.context().newCDPSession(page);
  await client.send('Network.enable');
  await client.send('Network.emulateNetworkConditions', FAST_3G_CONFIG);
  expect(await CumulativeLayoutShift(page)).toBeLessThan(CUMULATIVE_LAYOUT_SHIFT_TIME_THRESHOLD);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions