feat: extend operation log service and repository with pagination support

This commit is contained in:
张翔
2026-03-18 22:34:43 +08:00
parent 157aee2ffc
commit 8a0cd64829
81 changed files with 8842 additions and 509 deletions
+196
View File
@@ -0,0 +1,196 @@
import { test, expect } from '@playwright/test';
import { LoginPage } from './pages/LoginPage';
import { DashboardPage } from './pages/DashboardPage';
test.describe('UAT阶段一:核心功能验证', () => {
test('UAT-AUTH-001: 成功登录流程', async ({ page }) => {
const loginPage = new LoginPage(page);
const dashboardPage = new DashboardPage(page);
await test.step('访问登录页面', async () => {
await loginPage.goto();
await expect(page).toHaveTitle(/登录/);
});
await test.step('输入用户名和密码', async () => {
await loginPage.usernameInput.fill('admin');
await loginPage.passwordInput.fill('password');
});
await test.step('点击登录按钮', async () => {
await loginPage.loginButton.click();
});
await test.step('验证登录成功', async () => {
await page.waitForURL(/.*dashboard/, { timeout: 10000 });
const username = await dashboardPage.getUsername();
expect(username).toContain('admin');
});
});
test('UAT-AUTH-002: 登录失败 - 无效凭证', async ({ page }) => {
const loginPage = new LoginPage(page);
await test.step('访问登录页面', async () => {
await loginPage.goto();
await expect(page).toHaveTitle(/登录/);
});
await test.step('输入无效凭证', async () => {
await loginPage.usernameInput.fill('invalid');
await loginPage.passwordInput.fill('invalid');
await loginPage.loginButton.click();
});
await test.step('验证错误消息显示', async () => {
await page.waitForTimeout(2000);
const errorMessage = await loginPage.getErrorMessage();
expect(errorMessage).toBeTruthy();
});
await test.step('验证保持在登录页面', async () => {
await expect(page).toHaveURL(/.*login/);
});
});
test('UAT-AUTH-003: 登出流程', async ({ page }) => {
const loginPage = new LoginPage(page);
await test.step('登录系统', async () => {
await loginPage.goto();
await loginPage.usernameInput.fill('admin');
await loginPage.passwordInput.fill('password');
await loginPage.loginButton.click();
await page.waitForURL(/.*dashboard/, { timeout: 10000 });
});
await test.step('点击用户头像', async () => {
const avatar = page.locator('.el-avatar');
await avatar.click();
await page.waitForTimeout(1000);
});
await test.step('点击退出登录', async () => {
const logoutButton = page.locator('.el-dropdown-menu').getByText('退出登录');
await logoutButton.click();
});
await test.step('验证跳转到登录页面', async () => {
await page.waitForURL(/.*login/, { timeout: 10000 });
await expect(page).toHaveTitle(/登录/);
});
});
test('UAT-NAV-001: 系统管理菜单导航', async ({ page }) => {
const loginPage = new LoginPage(page);
const dashboardPage = new DashboardPage(page);
await test.step('登录系统', async () => {
await loginPage.goto();
await loginPage.usernameInput.fill('admin');
await loginPage.passwordInput.fill('password');
await loginPage.loginButton.click();
await page.waitForURL(/.*dashboard/, { timeout: 10000 });
});
await test.step('点击系统管理菜单', async () => {
const systemMenu = page.locator('.el-sub-menu').filter({ hasText: '系统管理' });
await systemMenu.click();
await page.waitForTimeout(500);
});
await test.step('点击用户管理', async () => {
await dashboardPage.userManagementLink.click();
});
await test.step('验证页面跳转', async () => {
await page.waitForURL(/.*users/, { timeout: 10000 });
await expect(page).toHaveURL(/.*users/);
});
});
test('UAT-NAV-002: 角色管理菜单导航', async ({ page }) => {
const loginPage = new LoginPage(page);
const dashboardPage = new DashboardPage(page);
await test.step('登录系统', async () => {
await loginPage.goto();
await loginPage.usernameInput.fill('admin');
await loginPage.passwordInput.fill('password');
await loginPage.loginButton.click();
await page.waitForURL(/.*dashboard/, { timeout: 10000 });
});
await test.step('点击系统管理菜单', async () => {
const systemMenu = page.locator('.el-sub-menu').filter({ hasText: '系统管理' });
await systemMenu.click();
await page.waitForTimeout(500);
});
await test.step('点击角色管理', async () => {
await dashboardPage.roleManagementLink.click();
});
await test.step('验证页面跳转', async () => {
await page.waitForURL(/.*roles/, { timeout: 10000 });
await expect(page).toHaveURL(/.*roles/);
});
});
test('UAT-NAV-003: 菜单管理菜单导航', async ({ page }) => {
const loginPage = new LoginPage(page);
const dashboardPage = new DashboardPage(page);
await test.step('登录系统', async () => {
await loginPage.goto();
await loginPage.usernameInput.fill('admin');
await loginPage.passwordInput.fill('password');
await loginPage.loginButton.click();
await page.waitForURL(/.*dashboard/, { timeout: 10000 });
});
await test.step('点击系统管理菜单', async () => {
const systemMenu = page.locator('.el-sub-menu').filter({ hasText: '系统管理' });
await systemMenu.click();
await page.waitForTimeout(500);
});
await test.step('点击菜单管理', async () => {
await dashboardPage.menuManagementLink.click();
});
await test.step('验证页面跳转', async () => {
await page.waitForURL(/.*menus/, { timeout: 10000 });
await expect(page).toHaveURL(/.*menus/);
});
});
test('UAT-NAV-004: 系统配置菜单导航', async ({ page }) => {
const loginPage = new LoginPage(page);
const dashboardPage = new DashboardPage(page);
await test.step('登录系统', async () => {
await loginPage.goto();
await loginPage.usernameInput.fill('admin');
await loginPage.passwordInput.fill('password');
await loginPage.loginButton.click();
await page.waitForURL(/.*dashboard/, { timeout: 10000 });
});
await test.step('点击系统配置菜单', async () => {
const configMenu = page.locator('.el-sub-menu').filter({ hasText: '系统配置' });
await configMenu.click();
await page.waitForTimeout(500);
});
await test.step('点击参数配置', async () => {
await dashboardPage.systemConfigLink.click();
});
await test.step('验证页面跳转', async () => {
await page.waitForURL(/.*sysconfig/, { timeout: 10000 });
await expect(page).toHaveURL(/.*sysconfig/);
});
});
});