develop #1

Merged
zhangxiang merged 60 commits from develop into main 2026-04-05 10:28:15 +08:00
2 changed files with 11 additions and 4 deletions
Showing only changes of commit a1497a480b - Show all commits
@@ -34,10 +34,15 @@ test.describe('登录流程测试', () => {
await page.fill('input[placeholder*="用户名"]', 'admin');
await page.fill('input[placeholder*="密码"]', 'wrongpassword');
await page.click('button:has-text("登录")');
const errorMessage = page.locator('.el-message--error');
await expect(errorMessage).toBeVisible({ timeout: 5000 });
await Promise.all([
page.waitForResponse(resp => resp.url().includes('/auth/login') && resp.status() === 401),
page.click('button:has-text("登录")')
]);
const errorMessage = page.locator('.el-message');
await expect(errorMessage).toBeVisible({ timeout: 10000 });
await expect(errorMessage).toContainText(/用户名或密码错误|登录失败/i);
await expect(page).toHaveURL(/\/login/);
});
+2
View File
@@ -47,8 +47,10 @@ request.interceptors.response.use(
(error) => {
if (error.response?.status === 401) {
localStorage.removeItem('token')
if (!window.location.pathname.includes('/login')) {
window.location.href = '/login'
}
}
return Promise.reject(error)
}
)