2026-04-28 08:45:12 +08:00
|
|
|
import { expect, test } from './fixtures';
|
2026-04-26 17:22:41 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 未登录(无 token、无有效 unionid 登录链):与 `huike-front` `index.vue` 一致,
|
2026-05-01 10:37:48 +08:00
|
|
|
* 根路径展示课包商店(course package store)。
|
2026-04-26 17:22:41 +08:00
|
|
|
*/
|
|
|
|
|
test.describe('未登录访客', () => {
|
2026-05-01 10:37:48 +08:00
|
|
|
test('新浏览器上下文访问 / 只看到课包商店,不出现已登录工作台', async ({
|
2026-04-26 17:22:41 +08:00
|
|
|
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 });
|
2026-05-01 10:37:48 +08:00
|
|
|
// Guest home shows course package store instead of old login prompt
|
|
|
|
|
await expect(page.locator('.course-package-store')).toBeVisible({ timeout: 60_000 });
|
2026-04-26 17:22:41 +08:00
|
|
|
await expect(page.getByText('欢迎回来')).not.toBeVisible();
|
|
|
|
|
await expect(page.getByText('请选择您的登录身份')).not.toBeVisible();
|
|
|
|
|
await context.close();
|
|
|
|
|
});
|
|
|
|
|
|
2026-05-01 10:37:48 +08:00
|
|
|
test('未带 status=2 时访问 / 仍为访客课包商店(非 Registered 链)', async ({
|
2026-04-26 17:22:41 +08:00
|
|
|
browser,
|
|
|
|
|
}) => {
|
|
|
|
|
const context = await browser.newContext();
|
|
|
|
|
const page = await context.newPage();
|
|
|
|
|
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 60_000 });
|
2026-05-01 10:37:48 +08:00
|
|
|
await expect(page.locator('.course-package-store')).toBeVisible({ timeout: 60_000 });
|
2026-04-26 17:22:41 +08:00
|
|
|
await context.close();
|
|
|
|
|
});
|
|
|
|
|
});
|