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

@@ -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 }) => {