fix(e2e): align browser harness with local stack

This commit is contained in:
jjbrunton committed 2026-08-30 21:00:12 +01:00
1 parent db5980c9bd
commit cf19d23d8a
20 files changed
+267 -85

No files matched your search

+5 -13
View File
@@ -1,7 +1,8 @@
import { expect, test } from '@playwright/test';
import { createRedemptionFixture } from '../helpers/local-supabase';
import { createRedemptionFixture } from '../helpers/local-postgres';
const web = process.env.WEB_URL ?? 'http://127.0.0.1:3000';
const web = process.env.WEB_URL;
if (!web) throw new Error('Run E2E through npm run verify:e2e');
test('marketing home renders the primary product journey', async ({ page }) => {
await page.goto(web);
@@ -27,17 +28,8 @@ test('redemption updates server state and visible product state', async ({ page
await expect(page.getByRole('heading', { name: 'Code Redeemed!' })).toBeVisible();
await expect(page.getByText(fixture.email)).toBeVisible();
const { data: profile, error: profileError } = await fixture.client
.from('profiles').select('is_premium').eq('id', fixture.userId).single();
expect(profileError).toBeNull();
expect(profile?.is_premium).toBe(true);
const { count, error: redemptionError } = await fixture.client
.from('code_redemptions').select('*', { count: 'exact', head: true })
.eq('code_id', fixture.codeId).eq('user_id', fixture.userId);
expect(redemptionError).toBeNull();
expect(count).toBe(1);
await expect(fixture.assertRedeemed()).resolves.toBeUndefined();
} finally {
await fixture.client.auth.admin.deleteUser(fixture.userId);
await fixture.client.from('redemption_codes').delete().eq('id', fixture.codeId);
await fixture.cleanup();
}
});