39 lines
1.6 KiB
JavaScript
39 lines
1.6 KiB
JavaScript
// tests/e2e/02-signin-landing.spec.mjs
|
|
// @ts-check
|
|
import { test, expect } from '@playwright/test';
|
|
import { loadTestUser } from '../utils/testUser.js';
|
|
|
|
test.describe('@p0 SignIn → Landing', () => {
|
|
test.setTimeout(10000);
|
|
|
|
test('signs in with persisted user and reaches SignInLanding', async ({ page }) => {
|
|
const user = loadTestUser();
|
|
|
|
await page.context().clearCookies();
|
|
await page.goto('/signin', { waitUntil: 'networkidle' });
|
|
|
|
await expect(page.getByRole('heading', { name: /Sign In/i })).toBeVisible();
|
|
|
|
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$/ }).click();
|
|
|
|
await page.waitForURL('**/signin-landing**', { timeout: 15000 });
|
|
await expect(
|
|
page.getByRole('heading', { name: new RegExp(`Welcome to AptivaAI\\s+${user.firstname}!`) })
|
|
).toBeVisible();
|
|
|
|
await expect(page.getByRole('link', { name: /Go to Exploring/i })).toBeVisible();
|
|
await expect(page.getByRole('link', { name: /Go to Preparing/i })).toBeVisible();
|
|
await expect(page.getByRole('link', { name: /Go to Enhancing/i })).toBeVisible();
|
|
await expect(page.getByRole('link', { name: /Go to Retirement/i })).toBeVisible();
|
|
|
|
const cookies = await page.context().cookies();
|
|
expect(cookies.some(c => /jwt|session/i.test(c.name))).toBeTruthy();
|
|
|
|
const consoleErrors = [];
|
|
page.on('console', m => { if (m.type() === 'error') consoleErrors.push(m.text()); });
|
|
expect(consoleErrors).toEqual([]);
|
|
});
|
|
});
|