// @ts-check import { test, expect } from '@playwright/test'; import { loadTestUser } from '../utils/testUser.js'; test.describe('@p1 CareerRoadmap — panels + Coach basics', () => { test.setTimeout(60000); test('open roadmap for a known scenario; coach replies', async ({ page }) => { const u = loadTestUser(); 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 }) }); }); 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 }); const scen = await page.request.post('/api/premium/career-profile', { data: { career_name: 'QA Roadmap', status: 'planned', start_date: '2025-09-01' } }); const { career_profile_id } = await scen.json(); await page.goto(`/career-roadmap/${career_profile_id}`, { waitUntil: 'networkidle' }); await expect(page.getByText(/Where you are now and where you are going/i)).toBeVisible({ timeout: 20000 }); await expect(page.getByRole('heading', { name: 'Career Coach' })).toBeVisible(); await page.getByPlaceholder('Ask your Career Coach…').fill('Give me one tip.'); await page.getByRole('button', { name: /^Send$/ }).click(); await expect(page.getByText(/Coach is typing…/i)).toBeVisible(); await expect(page.getByText(/Coach is typing…/i)).toHaveCount(0, { timeout: 25000 }); }); });