Files
punimtag/e2e/tests/viewer.web-vitals.spec.ts
T
ilia 9b68afd24e
CI / skip-ci-check (pull_request) Successful in 29s
CI / docker-ci (pull_request) Successful in 32s
CI / python-lint (pull_request) Successful in 33s
CI / secret-scan (pull_request) Successful in 38s
CI / viewer-unit (pull_request) Successful in 1m46s
CI / admin-unit (pull_request) Successful in 2m0s
CI / e2e (pull_request) Failing after 2m19s
Fix scroll-restore e2e for CI: scrollTo + sessionStorage poll.
Use deterministic scrollTo instead of wheel; assert max(scrollY, stored)
after modal close. Re-enable web-vitals e2e.
2026-08-04 23:23:51 -04:00

34 lines
1.1 KiB
TypeScript

import { test } from '../fixtures';
import { BUDGET_MS, expectWithinBudget } from '../timing-budgets';
import {
CWV_BUDGET,
expectWithinCwvBudget,
installWebVitalsCollector,
readWebVitals,
} from '../web-vitals-budgets';
test.describe('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}`,
});
});
});