Stabilize U

This commit is contained in:
master
2026-02-16 07:33:20 +02:00
parent 45c0f1bb59
commit 70fdbfcf25
166 changed files with 20156 additions and 4833 deletions

View File

@@ -0,0 +1,46 @@
import { Page, expect } from '@playwright/test';
export async function navigateAndWait(
page: Page,
route: string,
options?: { timeout?: number }
) {
const timeout = options?.timeout ?? 15_000;
await page.goto(route, { waitUntil: 'networkidle', timeout });
await page.waitForLoadState('domcontentloaded');
// Allow Angular change detection to settle
await page.waitForTimeout(500);
}
export async function assertNoAngularErrors(page: Page) {
const errors: string[] = [];
page.on('console', (msg) => {
if (msg.type() === 'error' && msg.text().includes('NG0')) {
errors.push(msg.text());
}
});
await page.waitForTimeout(1000);
expect(errors, `Angular errors found: ${errors.join(', ')}`).toHaveLength(0);
}
export async function assertPageHasContent(page: Page) {
const bodyText = await page.locator('body').innerText();
expect(
bodyText.trim().length,
'Page should have visible text content'
).toBeGreaterThan(10);
}
export async function getPageHeading(
page: Page
): Promise<string | null> {
const h1 = page.locator('h1').first();
if (await h1.isVisible({ timeout: 3000 }).catch(() => false)) {
return h1.innerText();
}
const h2 = page.locator('h2').first();
if (await h2.isVisible({ timeout: 2000 }).catch(() => false)) {
return h2.innerText();
}
return null;
}