- 移除微信订阅推送功能(云函数/订阅管理页),回归纯客户端零后端架构 - 新增今日黄历默认展示卡片 TodayAlmanacCard(9 语言翻译) - i18n 修复:启用 globalInjection 修复 $t 未注入,插值消息全部改为 Messages Functions 适配小程序端(63 处) - 修复底部导航切换失效与运势页数据不刷新 - 统一设计令牌(深褐主色 + 印红强调色),组件 UI 规范重构 - 图标 iconfont 化(FontAwesome 子集化,修复 Android 豆腐块) - 新增 postcss-px2rpx 机型自适应(仅 mp-weixin 构建生效) - 新增 5 个用户旅程 E2E 测试(31 用例)与验收报告 - 补充微信小程序项目配置(appid)
98 lines
3.8 KiB
TypeScript
98 lines
3.8 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
import { setDateInput, setBirthPlace, gotoPage, openCustomPicker, closeCustomPicker } from './helpers'
|
|
|
|
/**
|
|
* 用户旅程 J-ZIWEI(Critical):紫微斗数排盘完整旅程
|
|
*
|
|
* 用户目标:输入出生信息,生成完整命盘(十二宫位、三方四正分析、综合总结)
|
|
*
|
|
* 旅程步骤:
|
|
* 1. 进入排盘页(初始状态:表单可见、无结果)
|
|
* 2. 选择出生日期
|
|
* 3. 确认时辰选择器可用(H5 端为 3D 滚轮,精确选择由小程序原生 picker 提供)
|
|
* 4. 切换性别(女性)
|
|
* 5. 输入出生地(触发城市坐标自动识别)
|
|
* 6. 点击排盘
|
|
* 7. 验证十二宫位卡片
|
|
* 8. 验证三方四正分析
|
|
* 9. 验证综合总结
|
|
*
|
|
* 错误恢复场景:
|
|
* E1. 未选择日期直接排盘 → 不生成结果(守护逻辑)
|
|
* E2. 输入未知出生地 → 显示"未找到"提示
|
|
*/
|
|
test.describe('旅程 J-ZIWEI:紫微排盘完整旅程', () => {
|
|
test.describe.configure({ mode: 'serial' })
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await gotoPage(page, '/pages/ziwei/index')
|
|
})
|
|
|
|
test('STEP 1: 进入排盘页,表单可见且初始无排盘结果', async ({ page }) => {
|
|
await expect(page.locator('[data-test="birth-form"]')).toBeVisible()
|
|
await expect(page.locator('[data-test="generate-btn"]')).toBeVisible()
|
|
await expect(page.locator('.chart-result')).not.toBeVisible()
|
|
})
|
|
|
|
test('STEP 2-3: 选择出生日期并确认时辰选择器可用', async ({ page }) => {
|
|
await setDateInput(page, 'input[type="date"]', '1990-01-01')
|
|
|
|
const dateDisplay = await page.locator('.picker-value').first().textContent()
|
|
expect(dateDisplay).toContain('1990-01-01')
|
|
|
|
// 时辰选择器存在且默认值为子时
|
|
const hourDisplay = await page.locator('.picker-value').nth(1).textContent()
|
|
expect(hourDisplay).toContain('子时')
|
|
|
|
// 时辰选择器可打开(验证进入修改流程)
|
|
await page.locator('.picker-value').nth(1).click()
|
|
await page.waitForTimeout(600)
|
|
expect(await openCustomPicker(page)).toBe(true)
|
|
await closeCustomPicker(page)
|
|
})
|
|
|
|
test('STEP 4: 切换性别为女性', async ({ page }) => {
|
|
const options = page.locator('.gender-option')
|
|
await expect(options).toHaveCount(2)
|
|
await options.nth(1).click()
|
|
await expect(options.nth(1)).toHaveClass(/active/)
|
|
})
|
|
|
|
test('STEP 5: 输入出生地并触发坐标识别', async ({ page }) => {
|
|
await setBirthPlace(page, '北京')
|
|
const detected = page.locator('.location-hint.detected')
|
|
await expect(detected).toBeVisible()
|
|
})
|
|
|
|
test('STEP 6-9: 点击排盘,生成完整命盘', async ({ page }) => {
|
|
await setDateInput(page, 'input[type="date"]', '1990-01-01')
|
|
await page.locator('[data-test="generate-btn"]').click()
|
|
await page.waitForTimeout(1500)
|
|
|
|
// 十二宫位
|
|
await expect(page.locator('.chart-result')).toBeVisible()
|
|
await expect(page.locator('.palace-card')).toHaveCount(12)
|
|
|
|
// 三方四正分析
|
|
await expect(page.locator('.analysis-section')).toBeVisible()
|
|
const sanFang = await page.locator('.analysis-value').first().textContent()
|
|
expect(sanFang).toBeTruthy()
|
|
|
|
// 综合总结
|
|
await expect(page.locator('.summary-section')).toBeVisible()
|
|
const summary = await page.locator('.summary-text').textContent()
|
|
expect(summary && summary.trim().length).toBeGreaterThan(0)
|
|
})
|
|
|
|
test('E1: 未选择日期直接排盘 → 不生成结果(守护逻辑)', async ({ page }) => {
|
|
await page.locator('[data-test="generate-btn"]').click()
|
|
await page.waitForTimeout(1000)
|
|
await expect(page.locator('.chart-result')).not.toBeVisible()
|
|
})
|
|
|
|
test('E2: 输入未知出生地 → 显示未找到提示', async ({ page }) => {
|
|
await setBirthPlace(page, '不存在的城市XYZ')
|
|
await expect(page.locator('.location-hint.not-found')).toBeVisible()
|
|
})
|
|
})
|