33 lines
1.4 KiB
JavaScript
33 lines
1.4 KiB
JavaScript
// @ts-check
|
|
import { test, expect } from '@playwright/test';
|
|
import { loadTestUser } from '../utils/testUser.js';
|
|
|
|
test.describe('@p0 Chat drawer — Retirement tab gating (non-retire pages)', () => {
|
|
test.setTimeout(20000);
|
|
|
|
test('Retirement tab is not shown on non-retirement pages', async ({ page }) => {
|
|
const user = loadTestUser();
|
|
|
|
// Sign in and go to a non-retirement page (e.g., Career Explorer)
|
|
await page.context().clearCookies();
|
|
await page.goto('/signin', { waitUntil: 'networkidle' });
|
|
await page.getByPlaceholder('Username', { exact: true }).fill(user.username);
|
|
await page.getByPlaceholder('Password', { exact: true }).fill(user.password);
|
|
await page.getByRole('button', { name: /^Sign In$/i }).click();
|
|
await page.waitForURL('**/signin-landing**', { timeout: 15000 });
|
|
|
|
await page.goto('/career-explorer', { waitUntil: 'networkidle' });
|
|
|
|
// Open chat
|
|
const fab = page.getByRole('button', { name: /^Open chat$/i });
|
|
await fab.click();
|
|
|
|
// Support tab present…
|
|
await expect(page.getByRole('button', { name: /^Aptiva\s*Support$/i })).toBeVisible({ timeout: 5000 });
|
|
|
|
// …but Retirement tab should NOT be rendered on non-retirement pages
|
|
const retireTab = page.getByRole('button', { name: /^Retirement\s*Helper$/i });
|
|
expect(await retireTab.isVisible().catch(() => false)).toBeFalsy();
|
|
});
|
|
});
|