test(e2e): update all E2E specs for latest API and fixtures
Update 17 E2E test files including admin, auth, inquiries, listings, payments, search, subscriptions, and MCP specs. Update listings fixture and global setup to align with latest schema changes. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -10,7 +10,7 @@ test.describe('Subscriptions API', () => {
|
||||
|
||||
test.describe('GET /subscriptions/plans — List plans', () => {
|
||||
test('returns all available subscription plans', async ({ request }) => {
|
||||
const res = await request.get('/subscriptions/plans');
|
||||
const res = await request.get('subscriptions/plans');
|
||||
|
||||
expect(res.status()).toBe(200);
|
||||
const body = await res.json();
|
||||
@@ -25,7 +25,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('includes FREE tier in plans', async ({ request }) => {
|
||||
const res = await request.get('/subscriptions/plans');
|
||||
const res = await request.get('subscriptions/plans');
|
||||
const body = await res.json();
|
||||
|
||||
const freePlan = body.find((p: { tier: string }) => p.tier === 'FREE');
|
||||
@@ -35,7 +35,7 @@ test.describe('Subscriptions API', () => {
|
||||
|
||||
test.describe('GET /subscriptions/plans/:tier — Get specific plan', () => {
|
||||
test('returns plan details for FREE tier', async ({ request }) => {
|
||||
const res = await request.get('/subscriptions/plans/FREE');
|
||||
const res = await request.get('subscriptions/plans/FREE');
|
||||
|
||||
expect(res.status()).toBe(200);
|
||||
const body = await res.json();
|
||||
@@ -45,7 +45,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('returns plan details for AGENT_PRO tier', async ({ request }) => {
|
||||
const res = await request.get('/subscriptions/plans/AGENT_PRO');
|
||||
const res = await request.get('subscriptions/plans/AGENT_PRO');
|
||||
|
||||
expect(res.status()).toBe(200);
|
||||
const body = await res.json();
|
||||
@@ -53,7 +53,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('returns 404 for non-existent tier', async ({ request }) => {
|
||||
const res = await request.get('/subscriptions/plans/NONEXISTENT');
|
||||
const res = await request.get('subscriptions/plans/NONEXISTENT');
|
||||
|
||||
expect(res.ok()).toBeFalsy();
|
||||
expect([404, 400]).toContain(res.status());
|
||||
@@ -62,7 +62,7 @@ test.describe('Subscriptions API', () => {
|
||||
|
||||
test.describe('POST /subscriptions — Create subscription', () => {
|
||||
test('creates a FREE subscription', async ({ request }) => {
|
||||
const res = await request.post('/subscriptions', {
|
||||
const res = await request.post('subscriptions', {
|
||||
data: { planTier: 'FREE', billingCycle: 'monthly' },
|
||||
headers: { Authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
@@ -77,7 +77,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('rejects subscription with invalid plan tier', async ({ request }) => {
|
||||
const res = await request.post('/subscriptions', {
|
||||
const res = await request.post('subscriptions', {
|
||||
data: { planTier: 'INVALID_TIER', billingCycle: 'monthly' },
|
||||
headers: { Authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
@@ -87,7 +87,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('rejects subscription with invalid billing cycle', async ({ request }) => {
|
||||
const res = await request.post('/subscriptions', {
|
||||
const res = await request.post('subscriptions', {
|
||||
data: { planTier: 'FREE', billingCycle: 'weekly' },
|
||||
headers: { Authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
@@ -97,7 +97,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('rejects unauthenticated subscription creation', async ({ request }) => {
|
||||
const res = await request.post('/subscriptions', {
|
||||
const res = await request.post('subscriptions', {
|
||||
data: { planTier: 'FREE', billingCycle: 'monthly' },
|
||||
});
|
||||
|
||||
@@ -108,12 +108,12 @@ test.describe('Subscriptions API', () => {
|
||||
test.describe('GET /subscriptions/quota/:metric — Check quota', () => {
|
||||
test('returns quota for listings metric', async ({ request }) => {
|
||||
// Ensure user has a subscription first
|
||||
await request.post('/subscriptions', {
|
||||
await request.post('subscriptions', {
|
||||
data: { planTier: 'FREE', billingCycle: 'monthly' },
|
||||
headers: { Authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
|
||||
const res = await request.get('/subscriptions/quota/listings', {
|
||||
const res = await request.get('subscriptions/quota/listings', {
|
||||
headers: { Authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
|
||||
@@ -127,7 +127,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('rejects unauthenticated quota check', async ({ request }) => {
|
||||
const res = await request.get('/subscriptions/quota/listings');
|
||||
const res = await request.get('subscriptions/quota/listings');
|
||||
|
||||
expect(res.status()).toBe(401);
|
||||
});
|
||||
@@ -135,7 +135,7 @@ test.describe('Subscriptions API', () => {
|
||||
|
||||
test.describe('POST /subscriptions/usage — Meter usage', () => {
|
||||
test('meters usage for authenticated user', async ({ request }) => {
|
||||
const res = await request.post('/subscriptions/usage', {
|
||||
const res = await request.post('subscriptions/usage', {
|
||||
data: { metric: 'listings', count: 1 },
|
||||
headers: { Authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
@@ -145,7 +145,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('rejects usage with invalid count', async ({ request }) => {
|
||||
const res = await request.post('/subscriptions/usage', {
|
||||
const res = await request.post('subscriptions/usage', {
|
||||
data: { metric: 'listings', count: -1 },
|
||||
headers: { Authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
@@ -157,7 +157,7 @@ test.describe('Subscriptions API', () => {
|
||||
|
||||
test.describe('GET /subscriptions/billing — Billing history', () => {
|
||||
test('returns billing history for authenticated user', async ({ request }) => {
|
||||
const res = await request.get('/subscriptions/billing', {
|
||||
const res = await request.get('subscriptions/billing', {
|
||||
headers: { Authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
|
||||
@@ -169,7 +169,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('supports pagination', async ({ request }) => {
|
||||
const res = await request.get('/subscriptions/billing', {
|
||||
const res = await request.get('subscriptions/billing', {
|
||||
params: { limit: 5, offset: 0 },
|
||||
headers: { Authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
@@ -178,7 +178,7 @@ test.describe('Subscriptions API', () => {
|
||||
});
|
||||
|
||||
test('rejects unauthenticated billing request', async ({ request }) => {
|
||||
const res = await request.get('/subscriptions/billing');
|
||||
const res = await request.get('subscriptions/billing');
|
||||
|
||||
expect(res.status()).toBe(401);
|
||||
});
|
||||
@@ -186,7 +186,7 @@ test.describe('Subscriptions API', () => {
|
||||
|
||||
test.describe('PUT /subscriptions/upgrade — Upgrade subscription', () => {
|
||||
test('rejects unauthenticated upgrade', async ({ request }) => {
|
||||
const res = await request.put('/subscriptions/upgrade', {
|
||||
const res = await request.put('subscriptions/upgrade', {
|
||||
data: { newPlanTier: 'AGENT_PRO' },
|
||||
});
|
||||
|
||||
@@ -196,7 +196,7 @@ test.describe('Subscriptions API', () => {
|
||||
|
||||
test.describe('DELETE /subscriptions — Cancel subscription', () => {
|
||||
test('rejects unauthenticated cancellation', async ({ request }) => {
|
||||
const res = await request.delete('/subscriptions');
|
||||
const res = await request.delete('subscriptions');
|
||||
|
||||
expect(res.status()).toBe(401);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user