TenantAtlas/apps/website/tests/smoke/smoke-helpers.ts
ahmido f884b16061
Some checks failed
Main Confidence / confidence (push) Failing after 40s
feat: implement website visual foundation (#251)
## Summary
- implement the website-only visual foundation for apps/website
- formalize semantic tokens, typography, spacing, surfaces, and shared CTA/navigation primitives
- align landing, trust/legal, and content-heavy routes plus Playwright smoke coverage with the new foundation

## Validation
- corepack pnpm build:website
- corepack pnpm --filter @tenantatlas/website exec playwright test

## Scope
- website-only change set for spec 214
- no apps/platform runtime coupling introduced

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #251
2026-04-19 07:19:58 +00:00

77 lines
2.7 KiB
TypeScript

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<void> {
await page.goto(path);
await expect(page).toHaveURL(new RegExp(path === '/' ? '/?$' : `${path}$`));
}
export async function expectShell(page: Page, heading: string | RegExp): Promise<void> {
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 expectPageFamily(page: Page, family: 'content' | 'landing' | 'trust'): Promise<void> {
await expect(page.locator(`[data-page-family="${family}"]`).first()).toBeVisible();
}
export async function expectPrimaryNavigation(page: Page): Promise<void> {
const header = page.getByRole('banner');
for (const label of primaryNavigationLabels) {
const link = header.getByRole('link', { name: label }).first();
await expect(link).toBeVisible();
await expect(link).toHaveAttribute('data-nav-link');
}
}
export async function expectFooterLinks(page: Page): Promise<void> {
for (const label of footerLabels) {
await expect(page.getByRole('contentinfo').getByRole('link', { name: label })).toBeVisible();
}
}
export async function openMobileNavigation(page: Page): Promise<void> {
const menuTrigger = page.getByLabel('Open navigation menu');
if (await menuTrigger.isVisible()) {
await menuTrigger.click();
}
}
export async function expectDisclosureLayer(page: Page, layer: '1' | '2' | '3'): Promise<void> {
await expect(page.locator(`[data-disclosure-layer="${layer}"]`).first()).toBeVisible();
}
export async function expectCtaHierarchy(
page: Page,
primaryLabel: string | RegExp,
secondaryLabel: string | RegExp,
): Promise<void> {
const main = page.getByRole('main');
await expect(main.locator('[data-cta-weight="primary"]').filter({ hasText: primaryLabel }).first()).toBeVisible();
await expect(
main.locator('[data-cta-weight="secondary"]').filter({ hasText: secondaryLabel }).first(),
).toBeVisible();
}
export async function expectNavigationVsCtaDifferentiation(page: Page): Promise<void> {
const header = page.getByRole('banner');
await expect(header.locator('[data-nav-link]').first()).toBeVisible();
await expect(header.locator('[data-cta-weight="secondary"]').first()).toBeVisible();
}