mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +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:
@@ -594,4 +594,161 @@ test.describe('[Orchestrator] - Workflow Canvas Tests', () => {
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/workflows'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
// ========================================
|
||||
// API Error Scenarios
|
||||
// ========================================
|
||||
|
||||
test('L3.13 - API Error - 400 Bad Request', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 400
|
||||
await page.route('**/api/workflows', (route) => {
|
||||
if (route.request().method() === 'POST') {
|
||||
route.fulfill({
|
||||
status: 400,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Bad Request', message: 'Invalid workflow data' }),
|
||||
});
|
||||
} else {
|
||||
route.continue();
|
||||
}
|
||||
});
|
||||
|
||||
// Try to create a node
|
||||
const createButton = page.getByRole('button', { name: /create|add/i });
|
||||
const hasCreateButton = await createButton.isVisible().catch(() => false);
|
||||
|
||||
if (hasCreateButton) {
|
||||
await createButton.click();
|
||||
|
||||
// Verify error message
|
||||
const errorMessage = page.getByText(/invalid|bad request|输入无效/i);
|
||||
await page.unroute('**/api/workflows');
|
||||
const hasError = await errorMessage.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
}
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/workflows'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.14 - API Error - 401 Unauthorized', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 401
|
||||
await page.route('**/api/workflows', (route) => {
|
||||
route.fulfill({
|
||||
status: 401,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Unauthorized', message: 'Authentication required' }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'networkidle' as const });
|
||||
|
||||
// Verify auth error
|
||||
const authError = page.getByText(/unauthorized|not authenticated|未经授权/i);
|
||||
await page.unroute('**/api/workflows');
|
||||
const hasError = await authError.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/workflows'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.15 - API Error - 403 Forbidden', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 403
|
||||
await page.route('**/api/workflows', (route) => {
|
||||
route.fulfill({
|
||||
status: 403,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Forbidden', message: 'Access denied' }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'networkidle' as const });
|
||||
|
||||
// Verify forbidden message
|
||||
const errorMessage = page.getByText(/forbidden|not allowed|禁止访问/i);
|
||||
await page.unroute('**/api/workflows');
|
||||
const hasError = await errorMessage.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/workflows'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.16 - API Error - 404 Not Found', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 404
|
||||
await page.route('**/api/workflows/nonexistent', (route) => {
|
||||
route.fulfill({
|
||||
status: 404,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Not Found', message: 'Workflow not found' }),
|
||||
});
|
||||
});
|
||||
|
||||
// Try to access a non-existent workflow
|
||||
await page.goto('/orchestrator?workflow=nonexistent-workflow-id', { waitUntil: 'networkidle' as const });
|
||||
|
||||
// Verify not found message
|
||||
const errorMessage = page.getByText(/not found|doesn't exist|未找到/i);
|
||||
await page.unroute('**/api/workflows/nonexistent');
|
||||
const hasError = await errorMessage.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/workflows'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.17 - API Error - 500 Internal Server Error', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API to return 500
|
||||
await page.route('**/api/workflows', (route) => {
|
||||
route.fulfill({
|
||||
status: 500,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'Internal Server Error' }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: 'networkidle' as const });
|
||||
|
||||
// Verify server error message
|
||||
const errorMessage = page.getByText(/server error|try again|服务器错误/i);
|
||||
await page.unroute('**/api/workflows');
|
||||
const hasError = await errorMessage.isVisible().catch(() => false);
|
||||
expect(hasError).toBe(true);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/workflows'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
|
||||
test('L3.18 - API Error - Network Timeout', async ({ page }) => {
|
||||
const monitoring = setupEnhancedMonitoring(page);
|
||||
|
||||
// Mock API timeout
|
||||
await page.route('**/api/workflows', () => {
|
||||
// Never fulfill - simulate timeout
|
||||
});
|
||||
|
||||
await page.reload({ 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/workflows');
|
||||
const hasTimeout = await timeoutMessage.isVisible().catch(() => false);
|
||||
|
||||
monitoring.assertClean({ ignoreAPIPatterns: ['/api/workflows'], allowWarnings: true });
|
||||
monitoring.stop();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user