mirror of
https://github.com/willchen96/mike.git
synced 2026-07-26 23:51:08 +02:00
npm run test:e2e:local (or plain test:e2e via the webServer hook) boots Docker-checked local Supabase, loads schema + migrations + grants, wires backend/.env and frontend/.env.local, and raises the backend rate-limit caps the same way CI does — a full suite run exceeds the default 300-requests/15-min general cap, after which every call 429s and the profile/list waits time out. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
70 lines
2.5 KiB
TypeScript
70 lines
2.5 KiB
TypeScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
/**
|
|
* Run `npx playwright install` to download the browsers.
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
*/
|
|
export default defineConfig({
|
|
testDir: "./e2e",
|
|
/* These E2E tests run against a single shared backend and a single shared
|
|
test user (e2e@mike.local). Running them concurrently causes data races
|
|
on shared list views (projects/chats/workflows) and on the user's
|
|
session, producing flaky pass/fail that can't be trusted for regression
|
|
detection. So we run strictly one test at a time. */
|
|
fullyParallel: false,
|
|
workers: 1,
|
|
/* Fail the build on CI if you accidentally left test.only in the source */
|
|
forbidOnly: !!process.env.CI,
|
|
/* Retry on CI only */
|
|
retries: process.env.CI ? 2 : 0,
|
|
/* Reporter */
|
|
reporter: process.env.CI ? "github" : "list",
|
|
/* Shared settings for all the projects below */
|
|
use: {
|
|
baseURL: process.env.PLAYWRIGHT_BASE_URL ?? "http://localhost:3000",
|
|
trace: "on-first-retry",
|
|
screenshot: "only-on-failure",
|
|
},
|
|
|
|
projects: [
|
|
/* Run the auth setup before all other tests */
|
|
{
|
|
name: "setup",
|
|
testMatch: /auth\.setup\.ts/,
|
|
},
|
|
|
|
{
|
|
name: "chromium",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
storageState: "e2e/.auth/user.json",
|
|
},
|
|
dependencies: ["setup"],
|
|
},
|
|
],
|
|
|
|
/* Start the backend and the Next.js dev server when running locally.
|
|
The backend command first runs the local-stack setup (Docker check,
|
|
supabase start, schema + migrations + grants, env wiring) so a plain
|
|
`npm run test:e2e` works against a ready local Supabase — see
|
|
scripts/e2e-local-stack.sh. Idempotent: a few seconds when already up. */
|
|
webServer: process.env.CI
|
|
? undefined
|
|
: [
|
|
{
|
|
command:
|
|
"bash ../scripts/e2e-local-stack.sh --setup-only && npm run dev",
|
|
cwd: "backend",
|
|
url: "http://localhost:3001/health",
|
|
reuseExistingServer: true,
|
|
timeout: 120_000,
|
|
},
|
|
{
|
|
command: "npm run dev",
|
|
cwd: "frontend",
|
|
url: "http://localhost:3000",
|
|
reuseExistingServer: true,
|
|
timeout: 120_000,
|
|
},
|
|
],
|
|
});
|