feat: 添加异常日志功能并优化UI样式
refactor: 重构后端查询逻辑和API响应处理 fix: 修复用户角色更新和文件上传问题 test: 添加前端性能测试脚本和E2E测试用例 chore: 更新依赖版本和配置文件 docs: 添加环境检查脚本和测试文档 style: 统一表格标签样式和路由命名 perf: 优化前端页面加载速度和响应时间
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { LoginPage } from './pages/LoginPage';
|
||||
|
||||
test.describe('登录调试测试', () => {
|
||||
test('调试登录过程', async ({ page }) => {
|
||||
const loginPage = new LoginPage(page);
|
||||
|
||||
await test.step('访问登录页面', async () => {
|
||||
await loginPage.goto();
|
||||
console.log('Current URL:', page.url());
|
||||
await expect(page).toHaveTitle(/登录/);
|
||||
});
|
||||
|
||||
await test.step('检查表单元素', async () => {
|
||||
const usernameInput = page.locator('input[placeholder="请输入用户名"]');
|
||||
const passwordInput = page.locator('input[placeholder="请输入密码"]');
|
||||
const loginButton = page.locator('button:has-text("登录")');
|
||||
|
||||
await expect(usernameInput).toBeVisible();
|
||||
await expect(passwordInput).toBeVisible();
|
||||
await expect(loginButton).toBeVisible();
|
||||
|
||||
console.log('Username input found:', await usernameInput.isVisible());
|
||||
console.log('Password input found:', await passwordInput.isVisible());
|
||||
console.log('Login button found:', await loginButton.isVisible());
|
||||
});
|
||||
|
||||
await test.step('填写表单', async () => {
|
||||
const usernameInput = page.locator('input[placeholder="请输入用户名"]');
|
||||
const passwordInput = page.locator('input[placeholder="请输入密码"]');
|
||||
|
||||
await usernameInput.fill('admin');
|
||||
await passwordInput.fill('admin123');
|
||||
|
||||
console.log('Username filled:', await usernameInput.inputValue());
|
||||
console.log('Password filled:', await passwordInput.inputValue());
|
||||
});
|
||||
|
||||
await test.step('点击登录按钮', async () => {
|
||||
const loginButton = page.locator('button:has-text("登录")');
|
||||
await loginButton.click();
|
||||
console.log('Login button clicked');
|
||||
|
||||
await page.waitForTimeout(3000);
|
||||
console.log('Current URL after click:', page.url());
|
||||
|
||||
const currentUrl = page.url();
|
||||
if (currentUrl.includes('/dashboard')) {
|
||||
console.log('Login successful!');
|
||||
} else {
|
||||
console.log('Login failed, still on login page');
|
||||
|
||||
const errorMessage = page.locator('.el-message--error');
|
||||
if (await errorMessage.isVisible()) {
|
||||
const errorText = await errorMessage.textContent();
|
||||
console.log('Error message:', errorText);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user