dev1/tests/e2e/37-resume-optimizer-guard.spec.mjs

22 lines
863 B
JavaScript

// @ts-check
import { test, expect } from '@playwright/test';
import { loadTestUser } from '../utils/testUser.js';
test.describe('@p0 Resume Optimizer — paywall guard', () => {
test.setTimeout(20000);
test('non-premium user redirected to /paywall', async ({ page }) => {
const u = loadTestUser();
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 });
await page.goto('/resume-optimizer', { waitUntil: 'networkidle' });
await expect(page).toHaveURL(/\/paywall(\?|$)/, { timeout: 8000 });
});
});