落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
72 lines
2.4 KiB
TypeScript
72 lines
2.4 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
/** L3: Home → Portrait path with mocked API (membership lexicon + deep gate). */
|
|
test('home birth form opens portrait with summary and deep CTA', async ({ page }) => {
|
|
await page.route('**/api/v1/**', async (route) => {
|
|
const req = route.request()
|
|
const url = req.url()
|
|
const method = req.method()
|
|
|
|
if (url.includes('/profiles') && method === 'POST') {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({
|
|
code: 0,
|
|
message: 'success',
|
|
data: {
|
|
id: 'prof-e2e',
|
|
user_id: 'u1',
|
|
relation: 'self',
|
|
display_name: '我',
|
|
birth_date: '1990-05-12',
|
|
created_at: new Date().toISOString(),
|
|
},
|
|
}),
|
|
headers: { 'X-Device-Key': 'e2e-device' },
|
|
})
|
|
return
|
|
}
|
|
if (url.includes('/reports/portrait') && method === 'POST') {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({
|
|
code: 0,
|
|
message: 'success',
|
|
data: {
|
|
id: 'rep-e2e',
|
|
has_deep_access: false,
|
|
type: 'portrait',
|
|
summary: {
|
|
headline: 'E2E画像',
|
|
one_liner: '模拟摘要',
|
|
life_tip: '好好睡觉',
|
|
keywords: ['稳'],
|
|
},
|
|
detail: null,
|
|
created_at: new Date().toISOString(),
|
|
},
|
|
}),
|
|
})
|
|
return
|
|
}
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({ code: 0, message: 'success', data: {} }),
|
|
})
|
|
})
|
|
|
|
await page.goto('/')
|
|
await expect(page.getByRole('img', { name: '愈心谷' }).first()).toBeVisible()
|
|
await expect(page.getByRole('navigation', { name: '主导航' })).toBeVisible()
|
|
await page.goto('/portrait?y=1990&m=5&d=12')
|
|
await expect(page.getByRole('img', { name: '愈心谷' }).first()).toBeVisible()
|
|
await expect(page.getByRole('navigation', { name: '主导航' })).toBeVisible()
|
|
await expect(page.getByRole('heading', { name: '个人画像' })).toBeVisible()
|
|
await expect(page.getByText('E2E画像')).toBeVisible()
|
|
await expect(page.getByText('模拟摘要')).toBeVisible()
|
|
await expect(page.getByRole('button', { name: /深度版/ })).toBeVisible()
|
|
})
|