test: guest onboarding, logged-in isolation, optional real_name

Add guest-onboarding and logged-in-and-isolation specs; remove moicen-unionid-chain;
MOICEN_E2E_EXPECTED_REAL_NAME for 欢迎回来+姓名; CI secret; workers=1; longer goto timeouts.

Made-with: Cursor
This commit is contained in:
2026-04-26 17:22:41 +08:00
parent bc85888359
commit 1e7337c239
8 changed files with 137 additions and 35 deletions
+34
View File
@@ -0,0 +1,34 @@
import { test, expect } from '@playwright/test';
/**
* 未登录(无 token、无有效 unionid 登录链):与 `huike-front` `index.vue` 一致,
* 根路径展示「请返回微信小程序完成登录」占位(产品侧常称欢迎/引导注册流程)。
*/
test.describe('未登录访客', () => {
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 });
await expect(page.getByText('欢迎回来')).not.toBeVisible();
await expect(page.getByText('请选择您的登录身份')).not.toBeVisible();
await context.close();
});
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 context.close();
});
});