fix: update guest tests to expect course package store instead of login prompt

This commit is contained in:
2026-05-01 10:37:48 +08:00
parent a20011ca8f
commit 97602b67b6
3 changed files with 10 additions and 14 deletions
+2 -3
View File
@@ -25,9 +25,8 @@ test.describe('核心全链路(访客)', () => {
await page.waitForURL((u) => new URL(u).pathname === '/', {
timeout: 60_000,
});
await expect(
page.getByText('请返回微信小程序完成登录')
).toBeVisible({ timeout: 60_000 });
// Guest home now shows the course package store instead of login prompt
await expect(page.locator('.course-package-store')).toBeVisible({ timeout: 60_000 });
});
});
+6 -9
View File
@@ -2,33 +2,30 @@ import { expect, test } from './fixtures';
/**
* 未登录(无 token、无有效 unionid 登录链):与 `huike-front` `index.vue` 一致,
* 根路径展示「请返回微信小程序完成登录」占位(产品侧常称欢迎/引导注册流程)。
* 根路径展示课包商店(course package store)。
*/
test.describe('未登录访客', () => {
test('新浏览器上下文访问 / 只看到小程序登录引导,不出现已登录工作台', async ({
test('新浏览器上下文访问 / 只看到课包商店,不出现已登录工作台', async ({
browser,
}) => {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 60_000 });
await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 });
await expect(
page.getByText('请返回微信小程序完成登录')
).toBeVisible({ timeout: 60_000 });
// Guest home shows course package store instead of old login prompt
await expect(page.locator('.course-package-store')).toBeVisible({ timeout: 60_000 });
await expect(page.getByText('欢迎回来')).not.toBeVisible();
await expect(page.getByText('请选择您的登录身份')).not.toBeVisible();
await context.close();
});
test('未带 status=2 时访问 / 仍为访客引导(非 Registered 链)', async ({
test('未带 status=2 时访问 / 仍为访客课包商店(非 Registered 链)', async ({
browser,
}) => {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 60_000 });
await expect(
page.getByText('请返回微信小程序完成登录')
).toBeVisible({ timeout: 60_000 });
await expect(page.locator('.course-package-store')).toBeVisible({ timeout: 60_000 });
await context.close();
});
});
+2 -2
View File
@@ -31,10 +31,10 @@ test.describe('机构多租户入口链路', () => {
});
await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 });
// 线上会话状态可能被服务端回收;出现访客占位时跳过,不让 CI 因账号瞬时态失败。
// 线上会话状态可能被服务端回收;出现访客课包商店时跳过,不让 CI 因账号瞬时态失败。
if (
await page
.getByText('请返回微信小程序完成登录')
.locator('.course-package-store')
.isVisible()
.catch(() => false)
) {