Files
carmanagement/apps/homepage/tests/browser/navigation.spec.ts
T
root 781512399b
Build & Deploy / Build & Push Docker Image (push) Successful in 2m51s
Test / Type Check (all packages) (push) Successful in 52s
Build & Deploy / Deploy to VPS (push) Successful in 4s
Test / API Unit Tests (push) Successful in 49s
Test / Homepage Unit Tests (push) Successful in 44s
Test / Storefront Unit Tests (push) Successful in 39s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 40s
Test / API Integration Tests (push) Successful in 1m0s
Update homepage routes to include language and mode
2026-07-02 14:10:17 -04:00

59 lines
2.2 KiB
TypeScript

import { expect, test } from '@playwright/test';
test.use({ viewport: { width: 390, height: 844 } });
test('mobile navigation opens modally, closes with Escape, and returns focus', async ({ page }) => {
await page.goto('/en/system');
const trigger = page.getByRole('button', { name: 'Open navigation menu' });
await trigger.focus();
await trigger.click();
const dialog = page.getByRole('dialog', { name: 'Primary navigation' });
await expect(dialog).toBeVisible();
await expect(page.locator('body')).toHaveAttribute('data-navigation-open', 'true');
await expect(page.getByRole('button', { name: 'Close navigation menu' })).toBeFocused();
await page.keyboard.press('Escape');
await expect(dialog).not.toBeVisible();
await expect(trigger).toBeFocused();
});
test('skip navigation moves focus to the main landmark', async ({ page }) => {
await page.goto('/en/system');
await page.keyboard.press('Tab');
const skip = page.getByRole('link', { name: 'Skip to main content' });
await expect(skip).toBeFocused();
await skip.press('Enter');
await expect(page.locator('#main-content')).toBeFocused();
});
test.describe('primary navigation visibility', () => {
test.use({ viewport: { width: 1024, height: 768 } });
test('keeps the complete navbar visible at common laptop widths', async ({ page }) => {
await page.goto('/en/system');
const navigation = page.getByRole('navigation', { name: 'Primary navigation' }).first();
await expect(navigation).toBeVisible();
for (const label of ['Product', 'Workflow', 'Modules', 'Pricing', 'FAQ']) {
await expect(navigation.getByRole('link', { name: label, exact: true })).toBeVisible();
}
});
});
test.describe('mobile primary navigation destinations', () => {
test.use({ viewport: { width: 390, height: 844 } });
test('keeps every navbar destination in the mobile drawer', async ({ page }) => {
await page.goto('/en/system');
await page.getByRole('button', { name: 'Open navigation menu' }).click();
const dialog = page.getByRole('dialog', { name: 'Primary navigation' });
for (const label of ['Product', 'Workflow', 'Modules', 'Pricing', 'FAQ']) {
await expect(dialog.getByRole('link', { name: label, exact: true })).toBeVisible();
}
});
});