nicht nutzbarer stand, header menü ist nicht intertia initialisiert. aber schick. codex änderungen noch enthalten.

This commit is contained in:
Codex Agent
2025-10-06 13:46:29 +02:00
parent d70faf7a9d
commit 5ee510b05d
29 changed files with 493 additions and 784 deletions

View File

@@ -0,0 +1,73 @@
import { test, expect } from '@playwright/test';
test('Test all links on homepage', async ({ page }) => {
const errors: string[] = [];
const consoleMessages: { type: string; text: string }[] = [];
page.on('console', msg => {
consoleMessages.push({ type: msg.type(), text: msg.text() });
if (msg.type() === 'error') {
console.log('Console Error:', msg.text());
}
});
page.on('pageerror', error => {
console.log('Page Error:', error.message);
errors.push(error.message);
});
await page.goto('http://localhost:8000/');
// Wait for page to load
await page.waitForLoadState('networkidle');
// Get all links
const links = await page.locator('a[href]').all();
console.log(`Found ${links.length} links`);
for (let i = 0; i < links.length; i++) {
const link = links[i];
const text = await link.textContent();
const href = await link.getAttribute('href');
console.log(`Clicking link ${i + 1}: "${text?.trim() || 'No text'}" -> ${href}`);
try {
// Clear previous errors
const currentErrors = [...errors];
errors.length = 0;
await link.click({ force: true });
// Wait a bit for navigation or error
await page.waitForTimeout(1000);
// Check for new errors
const newErrors = errors.filter(e => !currentErrors.includes(e));
if (newErrors.length > 0) {
console.log(`Error on link "${text?.trim() || 'No text'}":`, newErrors);
expect(newErrors).toHaveLength(0);
}
// Check console for errors after click
const recentConsole = consoleMessages.filter(msg => msg.text.includes('TypeError') || msg.text.includes('href') || msg.type === 'error');
if (recentConsole.length > 0) {
console.log(`Console error on link "${text?.trim() || 'No text'}":`, recentConsole);
expect(recentConsole).toHaveLength(0);
}
// If navigated, go back
if (page.url() !== 'http://localhost:8000/') {
await page.goBack();
await page.waitForLoadState('networkidle');
}
} catch (error: unknown) {
console.log(`Error clicking link "${text?.trim() || 'No text'}":`, (error as Error).message);
expect(error).toBeUndefined();
}
}
expect(errors).toHaveLength(0);
});

73
tests/link-test.spec.ts Normal file
View File

@@ -0,0 +1,73 @@
import { test, expect } from '@playwright/test';
test('Test all links on homepage', async ({ page }) => {
const errors = [];
const consoleMessages = [];
page.on('console', msg => {
consoleMessages.push({ type: msg.type(), text: msg.text() });
if (msg.type() === 'error') {
console.log('Console Error:', msg.text());
}
});
page.on('pageerror', error => {
console.log('Page Error:', error.message);
errors.push(error.message);
});
await page.goto('http://localhost:8000/');
// Wait for page to load
await page.waitForLoadState('networkidle');
// Get all links
const links = await page.locator('a[href]').all();
console.log(`Found ${links.length} links`);
for (let i = 0; i < links.length; i++) {
const link = links[i];
const text = await link.textContent();
const href = await link.getAttribute('href');
console.log(`Clicking link ${i + 1}: "${text?.trim() || 'No text'}" -> ${href}`);
try {
// Clear previous errors
const currentErrors = [...errors];
errors.length = 0;
await link.click({ force: true });
// Wait a bit for navigation or error
await page.waitForTimeout(1000);
// Check for new errors
const newErrors = errors.filter(e => !currentErrors.includes(e));
if (newErrors.length > 0) {
console.log(`Error on link "${text?.trim() || 'No text'}":`, newErrors);
expect(newErrors).toHaveLength(0);
}
// Check console for errors after click
const recentConsole = consoleMessages.filter(msg => msg.text.includes('TypeError') || msg.text.includes('href') || msg.type() === 'error');
if (recentConsole.length > 0) {
console.log(`Console error on link "${text?.trim() || 'No text'}":`, recentConsole);
expect(recentConsole).toHaveLength(0);
}
// If navigated, go back
if (page.url() !== 'http://localhost:8000/') {
await page.goBack();
await page.waitForLoadState('networkidle');
}
} catch (error) {
console.log(`Error clicking link "${text?.trim() || 'No text'}":`, error);
expect(error).toBeUndefined();
}
}
expect(errors).toHaveLength(0);
});