// @ts-check import { test, expect } from '@playwright/test'; import { loadTestUser } from '../utils/testUser.js'; test.describe('@premium Premium routes unlock', () => { test.setTimeout(40000); test('with premium status, /enhancing /retirement /career-roadmap are accessible', async ({ page }) => { const u = loadTestUser(); // Force premium status await page.route('**/api/premium/subscription/status', async route => { await route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ is_premium: 1, is_pro_premium: 0 }) }); }); // Sign in await page.context().clearCookies(); await page.goto('/signin', { waitUntil: 'networkidle' }); await page.getByPlaceholder('Username', { exact: true }).fill(u.username); await page.getByPlaceholder('Password', { exact: true }).fill(u.password); await page.getByRole('button', { name: /^Sign In$/ }).click(); await page.waitForURL('**/signin-landing**', { timeout: 15000 }); // Enhancing await page.goto('/enhancing', { waitUntil: 'networkidle' }); await expect(page).not.toHaveURL(/\/paywall/i); // Retirement await page.goto('/retirement', { waitUntil: 'networkidle' }); await expect(page).not.toHaveURL(/\/paywall/i); // Career roadmap (no id param → page shell) await page.goto('/career-roadmap', { waitUntil: 'networkidle' }); await expect(page).not.toHaveURL(/\/paywall/i); }); });