Files
punimtag/e2e/tests/viewer.web-vitals.spec.ts
T
ilia 26faf33a95
CI / skip-ci-check (pull_request) Successful in 29s
CI / docker-ci (pull_request) Successful in 32s
CI / python-lint (pull_request) Successful in 32s
CI / secret-scan (pull_request) Successful in 37s
CI / viewer-unit (pull_request) Successful in 1m53s
CI / admin-unit (pull_request) Successful in 2m39s
CI / e2e (pull_request) Failing after 3m19s
Sprint D: hardening e2e, /search redirect, scroll restore fix.
Admin review smoke tests, CWV budgets, unified gallery at /, and explicit
body unlock when closing the photo modal so scroll position restores.
2026-08-04 22:17:43 -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}`,
});
});
});