From cf28600cfcfa1bdf1dcc55ca9c20e6e86fd3bcc0 Mon Sep 17 00:00:00 2001 From: dark Date: Fri, 13 Feb 2026 18:52:39 +0800 Subject: [PATCH] test: add main test suite entry point --- frontend/react-shadcn/pc/tests/index.ts | 79 +++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 frontend/react-shadcn/pc/tests/index.ts diff --git a/frontend/react-shadcn/pc/tests/index.ts b/frontend/react-shadcn/pc/tests/index.ts new file mode 100644 index 0000000..b6f7abd --- /dev/null +++ b/frontend/react-shadcn/pc/tests/index.ts @@ -0,0 +1,79 @@ +/** + * Playwright MCP 测试主入口 + * + * 运行所有测试的顺序: + * 1. 登录页面测试 + * 2. 导航和路由保护测试 + * 3. 仪表板页面测试 + * 4. 用户管理页面测试 + * 5. 设置页面测试 + */ + +import { loginTests } from './login.test'; +import { dashboardTests } from './dashboard.test'; +import { userManagementTests } from './users.test'; +import { settingsTests } from './settings.test'; +import { navigationTests } from './navigation.test'; + +export const allTests = { + login: loginTests, + navigation: navigationTests, + dashboard: dashboardTests, + users: userManagementTests, + settings: settingsTests, +}; + +// 测试套件配置 +export const testSuite = { + name: 'react-shadcn/pc Playwright MCP 完整测试套件', + version: '1.0.0', + + // 测试执行顺序 + executionOrder: [ + 'login', + 'navigation', + 'dashboard', + 'users', + 'settings', + ], + + // 运行所有测试 + async runAll() { + console.log('🚀 开始执行完整测试套件...\n'); + const results = []; + + for (const testName of this.executionOrder) { + console.log(`\n📦 运行测试模块: ${testName}`); + const testModule = allTests[testName as keyof typeof allTests]; + + if (testModule) { + const moduleResults = await this.runModule(testModule); + results.push({ name: testName, results: moduleResults }); + } + } + + console.log('\n📊 测试执行完成!'); + return results; + }, + + // 运行单个测试模块 + async runModule(testModule: any) { + const results = []; + const tests = Object.entries(testModule).filter(([key]) => key.startsWith('test')); + + for (const [testName, testFn] of tests) { + if (typeof testFn === 'function') { + try { + await testFn(); + results.push({ name: testName, status: 'passed' }); + } catch (error) { + results.push({ name: testName, status: 'failed', error }); + } + } + } + + return results; + }, +}; + +export default testSuite;