test: add Playwright e2e smoke suite for punimtag dev
CI / skip-ci-check (pull_request) Successful in 4s
CI / docker-ci (pull_request) Successful in 5s
CI / secret-scan (pull_request) Successful in 10s
CI / e2e (pull_request) Successful in 46s

Add an e2e/ Playwright harness (via @levkin/playkit) that smoke-tests
the public DEV host: login page loads, sign-out never redirects to a
LAN host, FastAPI /health responds, and forgot-password mail lands in
Mailtrap with a public reset link (Kolby #56/#57 regressions).

Wire it into Gitea Actions as a new `e2e` job (self-hosted runner,
Chromium via Playwright), gated behind the existing skip-ci-check.
Add npm root scripts (install:e2e, test:e2e) and gitignore e2e build
artifacts (node_modules, reports, .env).
This commit is contained in:
2026-07-14 17:11:38 -04:00
parent 44f3d696e4
commit 0a9223c943
15 changed files with 563 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
import {
assertPublicHost,
waitForUrlHost,
} from '@levkin/playkit';
import { test, expect } from '../fixtures';
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());
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.getByLabel('Account menu').waitFor({ state: 'visible' });
});
await waitForUrlHost(page, playkitConfig.expectedHost);
await timings.measure('sign_out', () => accountMenu.signOut());
// 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,
});
});
});