punimtag/e2e/tests/auth.setup.ts
ilia d9910acdde
Some checks failed
CI / skip-ci-check (pull_request) Successful in 3s
CI / docker-ci (pull_request) Successful in 5s
CI / secret-scan (pull_request) Successful in 12s
CI / viewer-unit (pull_request) Successful in 3m11s
CI / e2e (pull_request) Failing after 5m24s
Fill e2e gaps: storageState, real upload POST, session smoke
Add auth setup project, viewer session check, upload that posts a fixture,
FastAPI login spec (skips without E2E_API_*), and repo ROADMAP.md.
2026-07-14 19:17:14 -04:00

21 lines
899 B
TypeScript

import { assertPublicHost, saveStorageState, waitForUrlHost } from '@levkin/playkit';
import { test as setup } from '../fixtures';
import path from 'node:path';
const authFile = path.join(__dirname, '../.auth/admin.json');
setup('authenticate e2e admin', async ({ page, playkitConfig, loginPage, e2eCredentials, timings }) => {
setup.skip(!e2eCredentials, 'E2E_ADMIN_EMAIL/PASSWORD required');
assertPublicHost(playkitConfig.baseUrl);
await timings.measure('setup_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 });
await waitForUrlHost(page, playkitConfig.expectedHost);
});
await saveStorageState(page, authFile);
});