fix: 修复前端登录体验和API调用问题
- 修复路由守卫:未登录时直接跳转,不显示提示信息 - 修复API拦截器:401错误直接跳转,无需确认 - 移除不必要的ElMessageBox确认框 - 优化Token过期处理逻辑 - 修复文件管理API引入路径和URL前缀 - 修复调拨/回收管理API端点不匹配问题 - 修复通知管理API方法不匹配问题 - 统一系统配置API路径为单数形式 影响文件: - src/router/index.ts - src/api/request.ts - src/api/file.ts - src/api/index.ts 测试状态: - 前端构建通过 - 所有API路径已验证 - 登录流程测试通过 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
107
playwright.config.ts
Normal file
107
playwright.config.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import { defineConfig, devices } from '@playwright/test'
|
||||
|
||||
/**
|
||||
* Playwright配置文件
|
||||
* E2E测试配置
|
||||
*/
|
||||
export default defineConfig({
|
||||
// 测试目录
|
||||
testDir: './tests/e2e',
|
||||
|
||||
// 测试文件匹配模式
|
||||
testMatch: '**/*.spec.ts',
|
||||
|
||||
// 完全并行运行测试文件
|
||||
fullyParallel: true,
|
||||
|
||||
// 在CI中失败时不重试
|
||||
// 在本地开发中重试失败的测试
|
||||
retries: process.env.CI ? 0 : 2,
|
||||
|
||||
// 在CI中限制并行工作线程数
|
||||
// 在本地使用所有可用线程
|
||||
workers: process.env.CI ? 2 : undefined,
|
||||
|
||||
// 测试报告
|
||||
reporter: [
|
||||
['html', { outputFolder: 'test_reports/playwright-report' }],
|
||||
['json', { outputFile: 'test_reports/playwright-results.json' }],
|
||||
['junit', { outputFile: 'test_reports/playwright-junit.xml' }],
|
||||
['list']
|
||||
],
|
||||
|
||||
// 全局设置
|
||||
use: {
|
||||
// 基础URL
|
||||
baseURL: 'http://localhost:5173',
|
||||
|
||||
// 收集失败测试的追踪信息
|
||||
trace: 'retain-on-failure',
|
||||
|
||||
// 截图配置
|
||||
screenshot: 'only-on-failure',
|
||||
|
||||
// 视频配置
|
||||
video: 'retain-on-failure',
|
||||
|
||||
// 操作超时时间
|
||||
actionTimeout: 10 * 1000, // 10秒
|
||||
navigationTimeout: 30 * 1000, // 30秒
|
||||
|
||||
// 浏览器视口大小
|
||||
viewport: { width: 1280, height: 720 },
|
||||
|
||||
// 忽略HTTPS错误
|
||||
ignoreHTTPSErrors: true,
|
||||
|
||||
// 等待超时
|
||||
waitUntil: 'networkidle'
|
||||
},
|
||||
|
||||
// 项目配置(不同浏览器)
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
|
||||
{
|
||||
name: 'firefox',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
|
||||
{
|
||||
name: 'webkit',
|
||||
use: { ...devices['Desktop Safari'] },
|
||||
},
|
||||
|
||||
/* 测试移动端视图 */
|
||||
{
|
||||
name: 'Mobile Chrome',
|
||||
use: { ...devices['Pixel 5'] },
|
||||
},
|
||||
{
|
||||
name: 'Mobile Safari',
|
||||
use: { ...devices['iPhone 12'] },
|
||||
},
|
||||
],
|
||||
|
||||
// 开发服务器配置(启动测试前自动启动)
|
||||
webServer: {
|
||||
command: 'npm run dev',
|
||||
url: 'http://localhost:5173',
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 120 * 1000, // 2分钟
|
||||
},
|
||||
|
||||
// 全局setup
|
||||
globalSetup: './tests/e2e/global-setup.ts',
|
||||
|
||||
// 全局teardown
|
||||
globalTeardown: './tests/e2e/global-teardown.ts',
|
||||
|
||||
// 期望超时
|
||||
expect: {
|
||||
timeout: 5000
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user