test: 删除根目录下的非核心E2E测试文件(任务 2/8)

This commit is contained in:
张翔
2026-04-07 21:45:28 +08:00
parent a01ed2553e
commit 0c8c993995
63 changed files with 1005 additions and 7331 deletions
@@ -28,6 +28,7 @@ test.describe('管理员完整工作流', () => {
const dialog = page.locator('.el-dialog');
await dialog.locator('input').first().fill(roleName);
await dialog.locator('input').nth(1).fill(roleKey);
await dialog.locator('input[type="number"]').fill('99');
});
await test.step('提交表单', async () => {
@@ -67,6 +68,32 @@ test.describe('管理员完整工作流', () => {
await page.waitForSelector('.el-dialog', { state: 'hidden', timeout: 10000 });
await expect(page.locator('.el-message--success')).toBeVisible({ timeout: 5000 });
});
await test.step('刷新用户列表', async () => {
await page.reload();
await page.waitForLoadState('networkidle');
});
await test.step('分配角色', async () => {
await page.waitForTimeout(1000);
const userRow = page.locator(`tr:has-text("${username}")`);
await expect(userRow).toBeVisible({ timeout: 10000 });
await userRow.locator('button:has-text("分配角色")').click();
await page.waitForSelector('.el-dialog:has-text("分配角色")', { state: 'visible', timeout: 5000 });
const transfer = page.locator('.el-transfer');
const availableRole = transfer.locator('.el-transfer-panel').first().locator('.el-checkbox:has-text("测试管理员")');
if (await availableRole.isVisible()) {
await availableRole.click();
await page.waitForTimeout(500);
}
await page.locator('.el-dialog:has-text("分配角色") button:has-text("确定")').click();
await page.waitForSelector('.el-dialog:has-text("分配角色")', { state: 'hidden', timeout: 10000 });
await expect(page.locator('.el-message--success')).toBeVisible({ timeout: 5000 });
});
});
test('验证新用户登录', async ({ page }) => {
@@ -110,7 +137,7 @@ test.describe('管理员完整工作流', () => {
await page.goto('/login');
await page.locator('input[placeholder*="用户名"]').fill('admin');
await page.locator('input[placeholder*="密码"]').fill('admin123');
await page.locator('input[placeholder*="密码"]').fill('Test@123');
await page.locator('button:has-text("登录")').click();
await page.waitForURL('**/dashboard');
});