test(e2e): update e2e tests and auth tokens

- Update E2E test files with latest authentication tokens
- Improve test stability and error handling
- Update pytest configuration
- Enhance gateway direct test with settings integration
This commit is contained in:
张翔
2026-04-23 16:35:57 +08:00
parent f590c40c21
commit 0d0b4decc3
14 changed files with 1327 additions and 151 deletions
@@ -168,9 +168,30 @@ test.describe('管理员完整工作流', () => {
}
}
await page.locator('.el-dialog:has-text("分配角色") button:has-text("确定")').click();
const [response] = await Promise.all([
page.waitForResponse(resp =>
resp.url().includes('/roles') && resp.request().method() === 'POST',
{ timeout: 10000 }
).catch(() => null),
page.locator('.el-dialog:has-text("分配角色") button:has-text("确定")').click()
]);
if (response) {
console.log('Assign roles response status:', response.status());
console.log('Assign roles response URL:', response.url());
} else {
console.log('No response received for assign roles - request may have been blocked by frontend');
}
await page.waitForSelector('.el-dialog:has-text("分配角色")', { state: 'hidden', timeout: 10000 });
await expect(page.locator('.el-message--success').last()).toBeVisible({ timeout: 5000 });
if (response && response.ok()) {
await expect(page.locator('.el-message--success')).toBeVisible({ timeout: 5000 });
} else {
const errorMsg = await page.locator('.el-message--error').textContent().catch(() => 'Unknown error');
console.log('Assign roles error message:', errorMsg);
throw new Error(`分配角色失败: ${errorMsg}`);
}
});
});