- Rename all cts-work references to pp-planer (valet, sanctum, playwright, e2e, docs) - Fix docker-compose build context to use project root with build/Dockerfile - Add .dockerignore to exclude unnecessary files from Docker build - start_dev.sh: stale PID cleanup, dependency checks, APP_KEY check, process health verification - stop_dev.sh: fix set -e crash on arithmetic, report already-dead processes, idempotent exit
28 lines
1,021 B
TypeScript
28 lines
1,021 B
TypeScript
import { test as setup, expect } from '@playwright/test';
|
|
|
|
const authFile = 'tests/e2e/.auth/user.json';
|
|
|
|
setup('authenticate', async ({ page }) => {
|
|
// Navigate to login page to establish session cookies (incl. XSRF-TOKEN)
|
|
await page.goto('http://pp-planer.test/login');
|
|
|
|
// Get XSRF token from cookies for CSRF protection
|
|
const cookies = await page.context().cookies('http://pp-planer.test');
|
|
const xsrfCookie = cookies.find((c) => c.name === 'XSRF-TOKEN');
|
|
const xsrfToken = decodeURIComponent(xsrfCookie?.value || '');
|
|
|
|
// POST to dev-login route directly (bypasses Vue rendering dependency)
|
|
await page.request.post('http://pp-planer.test/dev-login', {
|
|
headers: {
|
|
'X-XSRF-TOKEN': xsrfToken,
|
|
},
|
|
});
|
|
|
|
// Navigate to dashboard to confirm login and load session
|
|
await page.goto('http://pp-planer.test/dashboard');
|
|
await page.waitForURL('**/dashboard');
|
|
|
|
// Save signed-in state
|
|
await page.context().storageState({ path: authFile });
|
|
});
|