import { test, expect } from '@playwright/test'; import { loadTestUser } from '../utils/testUser.js'; test.describe('@p0 Career Explorer — Reload Suggestions', () => { test.setTimeout(40000); test('clears cache → Reload → cache & tiles repopulated (submit_answers fired)', async ({ page }) => { const user = loadTestUser(); const TIME = { overlayAppear: 2000, // overlay should mount quickly cache: 30000, // allow cold path to populate cache tile: 8000, // find a tile soon after cache }; // Track server calls (prove reload hits submit_answers) let sawSubmitAnswers = false; page.on('response', (r) => { if (r.request().method() === 'POST' && r.url().includes('/api/onet/submit_answers')) { sawSubmitAnswers = true; } }); // Helper: close any blocking overlay (priorities/meaning) by saving neutral defaults. async function closeAnyOverlay() { const overlay = page.locator('div.fixed.inset-0'); if (!(await overlay.isVisible({ timeout: 500 }).catch(() => false))) return; const dialog = overlay.locator('div[role="dialog"], div.bg-white').first(); // Select first non-empty option in each