fix: resolve test skip issues in admin regression tests
This commit is contained in:
@@ -24,7 +24,7 @@ test.describe('管理后台认证测试', () => {
|
||||
});
|
||||
|
||||
test('应该拒绝空密码', async ({ page }) => {
|
||||
await loginPage.emailInput.fill('contact@novalon.cn');
|
||||
await loginPage.emailInput.fill('admin@novalon.cn');
|
||||
await loginPage.passwordInput.fill('');
|
||||
await loginPage.loginButton.click();
|
||||
|
||||
@@ -32,7 +32,7 @@ test.describe('管理后台认证测试', () => {
|
||||
});
|
||||
|
||||
test('登录成功后应该重定向到仪表盘', async ({ page }) => {
|
||||
await loginPage.login('contact@novalon.cn', 'admin123456');
|
||||
await loginPage.login('admin@novalon.cn', 'admin123456');
|
||||
|
||||
try {
|
||||
await page.waitForURL(/\/admin(?!\/login)/, { timeout: 15000 });
|
||||
@@ -53,14 +53,11 @@ test.describe('内容管理功能测试', () => {
|
||||
contentPage = new AdminContentPage(page);
|
||||
|
||||
await loginPage.goto();
|
||||
await loginPage.login('contact@novalon.cn', 'admin123456');
|
||||
await loginPage.login('admin@novalon.cn', 'admin123456');
|
||||
|
||||
try {
|
||||
await page.waitForURL(/\/admin/, { timeout: 15000 });
|
||||
} catch (error) {
|
||||
console.error('登录超时,跳过测试:', error);
|
||||
test.skip();
|
||||
}
|
||||
await expect(async () => {
|
||||
await page.waitForURL(/\/admin/, { timeout: 10000 });
|
||||
}).toPass({ timeout: 15000 });
|
||||
});
|
||||
|
||||
test('应该显示内容列表页面', async ({ page }) => {
|
||||
@@ -98,14 +95,11 @@ test.describe('用户管理功能测试', () => {
|
||||
usersPage = new AdminUsersPage(page);
|
||||
|
||||
await loginPage.goto();
|
||||
await loginPage.login('contact@novalon.cn', 'admin123456');
|
||||
await loginPage.login('admin@novalon.cn', 'admin123456');
|
||||
|
||||
try {
|
||||
await page.waitForURL(/\/admin/, { timeout: 15000 });
|
||||
} catch (error) {
|
||||
console.error('登录超时,跳过测试:', error);
|
||||
test.skip();
|
||||
}
|
||||
await expect(async () => {
|
||||
await page.waitForURL(/\/admin/, { timeout: 10000 });
|
||||
}).toPass({ timeout: 15000 });
|
||||
});
|
||||
|
||||
test('应该显示用户列表页面', async ({ page }) => {
|
||||
@@ -135,14 +129,11 @@ test.describe('审计日志功能测试', () => {
|
||||
logsPage = new AdminLogsPage(page);
|
||||
|
||||
await loginPage.goto();
|
||||
await loginPage.login('contact@novalon.cn', 'admin123456');
|
||||
await loginPage.login('admin@novalon.cn', 'admin123456');
|
||||
|
||||
try {
|
||||
await page.waitForURL(/\/admin/, { timeout: 15000 });
|
||||
} catch (error) {
|
||||
console.error('登录超时,跳过测试:', error);
|
||||
test.skip();
|
||||
}
|
||||
await expect(async () => {
|
||||
await page.waitForURL(/\/admin/, { timeout: 10000 });
|
||||
}).toPass({ timeout: 15000 });
|
||||
});
|
||||
|
||||
test('应该显示审计日志页面', async ({ page }) => {
|
||||
@@ -179,12 +170,14 @@ test.describe('权限控制测试', () => {
|
||||
await loginPage.login('editor@novalon.cn', 'editor123');
|
||||
|
||||
try {
|
||||
await page.waitForURL(/\/admin/, { timeout: 5000 });
|
||||
await expect(async () => {
|
||||
await page.waitForURL(/\/admin/, { timeout: 5000 });
|
||||
}).toPass({ timeout: 10000 });
|
||||
await contentPage.goto();
|
||||
|
||||
await expect(contentPage.createButton).toBeVisible();
|
||||
} catch (error) {
|
||||
test.skip();
|
||||
test.skip(true, '编辑用户不存在或登录失败');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -196,7 +189,9 @@ test.describe('权限控制测试', () => {
|
||||
await loginPage.login('viewer@novalon.cn', 'viewer123');
|
||||
|
||||
try {
|
||||
await page.waitForURL(/\/admin/, { timeout: 5000 });
|
||||
await expect(async () => {
|
||||
await page.waitForURL(/\/admin/, { timeout: 5000 });
|
||||
}).toPass({ timeout: 10000 });
|
||||
await contentPage.goto();
|
||||
|
||||
await expect(contentPage.contentList.first()).toBeVisible();
|
||||
@@ -209,7 +204,7 @@ test.describe('权限控制测试', () => {
|
||||
expect(isDisabled).toBe(true);
|
||||
}
|
||||
} catch (error) {
|
||||
test.skip();
|
||||
test.skip(true, '查看者用户不存在或登录失败');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user