Some checks failed
Add auth setup project, viewer session check, upload that posts a fixture, FastAPI login spec (skips without E2E_API_*), and repo ROADMAP.md.
25 lines
950 B
TypeScript
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();
|
|
});
|
|
});
|
|
});
|