2026-06-10 14:32:57 -05:00
|
|
|
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Playwright config for smoke-testing a DEPLOYED PR preview environment.
|
|
|
|
|
*
|
|
|
|
|
* Used by the datapacket-talos `pr-smoke-test` Tekton task, not local dev. Unlike
|
|
|
|
|
* playwright.config.ts there is no `webServer` — we hit the live preview at
|
|
|
|
|
* PREVIEW_URL (e.g. https://pr-1234.civitaic.com). Auth is minted by
|
|
|
|
|
* tests/preview-auth.setup.ts (no /testing/testing-login, which is dead under a
|
|
|
|
|
* production build). Requires env: PREVIEW_URL, NEXTAUTH_SECRET.
|
|
|
|
|
*
|
|
|
|
|
* Run: PREVIEW_URL=… NEXTAUTH_SECRET=… npx playwright test -c playwright.preview.config.ts
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const PREVIEW_URL = process.env.PREVIEW_URL;
|
|
|
|
|
if (!PREVIEW_URL) {
|
|
|
|
|
throw new Error('PREVIEW_URL is required for playwright.preview.config.ts');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
testDir: './tests',
|
test(preview): buzz / membership / download e2e specs (#2467)
* test(preview): buzz / membership / download e2e specs
Extends the preview smoke harness with the first tranche of flow coverage
(revenue/access surfaces), run report-only against deployed previews as the
minted fixture users:
- preview-buzz.spec.ts: /purchase/buzz + /pricing render package/plan options
and a checkout affordance for a gate-passing paid member (gold); no transact.
- preview-membership.spec.ts: gold (paid) sees the current-member view;
tester (free) is SSR-redirected to /pricing and sees a subscribe CTA. Keys on
the deterministic getServerSideProps redirect, not copy.
- preview-download.spec.ts: gold + tester reach a model detail page from the
listing (no hardcoded id) and see a download affordance. (restricted is NOT
used — it fails the gate; the in-app comparison is free vs paid, and the code
has no guaranteed free/paid download difference outside early-access.)
Also anchor the preview-config testMatch to the filename
(/(^|\/)preview-.*\.spec\.ts$/) — the unanchored form matched a parent dir
named like a worktree (civitai-preview-*) and wrongly pulled the non-preview
specs (auction/generation/example) into the preview run.
Selectors are first-draft (broad/resilient) and get validated by the next
report-only preview run.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): make download spec light + robust (was crashing the preview)
The first draft browsed the heavy /models infinite-scroll listing and clicked
the first card, for both gold AND tester across 4 workers. That load crashed the
single-replica preview pod (exit 139) and cascaded fast failures into the rest
of the suite (base smoke went red as collateral on PR #2467 run jpcgz).
Rework: resolve a real model id from the public /api/v1/models API and navigate
directly to /models/<id> — no listing, no fragile card selector — and assert as
gold only (no free-vs-paid download difference exists outside early-access).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): run smoke suite serially (workers:1)
The expanded 19-test suite at workers:4 segfaulted the single-replica preview
pod (exit 139) under concurrent heavy-page loads, cascading fast failures into
unrelated tests (base smoke loads went red on PR #2467 run s97wq even after the
download spec was lightened). The pod can't take concurrent load; run one page
at a time. Suite is small + report-only, so serial (~2-3 min) is the right call.
Reverses the earlier workers:4 — that suited a 12-test light suite, not this.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci: rebuild preview to validate heap fix (2Gi/1536)
* test(preview): authed warm-up of heavy pages + 60s nav timeout
Mop up the last cold-load flake (`tester loads /models`) now that the pod OOM
is fixed. Two changes:
- Warm /models + /images (not just /) in setup, AUTHENTICATED with the gold
cookie — an anon GET would just hit the gate's /login redirect and never warm
the real listing render path.
- navigationTimeout 45s -> 60s, aligned with the per-test timeout, so a cold
/models goto gets the full budget instead of dying at 45s.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 17:30:28 -05:00
|
|
|
// Anchor to the FILENAME (after a path separator) — an unanchored /preview-…/
|
|
|
|
|
// also matches a parent dir named like a worktree (…/civitai-preview-x/), which
|
|
|
|
|
// would wrongly pull in the non-preview specs (auction/generation/example).
|
|
|
|
|
testMatch: /(^|\/)preview-.*\.(setup|spec)\.ts$/,
|
|
|
|
|
fullyParallel: false,
|
2026-06-10 14:32:57 -05:00
|
|
|
forbidOnly: !!process.env.CI,
|
test(preview): pre-warm all heavy pages + 2 retries (kill the slow-window flake) (#2483)
* test(preview): pre-warm all heavy pages + 2 retries (kill the slow-window flake)
The dominant smoke flake is a cold/slow-window page.goto timeout on a heavy SSR
page — the offender rotates (/, /models, /user/membership, /generate,
/purchase/buzz, /moderator/*) depending on which page the slow window hits.
Two-pronged:
- Pre-warm EVERY heavy page the suite navigates in preview-auth.setup.ts (was
only /, /models, /images). Each route JIT-compiles on first hit, so warming
them up front (gold cookie for member pages, mod cookie for /moderator/*)
removes the cold-start cost that caused most flakes. Sequential + best-effort
(a slow warm GET still triggers the server-side compile).
- retries 1 -> 2: a 2nd retry covers the residual mid-run slow window so it
flakes-and-recovers instead of surfacing as a failure.
Pairs with the 60s->90s timeout raise (#2480). Together these target a
consistently-clean run — a prerequisite for eventually flipping smoke to gating.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): raise setup timeout for cold-pod sequential warm-up (pr-review)
Addresses the pr-reviewer finding on this PR: the 8+ sequential warm-up GETs
(each 60s-capped) can, on a genuinely cold pod, cumulatively exceed the suite's
90s per-test timeout → the setup test times out → ALL dependent smoke tests are
SKIPPED (worse than the flake this PR fixes). The passing run only saw 1.7s
because the pod was already warm from verify-preview.
Fix: setup.setTimeout(480_000) — a ceiling for worst-case cold sequential
warm-up. Kept sequential (parallel heavy SSR renders OOM the single-replica pod,
per the config comment — the OOM is about concurrent renders, not specifically
playwright workers, so concurrent HTTP GETs are NOT a safe alternative here). The
ceiling doesn't slow the normal path: the setup still finishes as fast as the
warm-ups actually take.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 17:03:41 -05:00
|
|
|
// 2 retries (was 1): the preview pod can hit a transient CPU-throttle window on a
|
|
|
|
|
// contended node; with pre-warm (preview-auth.setup.ts) covering cold-start, the
|
|
|
|
|
// residual flake is a mid-run slow window. A 2nd retry gives it another recovery
|
|
|
|
|
// chance so a slow window flakes-and-recovers instead of surfacing as a failure.
|
|
|
|
|
retries: process.env.CI ? 2 : 0,
|
test(preview): buzz / membership / download e2e specs (#2467)
* test(preview): buzz / membership / download e2e specs
Extends the preview smoke harness with the first tranche of flow coverage
(revenue/access surfaces), run report-only against deployed previews as the
minted fixture users:
- preview-buzz.spec.ts: /purchase/buzz + /pricing render package/plan options
and a checkout affordance for a gate-passing paid member (gold); no transact.
- preview-membership.spec.ts: gold (paid) sees the current-member view;
tester (free) is SSR-redirected to /pricing and sees a subscribe CTA. Keys on
the deterministic getServerSideProps redirect, not copy.
- preview-download.spec.ts: gold + tester reach a model detail page from the
listing (no hardcoded id) and see a download affordance. (restricted is NOT
used — it fails the gate; the in-app comparison is free vs paid, and the code
has no guaranteed free/paid download difference outside early-access.)
Also anchor the preview-config testMatch to the filename
(/(^|\/)preview-.*\.spec\.ts$/) — the unanchored form matched a parent dir
named like a worktree (civitai-preview-*) and wrongly pulled the non-preview
specs (auction/generation/example) into the preview run.
Selectors are first-draft (broad/resilient) and get validated by the next
report-only preview run.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): make download spec light + robust (was crashing the preview)
The first draft browsed the heavy /models infinite-scroll listing and clicked
the first card, for both gold AND tester across 4 workers. That load crashed the
single-replica preview pod (exit 139) and cascaded fast failures into the rest
of the suite (base smoke went red as collateral on PR #2467 run jpcgz).
Rework: resolve a real model id from the public /api/v1/models API and navigate
directly to /models/<id> — no listing, no fragile card selector — and assert as
gold only (no free-vs-paid download difference exists outside early-access).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): run smoke suite serially (workers:1)
The expanded 19-test suite at workers:4 segfaulted the single-replica preview
pod (exit 139) under concurrent heavy-page loads, cascading fast failures into
unrelated tests (base smoke loads went red on PR #2467 run s97wq even after the
download spec was lightened). The pod can't take concurrent load; run one page
at a time. Suite is small + report-only, so serial (~2-3 min) is the right call.
Reverses the earlier workers:4 — that suited a 12-test light suite, not this.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci: rebuild preview to validate heap fix (2Gi/1536)
* test(preview): authed warm-up of heavy pages + 60s nav timeout
Mop up the last cold-load flake (`tester loads /models`) now that the pod OOM
is fixed. Two changes:
- Warm /models + /images (not just /) in setup, AUTHENTICATED with the gold
cookie — an anon GET would just hit the gate's /login redirect and never warm
the real listing render path.
- navigationTimeout 45s -> 60s, aligned with the per-test timeout, so a cold
/models goto gets the full budget instead of dying at 45s.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 17:30:28 -05:00
|
|
|
// Run SERIALLY. The preview is a single-replica, cold, resource-modest pod.
|
|
|
|
|
// Concurrent loads of the heavy pages (/models, /images, /purchase/buzz,
|
|
|
|
|
// /pricing, model detail) across multiple workers segfaulted it (exit 139),
|
|
|
|
|
// which cascaded fast failures into unrelated tests. One page at a time lets
|
|
|
|
|
// the pod cope; the suite is small + report-only, so serial (~2-3 min) is fine.
|
|
|
|
|
workers: 1,
|
2026-06-10 14:32:57 -05:00
|
|
|
// A freshly-deployed preview is cold: the first SSR render of a heavy page (the
|
|
|
|
|
// homepage especially) can take 30-40s while the Next server warms, JIT-compiles,
|
|
|
|
|
// and opens DB pools. The default 30s per-test timeout is too tight for that cold
|
|
|
|
|
// first hit, so raise both the per-test and navigation timeouts. The setup project
|
|
|
|
|
// also fires a warm-up request before the suite (preview-auth.setup.ts).
|
2026-06-11 15:14:11 -05:00
|
|
|
// 90s (was 60s): on a contended preview node the single-replica pod gets CPU-
|
|
|
|
|
// throttled and the heaviest SSR pages (/user/membership, /models) intermittently
|
|
|
|
|
// crossed the 60s ceiling (observed ~66s) — a slow window should flake-and-recover
|
|
|
|
|
// on retry, not hard-fail. 90s gives comfortable margin without masking a real hang.
|
|
|
|
|
timeout: 90_000,
|
2026-06-10 14:32:57 -05:00
|
|
|
reporter: [['list'], ['html', { open: 'never', outputFolder: 'playwright-report' }]],
|
|
|
|
|
use: {
|
|
|
|
|
baseURL: PREVIEW_URL,
|
|
|
|
|
trace: 'on-first-retry',
|
|
|
|
|
screenshot: 'only-on-failure',
|
test(preview): buzz / membership / download e2e specs (#2467)
* test(preview): buzz / membership / download e2e specs
Extends the preview smoke harness with the first tranche of flow coverage
(revenue/access surfaces), run report-only against deployed previews as the
minted fixture users:
- preview-buzz.spec.ts: /purchase/buzz + /pricing render package/plan options
and a checkout affordance for a gate-passing paid member (gold); no transact.
- preview-membership.spec.ts: gold (paid) sees the current-member view;
tester (free) is SSR-redirected to /pricing and sees a subscribe CTA. Keys on
the deterministic getServerSideProps redirect, not copy.
- preview-download.spec.ts: gold + tester reach a model detail page from the
listing (no hardcoded id) and see a download affordance. (restricted is NOT
used — it fails the gate; the in-app comparison is free vs paid, and the code
has no guaranteed free/paid download difference outside early-access.)
Also anchor the preview-config testMatch to the filename
(/(^|\/)preview-.*\.spec\.ts$/) — the unanchored form matched a parent dir
named like a worktree (civitai-preview-*) and wrongly pulled the non-preview
specs (auction/generation/example) into the preview run.
Selectors are first-draft (broad/resilient) and get validated by the next
report-only preview run.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): make download spec light + robust (was crashing the preview)
The first draft browsed the heavy /models infinite-scroll listing and clicked
the first card, for both gold AND tester across 4 workers. That load crashed the
single-replica preview pod (exit 139) and cascaded fast failures into the rest
of the suite (base smoke went red as collateral on PR #2467 run jpcgz).
Rework: resolve a real model id from the public /api/v1/models API and navigate
directly to /models/<id> — no listing, no fragile card selector — and assert as
gold only (no free-vs-paid download difference exists outside early-access).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): run smoke suite serially (workers:1)
The expanded 19-test suite at workers:4 segfaulted the single-replica preview
pod (exit 139) under concurrent heavy-page loads, cascading fast failures into
unrelated tests (base smoke loads went red on PR #2467 run s97wq even after the
download spec was lightened). The pod can't take concurrent load; run one page
at a time. Suite is small + report-only, so serial (~2-3 min) is the right call.
Reverses the earlier workers:4 — that suited a 12-test light suite, not this.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci: rebuild preview to validate heap fix (2Gi/1536)
* test(preview): authed warm-up of heavy pages + 60s nav timeout
Mop up the last cold-load flake (`tester loads /models`) now that the pod OOM
is fixed. Two changes:
- Warm /models + /images (not just /) in setup, AUTHENTICATED with the gold
cookie — an anon GET would just hit the gate's /login redirect and never warm
the real listing render path.
- navigationTimeout 45s -> 60s, aligned with the per-test timeout, so a cold
/models goto gets the full budget instead of dying at 45s.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 17:30:28 -05:00
|
|
|
// Align with the per-test timeout: a cold heavy-page (/models) goto can need
|
2026-06-11 15:14:11 -05:00
|
|
|
// most of the budget, and a tighter nav cap would fail it even though the test
|
|
|
|
|
// has 90s. The setup project also pre-warms /models + /images authenticated.
|
|
|
|
|
navigationTimeout: 90_000,
|
2026-06-10 14:32:57 -05:00
|
|
|
},
|
|
|
|
|
projects: [
|
test(preview): buzz / membership / download e2e specs (#2467)
* test(preview): buzz / membership / download e2e specs
Extends the preview smoke harness with the first tranche of flow coverage
(revenue/access surfaces), run report-only against deployed previews as the
minted fixture users:
- preview-buzz.spec.ts: /purchase/buzz + /pricing render package/plan options
and a checkout affordance for a gate-passing paid member (gold); no transact.
- preview-membership.spec.ts: gold (paid) sees the current-member view;
tester (free) is SSR-redirected to /pricing and sees a subscribe CTA. Keys on
the deterministic getServerSideProps redirect, not copy.
- preview-download.spec.ts: gold + tester reach a model detail page from the
listing (no hardcoded id) and see a download affordance. (restricted is NOT
used — it fails the gate; the in-app comparison is free vs paid, and the code
has no guaranteed free/paid download difference outside early-access.)
Also anchor the preview-config testMatch to the filename
(/(^|\/)preview-.*\.spec\.ts$/) — the unanchored form matched a parent dir
named like a worktree (civitai-preview-*) and wrongly pulled the non-preview
specs (auction/generation/example) into the preview run.
Selectors are first-draft (broad/resilient) and get validated by the next
report-only preview run.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): make download spec light + robust (was crashing the preview)
The first draft browsed the heavy /models infinite-scroll listing and clicked
the first card, for both gold AND tester across 4 workers. That load crashed the
single-replica preview pod (exit 139) and cascaded fast failures into the rest
of the suite (base smoke went red as collateral on PR #2467 run jpcgz).
Rework: resolve a real model id from the public /api/v1/models API and navigate
directly to /models/<id> — no listing, no fragile card selector — and assert as
gold only (no free-vs-paid download difference exists outside early-access).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): run smoke suite serially (workers:1)
The expanded 19-test suite at workers:4 segfaulted the single-replica preview
pod (exit 139) under concurrent heavy-page loads, cascading fast failures into
unrelated tests (base smoke loads went red on PR #2467 run s97wq even after the
download spec was lightened). The pod can't take concurrent load; run one page
at a time. Suite is small + report-only, so serial (~2-3 min) is the right call.
Reverses the earlier workers:4 — that suited a 12-test light suite, not this.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci: rebuild preview to validate heap fix (2Gi/1536)
* test(preview): authed warm-up of heavy pages + 60s nav timeout
Mop up the last cold-load flake (`tester loads /models`) now that the pod OOM
is fixed. Two changes:
- Warm /models + /images (not just /) in setup, AUTHENTICATED with the gold
cookie — an anon GET would just hit the gate's /login redirect and never warm
the real listing render path.
- navigationTimeout 45s -> 60s, aligned with the per-test timeout, so a cold
/models goto gets the full budget instead of dying at 45s.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 17:30:28 -05:00
|
|
|
{ name: 'preview-setup', testMatch: /(^|\/)preview-auth\.setup\.ts$/ },
|
2026-06-10 14:32:57 -05:00
|
|
|
{
|
|
|
|
|
name: 'preview-smoke',
|
test(preview): buzz / membership / download e2e specs (#2467)
* test(preview): buzz / membership / download e2e specs
Extends the preview smoke harness with the first tranche of flow coverage
(revenue/access surfaces), run report-only against deployed previews as the
minted fixture users:
- preview-buzz.spec.ts: /purchase/buzz + /pricing render package/plan options
and a checkout affordance for a gate-passing paid member (gold); no transact.
- preview-membership.spec.ts: gold (paid) sees the current-member view;
tester (free) is SSR-redirected to /pricing and sees a subscribe CTA. Keys on
the deterministic getServerSideProps redirect, not copy.
- preview-download.spec.ts: gold + tester reach a model detail page from the
listing (no hardcoded id) and see a download affordance. (restricted is NOT
used — it fails the gate; the in-app comparison is free vs paid, and the code
has no guaranteed free/paid download difference outside early-access.)
Also anchor the preview-config testMatch to the filename
(/(^|\/)preview-.*\.spec\.ts$/) — the unanchored form matched a parent dir
named like a worktree (civitai-preview-*) and wrongly pulled the non-preview
specs (auction/generation/example) into the preview run.
Selectors are first-draft (broad/resilient) and get validated by the next
report-only preview run.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): make download spec light + robust (was crashing the preview)
The first draft browsed the heavy /models infinite-scroll listing and clicked
the first card, for both gold AND tester across 4 workers. That load crashed the
single-replica preview pod (exit 139) and cascaded fast failures into the rest
of the suite (base smoke went red as collateral on PR #2467 run jpcgz).
Rework: resolve a real model id from the public /api/v1/models API and navigate
directly to /models/<id> — no listing, no fragile card selector — and assert as
gold only (no free-vs-paid download difference exists outside early-access).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(preview): run smoke suite serially (workers:1)
The expanded 19-test suite at workers:4 segfaulted the single-replica preview
pod (exit 139) under concurrent heavy-page loads, cascading fast failures into
unrelated tests (base smoke loads went red on PR #2467 run s97wq even after the
download spec was lightened). The pod can't take concurrent load; run one page
at a time. Suite is small + report-only, so serial (~2-3 min) is the right call.
Reverses the earlier workers:4 — that suited a 12-test light suite, not this.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci: rebuild preview to validate heap fix (2Gi/1536)
* test(preview): authed warm-up of heavy pages + 60s nav timeout
Mop up the last cold-load flake (`tester loads /models`) now that the pod OOM
is fixed. Two changes:
- Warm /models + /images (not just /) in setup, AUTHENTICATED with the gold
cookie — an anon GET would just hit the gate's /login redirect and never warm
the real listing render path.
- navigationTimeout 45s -> 60s, aligned with the per-test timeout, so a cold
/models goto gets the full budget instead of dying at 45s.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 17:30:28 -05:00
|
|
|
testMatch: /(^|\/)preview-.*\.spec\.ts$/,
|
2026-06-10 14:32:57 -05:00
|
|
|
dependencies: ['preview-setup'],
|
|
|
|
|
use: { ...devices['Desktop Chrome'] },
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
});
|