// @ts-check import { test, expect } from '@playwright/test'; import { loadTestUser } from '../utils/testUser.js'; test.describe('@p0 Profile menu gating (non-premium)', () => { test.setTimeout(15000); test('Career/College Profiles show disabled labels when user is not premium', 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 }); // Hover Profile dropdown const profileBtn = page.getByRole('button', { name: /^Profile$/i }); await profileBtn.hover(); // Disabled labels (spans) visible await expect(page.getByText(/^Career Profiles \(Premium\)$/i)).toBeVisible(); await expect(page.getByText(/^College Profiles \(Premium\)$/i)).toBeVisible(); // And they are NOT links const careerLink = page.getByRole('link', { name: /^Career Profiles$/i }).first(); const collegeLink = page.getByRole('link', { name: /^College Profiles$/i }).first(); expect(await careerLink.isVisible().catch(() => false)).toBeFalsy(); expect(await collegeLink.isVisible().catch(() => false)).toBeFalsy(); // "Account" link still works await page.getByRole('link', { name: /^Account$/i }).click(); await expect(page).toHaveURL(/\/profile(\?|$)/, { timeout: 8000 }); }); });