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(); }); }); });