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.
21 lines
899 B
TypeScript
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);
|
|
});
|