Files
novalon-website/e2e/features/admin/user-management.spec.ts
T
张翔 d14513ff34 refactor: 删除旧的E2E测试文件
删除文件:
- e2e/admin-frontend-interaction.spec.ts
- e2e/admin-publish-core.spec.ts
- e2e/admin-publish.spec.ts
- e2e/website-acceptance.spec.ts

原因:
- 已被新的测试架构替代
- 新架构采用Page Object Model模式
- 新架构有更清晰的测试分类(smoke/journeys/features)
- 新架构提供更好的可维护性和可扩展性

新测试架构:
- smoke/ - 冒烟测试
- journeys/ - 用户旅程测试
- features/ - 功能测试
- pages/ - Page Object Model
- fixtures/ - 测试固件
2026-04-09 13:34:44 +08:00

52 lines
1.5 KiB
TypeScript

import { test, expect } from '../../fixtures/auth';
import { AdminUserPage } from '../../pages';
test.describe('用户管理测试 @feature @admin', () => {
let userPage: AdminUserPage;
test.beforeEach(async ({ page }) => {
userPage = new AdminUserPage(page);
});
test('查看用户列表', async ({ authenticatedPage: _authenticatedPage }) => {
await userPage.goto();
const table = userPage['page'].locator('table');
await expect(table).toBeVisible();
const rows = table.locator('tbody tr');
const count = await rows.count();
expect(count).toBeGreaterThan(0);
});
test('创建新用户', async ({ authenticatedPage: _authenticatedPage }) => {
const timestamp = Date.now();
const userData = {
email: `test-${timestamp}@example.com`,
password: 'Test123456!',
name: `测试用户${timestamp}`,
role: 'viewer' as const,
};
try {
await userPage.createUser(userData);
await userPage.expectUserInList(userData.email);
} finally {
// TODO: 添加删除用户的逻辑
}
});
test('搜索用户', async ({ page, authenticatedPage: _authenticatedPage }) => {
await userPage.goto();
const searchInput = page.locator('input[placeholder*="搜索"], input[name="search"]');
if (await searchInput.count() > 0) {
await searchInput.fill('admin');
await page.keyboard.press('Enter');
const table = page.locator('table');
await expect(table).toBeVisible();
}
});
});