punimtag/e2e/tests/viewer.session.spec.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

25 lines
950 B
TypeScript

import { assertPublicHost, waitForUrlHost } from '@levkin/playkit';
import path from 'node:path';
import { test, expect } from '../fixtures';
/**
* Viewer (NextAuth) session — cookies from storageState.
* FastAPI bearer auth is a separate user store; see api.fastapi-login.spec.ts.
*/
test.describe('viewer session @smoke', () => {
test.use({ storageState: path.join(__dirname, '../.auth/admin.json') });
test('session endpoint returns authenticated user', async ({ page, playkitConfig, timings }) => {
assertPublicHost(playkitConfig.baseUrl);
await timings.measure('session', async () => {
await page.goto(`${playkitConfig.baseUrl}/`);
await waitForUrlHost(page, playkitConfig.expectedHost);
const res = await page.request.get(`${playkitConfig.baseUrl}/api/auth/session`);
expect(res.ok()).toBeTruthy();
const body = await res.json();
expect(body?.user?.email).toBeTruthy();
});
});
});