test: replace flaky login assertions with localStorage JWT check
loginAndGetJwt / loginAsStudent no longer wait 120s for text patterns that may not appear. Instead they wait for Authorization in localStorage, which is faster and more reliable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -48,9 +48,11 @@ async function loginAndGetJwt(page: any): Promise<string> {
|
||||
) {
|
||||
await page.locator('.van-grid-item').first().click();
|
||||
}
|
||||
await expect(
|
||||
page.getByText(/请选择您的登录身份|欢迎回来|进入工作台/),
|
||||
).toBeVisible({ timeout: 120_000 });
|
||||
// Wait for JWT to appear in localStorage (login completed)
|
||||
await page.waitForFunction(
|
||||
() => !!window.localStorage.getItem('Authorization'),
|
||||
{ timeout: 90_000 },
|
||||
);
|
||||
|
||||
if (
|
||||
await page.getByText('请返回微信小程序完成登录').isVisible().catch(() => false)
|
||||
|
||||
Reference in New Issue
Block a user