import { expect, type Page } from '@playwright/test'; export const primaryNavigationLabels = [ 'Product', 'Solutions', 'Security & Trust', 'Integrations', 'Contact', ] as const; export const footerLabels = ['Legal', 'Privacy', 'Terms', 'Contact / Demo'] as const; export async function visitPage(page: Page, path: string): Promise { await page.goto(path); await expect(page).toHaveURL(new RegExp(path === '/' ? '/?$' : `${path}$`)); } export async function expectShell(page: Page, heading: string | RegExp): Promise { await expect(page.getByRole('banner')).toBeVisible(); await expect(page.getByRole('main')).toBeVisible(); await expect(page.getByRole('contentinfo')).toBeVisible(); await expect(page.getByRole('heading', { level: 1, name: heading })).toBeVisible(); } export async function expectPrimaryNavigation(page: Page): Promise { const header = page.getByRole('banner'); for (const label of primaryNavigationLabels) { await expect(header.getByRole('link', { name: label })).toBeVisible(); } } export async function expectFooterLinks(page: Page): Promise { for (const label of footerLabels) { await expect(page.getByRole('contentinfo').getByRole('link', { name: label })).toBeVisible(); } } export async function openMobileNavigation(page: Page): Promise { const menuTrigger = page.getByLabel('Open navigation menu'); if (await menuTrigger.isVisible()) { await menuTrigger.click(); } }