Add API error monitoring tests and error context snapshots for various browsers

- Created error context snapshots for Firefox, WebKit, and Chromium to capture UI state during API error monitoring.
- Implemented e2e tests for API error detection, including console errors, failed API requests, and proxy errors.
- Added functionality to ignore specific API patterns in monitoring assertions.
- Ensured tests validate the monitoring system's ability to detect and report errors effectively.
This commit is contained in:
catlog22
2026-01-31 00:15:59 +08:00
parent f1324a0bc8
commit a0f81f8841
66 changed files with 3112 additions and 3175 deletions

View File

@@ -9,13 +9,36 @@ import {
verifyI18nState,
verifyPersistenceAfterReload,
navigateAndVerifyLanguage,
setupEnhancedMonitoring,
} from './helpers/i18n-helpers';
test.describe('[Navigation] - i18n E2E Tests', () => {
test.beforeEach(async ({ page }) => {
// Setup enhanced error monitoring to catch API/proxy errors
const monitoring = setupEnhancedMonitoring(page);
// Store monitoring on page for afterEach access
(page as any).__monitoring = monitoring;
await page.goto('/', { waitUntil: 'networkidle' });
});
test.afterEach(async ({ page }) => {
// Assert no console errors or API failures after each test
const monitoring = (page as any).__monitoring as EnhancedMonitoring;
if (monitoring) {
try {
// Allow ignoring known backend dependency issues
monitoring.assertClean({
ignoreAPIPatterns: ['/api/data'], // Known: backend may not be running
allowWarnings: true // Don't fail on warnings
});
} finally {
monitoring.stop();
}
}
});
/**
* NAV-01: Verify navigation links are translated
* Priority: P0