a50e7f5386
25 tests across auth (A1-A5), posting (P1-P5), validation (V1-V4), tracker (T1-T5), and nav (N1-N5). Uses storageState for single login per run. Replaces post-with-photo.spec.js with post.spec.js. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
23 lines
809 B
JavaScript
23 lines
809 B
JavaScript
// @ts-check
|
|
const { test: setup } = require('@playwright/test');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
const USER = process.env.GRAV_TEST_USER;
|
|
const PASS = process.env.GRAV_TEST_PASS;
|
|
const AUTH_FILE = path.join(__dirname, '../.auth/user.json');
|
|
|
|
setup('authenticate', async ({ page }) => {
|
|
if (!USER || !PASS) throw new Error('GRAV_TEST_USER and GRAV_TEST_PASS must be set in .env');
|
|
|
|
fs.mkdirSync(path.dirname(AUTH_FILE), { recursive: true });
|
|
|
|
await page.goto('/login');
|
|
await page.fill('input[name="username"]', USER);
|
|
await page.fill('input[name="password"]', PASS);
|
|
await page.click('button[type="submit"]');
|
|
await page.waitForSelector('text=successfully logged in', { timeout: 10_000 });
|
|
|
|
await page.context().storageState({ path: AUTH_FILE });
|
|
});
|