feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* 调试测试 - 捕获浏览器控制台日志
|
||||
*/
|
||||
|
||||
test.describe('调试 - 捕获控制台日志', () => {
|
||||
test('应该捕获登录过程中的控制台日志', async ({ page }) => {
|
||||
// 捕获控制台日志
|
||||
const consoleLogs: string[] = [];
|
||||
page.on('console', msg => {
|
||||
const log = `[${msg.type()}] ${msg.text()}`;
|
||||
consoleLogs.push(log);
|
||||
console.log(log);
|
||||
});
|
||||
|
||||
// 捕获页面错误
|
||||
page.on('pageerror', error => {
|
||||
console.log(`[PAGE ERROR] ${error.message}`);
|
||||
});
|
||||
|
||||
// 捕获请求失败
|
||||
page.on('requestfailed', request => {
|
||||
console.log(`[REQUEST FAILED] ${request.url()}: ${request.failure()?.errorText}`);
|
||||
});
|
||||
|
||||
// 访问登录页面
|
||||
console.log('🌐 访问登录页面...');
|
||||
await page.goto('http://localhost:5174/login');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// 等待几秒让页面完全加载
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
console.log('📝 填写登录表单...');
|
||||
await page.fill('input[placeholder="请输入用户名"]', 'admin');
|
||||
await page.fill('input[placeholder="请输入密码"]', 'admin123456');
|
||||
|
||||
console.log('🖱️ 点击登录按钮...');
|
||||
await page.click('button:has-text("登录")');
|
||||
|
||||
// 等待几秒观察结果
|
||||
await page.waitForTimeout(5000);
|
||||
|
||||
console.log('📊 控制台日志统计:');
|
||||
console.log(`- 总日志数: ${consoleLogs.length}`);
|
||||
console.log('- 日志内容:');
|
||||
consoleLogs.forEach((log, index) => {
|
||||
console.log(` ${index + 1}. ${log}`);
|
||||
});
|
||||
|
||||
// 截图
|
||||
await page.screenshot({ path: '/tmp/debug-login-result.png', fullPage: true });
|
||||
|
||||
console.log('✅ 调试完成');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user