mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-14 02:42:04 +08:00
feat: Implement dynamic test-fix execution phase with adaptive task generation
- Added Phase 2: Test-Cycle Execution documentation outlining the process for dynamic test-fix execution, including agent roles, core responsibilities, intelligent strategy engine, and progressive testing. - Introduced new PowerShell scripts for analyzing TypeScript errors, focusing on error categorization and reporting. - Created end-to-end tests for the Help Page, ensuring content visibility, documentation navigation, internationalization support, and accessibility compliance.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { setupEnhancedMonitoring } from './helpers/i18n-helpers';
|
||||
|
||||
test.describe.skip('[Commands] - Commands Management Tests', () => {
|
||||
test.describe('[Commands] - Commands Management Tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/', { waitUntil: 'networkidle' as const });
|
||||
});
|
||||
@@ -341,4 +341,151 @@ test.describe.skip('[Commands] - Commands Management Tests', () => {
|
||||
monitoring.assertClean({ allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
// ========================================
|
||||
// API Error Scenarios
|
||||
// ========================================
|
||||
|
||||
test('L3.11 - API Error - 400 Bad Request', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 400
|
||||
await page.route('**/api/commands/**', (route) => {
|
||||
route.fulfill({
|
||||
status: 400,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Bad Request', message: 'Invalid command data' }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto('/commands', { waitUntil: 'networkidle' as const });
|
||||
|
||||
// Verify error message is displayed
|
||||
const errorMessage = page.getByText(/invalid|bad request|输入无效/i);
|
||||
await page.unroute('**/api/commands/**');
|
||||
const hasError = await errorMessage.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/commands'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.12 - API Error - 401 Unauthorized', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 401
|
||||
await page.route('**/api/commands', (route) => {
|
||||
route.fulfill({
|
||||
status: 401,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Unauthorized', message: 'Authentication required' }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto('/commands', { waitUntil: 'networkidle' as const });
|
||||
|
||||
// Verify auth error
|
||||
const authError = page.getByText(/unauthorized|not authenticated|未经授权/i);
|
||||
await page.unroute('**/api/commands');
|
||||
const hasError = await authError.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/commands'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.13 - API Error - 403 Forbidden', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 403
|
||||
await page.route('**/api/commands', (route) => {
|
||||
route.fulfill({
|
||||
status: 403,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Forbidden', message: 'Access denied' }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto('/commands', { waitUntil: 'networkidle' as const });
|
||||
|
||||
// Verify forbidden message
|
||||
const errorMessage = page.getByText(/forbidden|not allowed|禁止访问/i);
|
||||
await page.unroute('**/api/commands');
|
||||
const hasError = await errorMessage.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/commands'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.14 - API Error - 404 Not Found', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 404
|
||||
await page.route('**/api/commands/nonexistent', (route) => {
|
||||
route.fulfill({
|
||||
status: 404,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Not Found', message: 'Command not found' }),
|
||||
});
|
||||
});
|
||||
|
||||
// Try to access a non-existent command
|
||||
await page.goto('/commands/nonexistent-command-id', { waitUntil: 'networkidle' as const });
|
||||
|
||||
// Verify not found message
|
||||
const errorMessage = page.getByText(/not found|doesn't exist|未找到/i);
|
||||
await page.unroute('**/api/commands/nonexistent');
|
||||
const hasError = await errorMessage.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/commands'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.15 - API Error - 500 Internal Server Error', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 500
|
||||
await page.route('**/api/commands', (route) => {
|
||||
route.fulfill({
|
||||
status: 500,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Internal Server Error' }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto('/commands', { waitUntil: 'networkidle' as const });
|
||||
|
||||
// Verify server error message
|
||||
const errorMessage = page.getByText(/server error|try again|服务器错误/i);
|
||||
await page.unroute('**/api/commands');
|
||||
const hasError = await errorMessage.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/commands'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.16 - API Error - Network Timeout', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API timeout
|
||||
await page.route('**/api/commands', () => {
|
||||
// Never fulfill - simulate timeout
|
||||
});
|
||||
|
||||
await page.goto('/commands', { waitUntil: 'networkidle' as const });
|
||||
|
||||
// Wait for timeout handling
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Verify timeout message
|
||||
const timeoutMessage = page.getByText(/timeout|network error|unavailable|网络超时/i);
|
||||
await page.unroute('**/api/commands');
|
||||
const hasTimeout = await timeoutMessage.isVisible().catch(() => false);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/commands'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user