CI / skip-ci-check (pull_request) Successful in 5s
CI / docker-ci (pull_request) Successful in 7s
CI / secret-scan (pull_request) Successful in 12s
CI / viewer-unit (pull_request) Successful in 1m29s
CI / e2e (pull_request) Successful in 4m8s
CI / admin-unit (pull_request) Successful in 4m24s
Closes three items from the outstanding e2e/CI gap list: - Timing budgets: timings.measure() only ever recorded durations for the (still-unwired) Pushgateway export — nothing failed CI when a step got slow. Add e2e/timing-budgets.ts (expectWithinBudget + shared BUDGET_MS buckets) and wire it into every measure() call site across the suite. Mail-wait steps are deliberately left unbudgeted (external mail-trap delivery latency, not a code performance signal). - actions/upload-artifact@v4 doesn't work against this Gitea/act runner's artifact backend — pin to v3 for the e2e failure-report upload. - Shared act_runner npm cache has corrupted platform-native tarballs before (@next/swc-linux-x64-musl) and reds viewer-unit/admin-unit/e2e with no product bug involved. All three npm ci steps now retry once after `npm cache clean --force` on first failure. Verified: full local suite green against DEV (37 passed, 6 skipped, no budget assertion failures) before wiring into CI.
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
import {
|
|
assertPublicHost,
|
|
waitForUrlHost,
|
|
} from '@levkin/playkit';
|
|
import { test, expect } from '../fixtures';
|
|
import { BUDGET_MS, expectWithinBudget } from '../timing-budgets';
|
|
|
|
test.describe('auth @smoke', () => {
|
|
test('login page loads on public host', async ({
|
|
page,
|
|
playkitConfig,
|
|
timings,
|
|
loginPage,
|
|
}) => {
|
|
assertPublicHost(playkitConfig.baseUrl);
|
|
|
|
await timings.measure('login_page', () => loginPage.openLogin());
|
|
expectWithinBudget(timings, 'login_page', BUDGET_MS.uiAction);
|
|
|
|
await expect(page.getByRole('heading', { name: /Sign in/i })).toBeVisible();
|
|
await expect(page.locator('#email')).toBeVisible();
|
|
await waitForUrlHost(page, playkitConfig.expectedHost);
|
|
expect(new URL(page.url()).hostname).toBe(playkitConfig.expectedHost);
|
|
});
|
|
|
|
test('sign-out stays on public host (Kolby #57)', async ({
|
|
page,
|
|
playkitConfig,
|
|
timings,
|
|
loginPage,
|
|
accountMenu,
|
|
e2eCredentials,
|
|
}) => {
|
|
test.skip(
|
|
!e2eCredentials,
|
|
'Set E2E_ADMIN_EMAIL and E2E_ADMIN_PASSWORD (Infisical / Gitea secrets)',
|
|
);
|
|
|
|
assertPublicHost(playkitConfig.baseUrl);
|
|
|
|
await timings.measure('login', async () => {
|
|
await loginPage.openLogin();
|
|
await loginPage.signIn(e2eCredentials!.email, e2eCredentials!.password);
|
|
await page.waitForURL((url) => !url.pathname.includes('/login'), { timeout: 30_000 });
|
|
await page.getByLabel('Account menu').waitFor({ state: 'visible', timeout: 30_000 });
|
|
});
|
|
expectWithinBudget(timings, 'login', BUDGET_MS.uiLogin);
|
|
|
|
await waitForUrlHost(page, playkitConfig.expectedHost);
|
|
|
|
await timings.measure('sign_out', () => accountMenu.signOut());
|
|
expectWithinBudget(timings, 'sign_out', BUDGET_MS.uiAction);
|
|
|
|
// After sign-out, NextAuth must redirect to the public host — never 10.x.
|
|
await waitForUrlHost(page, playkitConfig.expectedHost);
|
|
expect(new URL(page.url()).hostname).toBe(playkitConfig.expectedHost);
|
|
expect(page.url()).not.toMatch(/10\.\d+\.\d+\.\d+/);
|
|
|
|
await expect(page.getByRole('button', { name: /Sign in/i })).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
});
|
|
});
|