19 lines
839 B
TypeScript
19 lines
839 B
TypeScript
import { test as setup, expect } from '@playwright/test';
|
|
import { TEST_EMAIL, TEST_PASSWORD, TEST_ORG_SLUG } from './helpers';
|
|
|
|
const authFile = 'tests/e2e/.auth/user.json';
|
|
|
|
setup('authenticate', async ({ page }) => {
|
|
// networkidle ensures Svelte 5 hydration completes (event delegation attached)
|
|
await page.goto('/login', { waitUntil: 'networkidle' });
|
|
await page.fill('input[type="email"]', TEST_EMAIL);
|
|
await page.fill('input[type="password"]', TEST_PASSWORD);
|
|
await page.click('button[type="submit"]');
|
|
// After login, the app redirects to "/" (org selector)
|
|
await page.waitForURL('/', { timeout: 30000 });
|
|
// Verify we see the org selector
|
|
await expect(page.getByRole('link', { name: /root-test/i }).first()).toBeVisible({ timeout: 10000 });
|
|
// Save auth state
|
|
await page.context().storageState({ path: authFile });
|
|
});
|