test(e2e): align specs with the community edition and record the e2e baseline

The first full e2e run on this branch failed 19 tests, all on features the
community edition removed: /api/tier, Stripe, /api/compliance, the billing
settings tab, the payment pages and the upgrade dialog. Those checks now
assert that the endpoints and pages are gone (404); tier, billing and
team-settings probes are dropped from the remaining journeys. The rerun is
410 passed, 18 skipped, 0 failed.
This commit is contained in:
shumeiko.it
2026-10-20 01:36:38 +02:00
parent 01a2d8a4ce
commit 20567ecb10
11 changed files with 57 additions and 348 deletions

View File

@@ -58,17 +58,23 @@ than at the baseline is expected: the removed code took its tests with it.
| Lint, web | 38 errors, 60 warnings (all pre-existing; down from 49 errors) |
| Unit tests, root | 638 files, 10,751 tests: 10,655 passed, 41 failed, 55 skipped |
| Unit tests, web | 212 files, 1,884 tests, all passed |
| E2E | 410 passed, 18 skipped, 0 failed (7.0 min, Chromium) |
The 41 failures are the same four files as in "Known failures" above.
E2E ran with `WAGGLE_E2E_PORT=3344 WAGGLE_E2E_BASE_URL=http://127.0.0.1:3344
WAGGLE_E2E_REUSE_EXISTING_SERVER=0 WAGGLE_E2E_DATA_DIR=<temp dir> npm run test:e2e`, so it
neither reused nor disturbed a sidecar on `:3333` (it still rebuilds the root `dist/`). The
first run failed 19 tests, all on removed features: `/api/tier`, Stripe, `/api/compliance`,
the billing settings tab, the payment pages and the upgrade dialog. Those specs now assert
that the endpoints and pages are gone (404) instead. The 18 skips depend on the environment:
Windows-only launcher lanes, live chat without a provider key, and the optional team server.
## Not run yet
- **E2E and visual regression.** By default the Playwright web server reuses any sidecar on
`:3333` with its data directory, and it rebuilds the root `dist/`. A baseline run needs a
free port and an isolated data directory (`WAGGLE_E2E_REUSE_EXISTING_SERVER=0`,
`WAGGLE_E2E_PORT`) at a time when restarting the local sidecar is acceptable.
Several specs still exercise the removed tier, trial and Stripe endpoints (`/api/tier`,
`/api/stripe/*`, upgrade prompts); they are updated together with that first e2e run.
- **Visual regression** (`npm run test:visual`). It compares screenshots against 36
baselines with a 0.3% pixel threshold; the platform they were captured on is not recorded,
and the Cockpit and Memory screens have changed since. It is re-baselined in P2.7.
- **Infrastructure suites** (`npm run test:infra`) need Postgres and Redis and cover team
mode, which is not part of the community edition.
- **Windows and Linux.** This record covers macOS only.

View File

@@ -725,7 +725,6 @@ async function collectProbeContext(page: Page): Promise<ProbeContext> {
hooks: '/api/hooks',
fleet: '/api/fleet',
events: '/api/events?limit=3',
tier: '/api/tier',
};
const apiEntries = await Promise.all(
@@ -896,7 +895,7 @@ function scorePersona(persona: PersonaDefinition, context: ProbeContext): Person
id: 'addiction',
label: 'Addiction/return signal',
max: 20,
score: clampScore((memory?.recalled ? 7 : 0) + (context.api.events?.ok ? 3 : 0) + (context.api.hooks?.ok ? 4 : 0) + (context.api.workspaces?.ok ? 3 : 0) + (context.api.tier?.ok ? 3 : 0), 20),
score: clampScore((memory?.recalled ? 7 : 0) + (context.api.events?.ok ? 3 : 0) + (context.api.hooks?.ok ? 4 : 0) + (context.api.workspaces?.ok ? 3 : 0) + (context.api.fleet?.ok ? 3 : 0), 20),
evidence: [
`External trigger need: ${persona.externalTriggerNeed}.`,
`Internal trigger need: ${persona.internalTriggerNeed}.`,

View File

@@ -600,23 +600,6 @@ test.describe('B5 — Security Hardening (vs all competitors)', () => {
// timeout/ECONNRESET = server rejected oversized request (acceptable)
}
});
test('B5.7 — Stripe webhook signature verification enforced (no bypass)', async ({ request }) => {
// Without valid signature, webhook must reject
const fakeEvents = [
{ type: 'checkout.session.completed', data: { object: { id: 'cs_test_fake' } } },
{ type: 'customer.subscription.updated', data: { object: { id: 'sub_fake' } } },
];
for (const event of fakeEvents) {
const res = await request.post(`${API}/api/stripe/webhook`, {
data: event,
// Intentionally no stripe-signature header
});
// Without signature verification, attackers could fake tier upgrades
expect([400, 503], `Webhook accepted without signature: ${event.type}`
).toContain(res.status());
}
});
});
// ══════════════════════════════════════════════════════════════════════════════
@@ -686,18 +669,6 @@ test.describe('B6 — Onboarding Friction (vs Claude Code / OpenClaw / Hermes)',
// Claude Code setup: ~5 min. Hermes: ~30 min. Waggle: < 1 second.
expect(ms, `5-step onboarding took ${ms}ms — should be < 1000ms`).toBeLessThan(1000);
});
test('B6.7 — Tier is visible immediately (no hidden pricing)', async ({ request }) => {
// User must know immediately what tier they have and what it unlocks
// ChatGPT: pricing hidden behind Plus/Pro. Claude Code: no tiering UI.
const res = await request.get(`${API}/api/tier`);
expect(res.ok()).toBe(true);
const data = await res.json();
expect(data.tier).toBeDefined();
expect(data.capabilities).toBeDefined();
// User must be able to see what they can/cannot do
expect(typeof data.capabilities).toBe('object');
});
});
// ══════════════════════════════════════════════════════════════════════════════
@@ -1059,15 +1030,6 @@ test.describe('B10 — Composite Competitive Score', () => {
return (await r.json()).total >= 500;
},
},
{
capability: 'Tier-based billing system',
test: async () => {
const r = await request.get(`${API}/api/tier`);
if (!r.ok()) return false;
const d = await r.json();
return ['TRIAL', 'FREE', 'TEAMS', 'ENTERPRISE'].includes(d.tier);
},
},
{
capability: 'Automation hooks (deny rules)',
test: async () => {

View File

@@ -356,71 +356,20 @@ const PERSONAS: PersonaBundle[] = [
{
slug: 'team-admin-security-reviewer',
title: 'Persona 4: Team Admin / Security Reviewer',
accountMode: 'accountless local with mocked Teams-tier billing/admin state',
billingTier: 'Solo / FREE comparison lane plus mocked Teams billing and governance lane; real authenticated Teams server still deferred',
accountMode: 'accountless local; team mode is not part of the community edition',
billingTier: 'none (the community edition has no billing)',
uiDisclosureTier: 'admin',
modelState: 'not central unless Settings model copy is inspected',
dataState: 'billing, vault, backup, approvals, governance shell, and Teams-unlocked settings state',
offlineErrorState: 'backup failure, restore failure, checkout recovery, and approval-grant revocation sampled',
dataState: 'vault, backup, approvals and governance shell',
offlineErrorState: 'backup failure, restore failure and approval-grant revocation sampled',
viewport: { width: 1440, height: 900 },
nonMainGateDecisions: ['T13/T14/T15 evidenced or explicitly deferred for launch, desktop, and admin/utility paths.'],
routes: [
{ id: 'billing', path: '/settings?tab=billing', expected: /billing|plan|solo|team|checkout/i },
{ id: 'vault', path: '/settings/vault', expected: /vault|secret|encrypted|key/i },
{ id: 'team', path: '/team', expected: /team|governance|permission|member|upgrade/i },
{ id: 'approvals', path: '/approvals', expected: /approval|pending|risk|agent/i },
],
failureProbes: [
{
id: 'billing-checkout-unavailable',
path: '/settings?tab=billing',
action: 'none',
mocks: [
{ url: '**/api/tier', status: 200, body: { tier: 'FREE', capabilities: {}, usage: {} } },
{ url: '**/api/stripe/status', status: 200, body: { configured: false } },
],
expected: /Unavailable/i,
},
{
id: 'billing-team-active-state',
path: '/settings?tab=billing',
action: 'none',
mocks: [
{ url: '**/api/tier', status: 200, body: { tier: 'TEAMS', capabilities: {}, usage: {} } },
{ url: '**/api/stripe/status', status: 200, body: { configured: true } },
],
expected: /Waggle Team|\$49\/mo per seat|shared workspaces, WaggleDance, governance|Manage subscription/i,
},
{
id: 'team-settings-unlocked-state',
path: '/settings?tab=team',
action: 'none',
mocks: [
{ url: '**/api/tier', status: 200, body: { tier: 'TEAMS', capabilities: {}, usage: {} } },
{ url: '**/api/team/status', status: 200, body: { connected: false } },
],
expected: /Team Server|Team Server URL|Auth Token|Connecting to a team server/i,
},
{
id: 'billing-checkout-success-return',
path: '/payment-success?session_id=cs_bundle_team',
action: 'none',
mocks: [
{ url: '**/api/tier', status: 200, body: { tier: 'FREE', capabilities: {}, usage: {} } },
{ url: '**/api/stripe/sync', status: 200, body: { tier: 'TEAMS', customerId: 'cus_bundle' } },
],
expected: /Team|Manage billing|shared team memory/i,
},
{
id: 'billing-checkout-cancel-return',
path: '/payment-cancelled',
action: 'none',
mocks: [
{ url: '**/api/tier', status: 200, body: { tier: 'FREE', capabilities: {}, usage: {} } },
{ url: '**/api/stripe/status', status: 200, body: { configured: true } },
],
expected: /Checkout was cancelled|No charge was made/i,
},
{
id: 'backup-create-failure',
path: '/settings?tab=backup',

View File

@@ -173,11 +173,6 @@ test.describe('1. API Health', () => {
expect([200, 503]).toContain(res.status());
});
test('compliance API', async ({ request }) => {
const res = await request.get(`${BASE}/api/compliance/status`);
expect(res.ok()).toBeTruthy();
});
test('workspace templates API', async ({ request }) => {
const res = await request.get(`${BASE}/api/workspace-templates`);
expect(res.ok()).toBeTruthy();

View File

@@ -185,13 +185,6 @@ test.describe('Backend API Endpoints', () => {
expect([200, 403]).toContain(res.status());
});
test('GET /api/tier returns tier info', async ({ request }) => {
const res = await request.get(`${API}/api/tier`);
expect(res.ok()).toBeTruthy();
const data = await res.json();
expect(['TRIAL', 'FREE', 'TEAMS', 'ENTERPRISE']).toContain(data.tier);
});
test('GET /api/hooks returns rules array', async ({ request }) => {
const res = await request.get(`${API}/api/hooks`);
expect(res.ok()).toBeTruthy();

View File

@@ -25,15 +25,6 @@ async function skipOnboarding(page: Page) {
});
}
async function setTier(tier: string) {
const res = await fetch(`${API}/api/tier`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tier }),
});
return res.ok;
}
async function waitForApp(page: Page) {
await page.waitForSelector(
'.waggle-app-shell, .waggle-sidebar, [role="navigation"], [class*="onboarding"]',
@@ -74,70 +65,6 @@ test.describe('Phase 1 — Backend Fixes', () => {
});
});
// ── Phase 2: Tier Gating ──────────────────────────────────────────────────
test.describe('Phase 2 — Tier Gating', () => {
test('FREE: Mission Control shows lock overlay', async ({ page }) => {
await setTier('FREE');
await skipOnboarding(page);
await page.goto(`${API}`);
await waitForApp(page);
// Navigate to Mission Control
const mcButton = page.locator('button', { hasText: 'Mission Control' });
if (await mcButton.isVisible({ timeout: 5000 }).catch(() => false)) {
await mcButton.click();
// Should see lock overlay
const lockOverlay = page.locator('text=Upgrade to Teams');
await expect(lockOverlay).toBeVisible({ timeout: 5000 }).catch(() => {
// LockedFeature renders blurred content with upgrade card
});
}
});
test('FREE: sidebar shows lock icon on Mission Control', async ({ page }) => {
await setTier('FREE');
await skipOnboarding(page);
await page.goto(`${API}`);
await waitForApp(page);
// Check for lock icon near Mission Control
const mcNav = page.locator('button[title*="Mission Control"]');
if (await mcNav.isVisible({ timeout: 5000 }).catch(() => false)) {
const title = await mcNav.getAttribute('title');
expect(title).toContain('requires Teams');
}
});
test('FREE: /spawn not in command palette', async ({ page }) => {
await setTier('FREE');
await skipOnboarding(page);
await page.goto(`${API}`);
await waitForApp(page);
// Open command palette with Ctrl+K
await page.keyboard.press('Control+k');
await page.waitForTimeout(500);
// Check if /spawn is hidden
const spawnItem = page.locator('text=/spawn');
const isVisible = await spawnItem.isVisible({ timeout: 2000 }).catch(() => false);
// On FREE, /spawn should not be visible
if (isVisible) {
// If command palette didn't open or render differently, just log
test.info().annotations.push({ type: 'note', description: '/spawn visibility check — palette may not have opened' });
}
});
test('tier endpoint returns valid tier', async () => {
const res = await fetch(`${API}/api/tier`);
expect(res.ok).toBeTruthy();
const data = await res.json();
expect(['TRIAL', 'FREE', 'TEAMS', 'ENTERPRISE']).toContain(data.tier);
expect(data.capabilities).toBeDefined();
});
});
// ── Phase 3: UX Fixes ────────────────────────────────────────────────────
test.describe('Phase 3 — UX Fixes', () => {

View File

@@ -14,9 +14,7 @@ const ROUTES = [
'/settings',
'/settings?tab=models',
'/settings?tab=permissions',
'/settings?tab=team',
'/settings?tab=backup',
'/settings?tab=billing',
'/settings?tab=channels',
'/settings?tab=advanced',
'/settings/profile',

View File

@@ -329,97 +329,40 @@ test.describe('Act 3 — Persona Bonding & Identity', () => {
});
// ══════════════════════════════════════════════════════════════════════════════
// ACT 4 — THE TIER WALL (FOMO Engineering)
// FREE user hits a paid feature. Must feel like a door, not a wall.
// The upgrade path must be clear, immediate, and emotionally charged.
// ACT 4 — NO PAYWALL
// The community edition has no plans or tiers (ADR-0001). Everything a user
// can see must work without paying.
// ══════════════════════════════════════════════════════════════════════════════
test.describe('Act 4 — Tier Wall: FOMO & Upgrade Pressure', () => {
test('U4.1 — 403 response shows WHAT they are missing (not just "upgrade required")', async ({ request }) => {
// Hit a genuinely gated (TEAMS) endpoint as a non-Team user — personal
// features (personas, spawn, install) are all free (Solo) now, so the only
// real wall left is a Team feature.
const res = await request.post(`${API}/api/cloud-sync/toggle`, {
data: { enabled: true },
});
if (res.status() === 403) {
const data = await res.json();
// Must tell user what tier they need — not just "forbidden"
expect(data.required).toBeDefined();
expect(['TEAMS', 'ENTERPRISE']).toContain(data.required);
// Must give them a direct path to upgrade — no dead ends
expect(data.upgradeUrl).toBeDefined();
expect(data.upgradeUrl).toMatch(/https?:\/\//);
}
});
test('U4.2 — Upgrade URL leads to valid domain (not 404)', async ({ request }) => {
const res = await request.get(`${API}/api/costs`);
if (res.status() === 403) {
const data = await res.json();
if (data.upgradeUrl) {
// The URL must be reachable — broken upgrade URLs = lost revenue
expect(data.upgradeUrl).toMatch(/waggle-os\.ai|waggle\.ai/);
}
}
});
test('U4.3 — Tier ladder is coherent (FREE < TEAMS < ENTERPRISE)', async ({ request }) => {
const res = await request.get(`${API}/api/tier`);
expect(res.ok()).toBe(true);
const data = await res.json();
// Tier must be a known value — no typos in production
expect(['TRIAL', 'FREE', 'TEAMS', 'ENTERPRISE']).toContain(data.tier);
// Capabilities object must exist
expect(data.capabilities).toBeDefined();
});
test('U4.4 — FREE user can still do meaningful work (not a crippled demo)', async ({ request }) => {
// These must work on FREE — otherwise no one stays to upgrade
const freeEndpoints = [
test.describe('Act 4 — No paywall', () => {
test('U4.1 — core features work without a paid plan', async ({ request }) => {
const endpoints = [
`${API}/api/workspaces`,
`${API}/api/personas`,
`${API}/api/memory/frames?workspace=default&limit=5`,
`${API}/api/skills`,
`${API}/api/connectors`,
];
for (const url of freeEndpoints) {
for (const url of endpoints) {
const res = await request.get(url);
// Must be accessible on any tier — 429 under test load is acceptable
// 429 under test load is acceptable
expect(res.ok() || res.status() === 429, `${url} returned ${res.status()}`).toBe(true);
}
});
test('U4.5 — Stripe checkout session has a valid URL format', async ({ request }) => {
const res = await request.post(`${API}/api/stripe/create-checkout-session`, {
data: { tier: 'TEAMS', billingPeriod: 'monthly' },
});
if (res.status() === 200) {
const data = await res.json();
// Real Stripe URL — must be the actual checkout, not a stub
expect(data.url).toMatch(/https:\/\/checkout\.stripe\.com|https:\/\/billing\.stripe\.com/);
} else if (res.status() === 503) {
// OK — Stripe not configured in test env
const data = await res.json();
expect(data.error).toBe('STRIPE_NOT_CONFIGURED');
} else {
// 400 = tier config missing — also acceptable in test env
expect([400, 503]).toContain(res.status());
}
});
test('U4.6 — Cost dashboard teases value before the wall (FREE sees hint, not nothing)', async ({ request }) => {
test('U4.2 — cost tracking is open, not gated', async ({ request }) => {
const res = await request.get(`${API}/api/costs`);
if (res.status() === 403) {
const data = await res.json();
expect(data.error).toBe('TIER_INSUFFICIENT');
expect(data.required).toBe('TEAMS');
} else if (res.ok()) {
expect(res.status()).not.toBe(403);
if (res.ok()) {
const data = await res.json();
expect(data.today ?? data.allTime).toBeDefined();
}
});
test('U4.3 — there are no billing endpoints', async ({ request }) => {
expect((await request.get(`${API}/api/tier`)).status()).toBe(404);
expect((await request.post(`${API}/api/stripe/create-checkout-session`, { data: {} })).status()).toBe(404);
});
});
// ══════════════════════════════════════════════════════════════════════════════
@@ -1062,7 +1005,6 @@ test.describe('Act 10 — The Compulsion Loop: Full Value Cycle', () => {
// This is the "smoke test of smoke tests" — if any of these fail, the product is broken
const criticalPaths = [
{ url: `${API}/health`, name: 'System health' },
{ url: `${API}/api/tier`, name: 'Billing tier' },
{ url: `${API}/api/workspaces`, name: 'Workspaces' },
{ url: `${API}/api/personas`, name: 'Personas (17)' },
{ url: `${API}/api/skills`, name: 'Skills' },

View File

@@ -112,25 +112,6 @@ test.describe('User Journey Tests', () => {
await expect(createWorkspace).not.toBeVisible({ timeout: 5_000 });
});
test('J3c: tier interruption modal exposes a named close contract', async ({ page }) => {
await gotoApp(page);
await page.evaluate(() => {
window.dispatchEvent(new CustomEvent('waggle:tier-insufficient', {
detail: {
required: 'TEAMS',
actual: 'FREE',
message: 'Team workspaces require a Team plan.',
},
}));
});
const upgrade = page.getByRole('dialog', { name: /upgrade to unlock/i });
await expect(upgrade).toBeVisible({ timeout: 5_000 });
await upgrade.getByRole('button', { name: /close upgrade dialog/i }).click();
await expect(upgrade).not.toBeVisible({ timeout: 5_000 });
});
test('J3d: approvals revoke-all uses an in-app confirmation', async ({ page }) => {
const nativeDialogs: string[] = [];
let clearCalled = false;
@@ -621,7 +602,7 @@ test.describe('User Journey Tests', () => {
test('J-mobile: Settings is usable at 390px width', async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
const routes = ['/settings', '/settings?tab=models', '/settings?tab=billing', '/settings/profile'];
const routes = ['/settings', '/settings?tab=models', '/settings?tab=backup', '/settings/profile'];
for (const route of routes) {
await gotoApp(page, route);
if (route !== '/settings/profile') {
@@ -906,10 +887,11 @@ test.describe('User Journey Tests', () => {
await gotoApp(page, '/platform');
await expect(page.locator('body')).toContainText(/platform|local|governance|memory|agent/i);
await page.goto(routeWithSkip('/payment-cancelled'), { waitUntil: 'domcontentloaded' });
await page.waitForURL(/\/settings\?tab=billing/, { timeout: 10_000 });
await waitForShell(page);
await expect(page.locator('body')).toContainText(/billing|plan|team|solo|checkout/i);
// Payment pages are gone in the community edition (ADR-0001).
for (const route of ['/payment-cancelled', '/payment-success']) {
await gotoApp(page, route);
await expect(page.locator('body')).toContainText(/page you.re after doesn.t exist/i);
}
});
test('J-route-coverage: priority thin routes render meaningful shells', async ({ page }) => {
@@ -920,10 +902,9 @@ test.describe('User Journey Tests', () => {
['/artifacts', /artifact|library|document|presentation/i],
['/settings/profile', /who are you|identity|writing style|save/i],
['/settings/timeline', /timeline|workspace|activity/i],
['/payment-success', /checkout|paid|plans|nothing to confirm/i],
['/automations', /automation|schedule|trigger|history|logs/i],
['/mcps', /mcp hub|installed|catalog|custom/i],
['/settings/usage', /usage|cost|tokens|budget|upgrade/i],
['/settings/usage', /usage|cost|tokens|budget/i],
['/files', /storage|files|workspace|local/i],
];

View File

@@ -113,13 +113,9 @@ test.describe('1. Core API Health', () => {
expect(Array.isArray(data)).toBe(true);
});
test('1.3 GET /api/tier returns tier info with teamsServerAvailable', async ({ request }) => {
test('1.3 the community edition has no tier endpoint', async ({ request }) => {
const res = await request.get(`${API}/api/tier`);
expect(res.ok()).toBe(true);
const data = await res.json();
expect(data.tier).toBeDefined();
expect(['TRIAL','FREE','TEAMS','ENTERPRISE']).toContain(data.tier);
expect(typeof data.teamsServerAvailable).toBe('boolean');
expect(res.status()).toBe(404);
});
test('1.4 GET /api/connectors returns connectors with new metadata fields', async ({ request }) => {
@@ -254,59 +250,20 @@ test.describe('2. Tier Enforcement (requireTier middleware)', () => {
});
// ══════════════════════════════════════════════════════════════════════════
// SECTION 3 — Stripe Integration
// SECTION 3 — No billing (community edition, ADR-0001)
// ══════════════════════════════════════════════════════════════════════════
test.describe('3. Stripe Integration', () => {
test('3.1 POST /api/stripe/create-checkout-session — TEAMS tier returns URL or 503', async ({ request }) => {
const res = await request.post(`${API}/api/stripe/create-checkout-session`, {
data: { tier: 'TEAMS', billingPeriod: 'monthly' },
});
// 200 = Stripe configured, returns checkout URL
// 503 = STRIPE_NOT_CONFIGURED (env not set)
// 400 = NO_PRICE_CONFIGURED (price env not set)
expect([200, 400, 503]).toContain(res.status());
if (res.status() === 200) {
const data = await res.json();
expect(data.url).toMatch(/stripe\.com|checkout/);
test.describe('3. No billing', () => {
test('3.1 Stripe and trial endpoints are gone', async ({ request }) => {
for (const url of [
'/api/stripe/create-checkout-session',
'/api/stripe/create-portal-session',
'/api/stripe/webhook',
'/api/tier/start-trial',
]) {
const res = await request.post(`${API}${url}`, { data: {} });
expect(res.status(), url).toBe(404);
}
if (res.status() === 503) {
const data = await res.json();
expect(data.error).toBe('STRIPE_NOT_CONFIGURED');
}
});
test('3.2 POST /api/stripe/create-checkout-session — FREE tier is invalid', async ({ request }) => {
const res = await request.post(`${API}/api/stripe/create-checkout-session`, {
data: { tier: 'FREE' },
});
expect([400, 503]).toContain(res.status());
if (res.status() === 400) {
const data = await res.json();
expect(data.error).toMatch(/INVALID_TIER|NO_PRICE/);
}
});
test('3.3 POST /api/stripe/webhook — invalid signature returns 400', async ({ request }) => {
const res = await request.post(`${API}/api/stripe/webhook`, {
data: { type: 'checkout.session.completed' },
headers: { 'stripe-signature': 'invalid_sig' },
});
// 400 = invalid signature (expected when Stripe is configured)
// 503 = Stripe not configured
expect([400, 503]).toContain(res.status());
});
test('3.4 POST /api/stripe/create-portal-session is ungated (any authed user)', async ({ request }) => {
const res = await request.post(`${API}/api/stripe/create-portal-session`, {
data: {},
});
// Ungated (requireTier('FREE') no-op floor) so a legacy sub can self-cancel:
// without a Stripe customer → 400 NO_STRIPE_CUSTOMER
// with a Stripe customer → 200
// Stripe not configured → 503
// A tier 403 must never fire here.
expect([200, 400, 503]).toContain(res.status());
});
});
@@ -669,7 +626,8 @@ test.describe('10. Admin & Cloud Sync', () => {
const data = await res.json();
expect(typeof data.available).toBe('boolean');
expect(typeof data.enabled).toBe('boolean');
expect(data.tier).toBeDefined();
// Cloud sync needs the team server, which this edition does not ship.
expect(data.available).toBe(false);
});
test('10.3 POST /api/cloud-sync/toggle requires TEAMS tier', async ({ request }) => {
@@ -1091,12 +1049,11 @@ test.describe('15. Security', () => {
expect(res.status()).toBe(404);
});
test('15.6 Stripe webhook rejects requests without signature', async ({ request }) => {
test('15.6 there is no Stripe webhook to forge', async ({ request }) => {
const res = await request.post(`${API}/api/stripe/webhook`, {
data: { type: 'checkout.session.completed', data: { object: {} } },
});
// No stripe-signature header → should reject
expect([400, 503]).toContain(res.status());
expect(res.status()).toBe(404);
});
test('15.7 Admin audit export path traversal blocked', async ({ request }) => {