ci/woodpecker/pr/ci Pipeline failed
- M1: E2E_REQUIRE_SEEDED_AUTH=1 in the CI e2e step makes login failures hard failures (loginAs throws, guards disabled, globalSetup refuses a pre-populated DB); auth.spec redirect test asserts outright under the flag; non-admin /admin test is now a real authorization assertion - M2: ci.yml build step depends_on test — never two concurrent turbo builds on the shared workspace - M3: unknown /assets/* paths 404 from the SPA catch-all instead of serving index.html with an immutable cache header; spec arm added - minors: e2e step gets when: *image_build_when, health poll uses GATEWAY_PORT + AbortSignal.timeout, BETTER_AUTH_SECRET generated per run (no literal in tree), failure echoes artifact path, dev-guide documents the gate, stale verify-release comment fixed
41 lines
1.8 KiB
TypeScript
41 lines
1.8 KiB
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
export const TEST_USER = {
|
|
email: process.env['E2E_USER_EMAIL'] ?? '[email protected]',
|
|
password: process.env['E2E_USER_PASSWORD'] ?? 'password123',
|
|
name: 'E2E Test User',
|
|
};
|
|
|
|
export const ADMIN_USER = {
|
|
email: process.env['E2E_ADMIN_EMAIL'] ?? '[email protected]',
|
|
password: process.env['E2E_ADMIN_PASSWORD'] ?? 'adminpass123',
|
|
name: 'E2E Admin User',
|
|
};
|
|
|
|
/**
|
|
* Set when the database was seeded by global-setup (CI sets it in the
|
|
* publish.yml e2e step). Seeded credentials MUST work, so login failures are
|
|
* hard failures and the skip-when-login-fails guards are disabled — otherwise
|
|
* a login regression would skip every authenticated suite and the gate would
|
|
* pass while proving nothing. Unset (a live environment used as a test
|
|
* target), the guards stay on and unseeded credentials skip their suites.
|
|
*/
|
|
export const REQUIRE_SEEDED_AUTH = process.env['E2E_REQUIRE_SEEDED_AUTH'] === '1';
|
|
|
|
/**
|
|
* Fill the login form and submit, then wait for the post-login redirect to
|
|
* /chat. Under REQUIRE_SEEDED_AUTH a missed redirect throws (failing the
|
|
* test). Otherwise the timeout is swallowed: the page stays on /login and the
|
|
* callers' `test.skip(...)` guards see that. Without this wait, every guard
|
|
* read page.url() before the redirect happened and skipped its suite even
|
|
* when login succeeded (#1445).
|
|
*/
|
|
export async function loginAs(page: Page, email: string, password: string): Promise<void> {
|
|
await page.goto('/login');
|
|
await page.getByLabel('Email').fill(email);
|
|
await page.getByLabel('Password').fill(password);
|
|
await page.getByRole('button', { name: /sign in/i }).click();
|
|
const redirect = page.waitForURL(/\/chat/, { timeout: 10_000 });
|
|
await (REQUIRE_SEEDED_AUTH ? redirect : redirect.catch(() => {}));
|
|
}
|