import { test } from '../fixtures'; import { BUDGET_MS, expectWithinBudget } from '../timing-budgets'; import { CWV_BUDGET, expectWithinCwvBudget, installWebVitalsCollector, readWebVitals, } from '../web-vitals-budgets'; test.describe.skip('viewer web vitals @smoke', () => { test.beforeEach(async ({ page }) => { await installWebVitalsCollector(page); }); test('home gallery LCP and CLS within budget', async ({ page, playkitConfig, timings }) => { await timings.measure('open_gallery_cwv', async () => { await page.goto(`${playkitConfig.baseUrl}/`); await page .getByLabel('Account menu') .or(page.getByRole('button', { name: /Sign in/i })) .first() .waitFor({ state: 'visible', timeout: 20_000 }); }); expectWithinBudget(timings, 'open_gallery_cwv', BUDGET_MS.uiAction); const vitals = await readWebVitals(page); expectWithinCwvBudget(vitals); test.info().annotations.push({ type: 'cwv', description: `LCP=${Math.round(vitals.lcp)}ms CLS=${vitals.cls.toFixed(3)} budgets LCP<=${CWV_BUDGET.lcp} CLS<=${CWV_BUDGET.cls}`, }); }); });