-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Description
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.
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
Labels
No labels