Files
everything-is-suitable/everything-is-suitable-uniapp/e2e/journeys/navigation-journey.spec.ts
T
zhangxiang 810081ac0a feat: 小程序端 UI 优化与纯客户端化改造
- 移除微信订阅推送功能(云函数/订阅管理页),回归纯客户端零后端架构
- 新增今日黄历默认展示卡片 TodayAlmanacCard(9 语言翻译)
- i18n 修复:启用 globalInjection 修复 $t 未注入,插值消息全部改为
  Messages Functions 适配小程序端(63 处)
- 修复底部导航切换失效与运势页数据不刷新
- 统一设计令牌(深褐主色 + 印红强调色),组件 UI 规范重构
- 图标 iconfont 化(FontAwesome 子集化,修复 Android 豆腐块)
- 新增 postcss-px2rpx 机型自适应(仅 mp-weixin 构建生效)
- 新增 5 个用户旅程 E2E 测试(31 用例)与验收报告
- 补充微信小程序项目配置(appid)
2026-08-28 07:51:02 +08:00

92 lines
3.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { test, expect } from '@playwright/test'
import { setDateInput, gotoPage } from './helpers'
/**
* 用户旅程 J-NAVEdge cases):跨页导航与状态保持旅程
*
* 用户目标:在三大功能页(黄历/排盘/运势)之间顺畅切换,且排盘数据跨页保持
*
* 旅程步骤:
* 1. 进入黄历页(首页),底部导航可见
* 2. 通过底部导航切换到排盘页
* 3. 通过底部导航切换到运势页
* 4. 导航往返(排盘 → 运势 → 黄历)
* 5. 排盘数据跨页保持(排盘后运势页可读取)
*
* 异常恢复场景:
* E1. 直接访问不存在的路由 → 应用可正常渲染(hash 路由容错)
*/
test.describe('旅程 J-NAV:跨页导航与状态保持旅程', () => {
test.describe.configure({ mode: 'serial' })
test('STEP 1: 进入黄历页,底部导航三入口可见', async ({ page }) => {
await gotoPage(page, '/pages/almanac-search/index')
await expect(page.locator('.bottom-navigation')).toBeVisible()
await expect(page.locator('.nav-item')).toHaveCount(3)
await expect(page.locator('.page-title')).toBeVisible()
})
test('STEP 2: 通过底部导航切换到排盘页', async ({ page }) => {
await gotoPage(page, '/pages/almanac-search/index')
await page.locator('.nav-item').nth(1).click()
await page.waitForTimeout(1500)
expect(page.url()).toContain('/#/pages/ziwei/index')
await expect(page.locator('[data-test="birth-form"]')).toBeVisible()
// 目标页必须有底部导航(回归防护:三 tab 页均需底部导航)
await expect(page.locator('.bottom-navigation')).toBeVisible()
await expect(page.locator('.nav-item')).toHaveCount(3)
})
test('STEP 3: 通过底部导航切换到运势页', async ({ page }) => {
await gotoPage(page, '/pages/almanac-search/index')
await page.locator('.nav-item').nth(2).click()
await page.waitForTimeout(1500)
expect(page.url()).toContain('/#/pages/fortune/index')
await expect(page.locator('[data-test="fortune-tabs"]')).toBeVisible()
// 目标页必须有底部导航
await expect(page.locator('.bottom-navigation')).toBeVisible()
await expect(page.locator('.nav-item')).toHaveCount(3)
})
test('STEP 4: 导航往返(排盘 → 运势 → 黄历)', async ({ page }) => {
await gotoPage(page, '/pages/ziwei/index')
await gotoPage(page, '/pages/fortune/index')
await expect(page.locator('[data-test="fortune-tabs"]')).toBeVisible()
await gotoPage(page, '/pages/almanac-search/index')
await expect(page.locator('.page-title')).toBeVisible()
await expect(page.locator('.bottom-navigation')).toBeVisible()
})
test('STEP 5: 排盘数据跨页保持', async ({ page }) => {
// 排盘页生成排盘(写入 localStorage
await gotoPage(page, '/pages/ziwei/index')
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 gotoPage(page, '/pages/fortune/index')
// 运势页能读取已持久化的排盘数据:不应显示"请先排盘"提示,且运势交互区正常渲染
await expect(page.locator('.no-chart-hint')).toHaveCount(0)
await expect(page.locator('.daily-fortune')).toBeVisible()
})
test('E1: 直接访问不存在的路由 → 应用正常渲染(hash 容错)', async ({ page }) => {
await page.goto('/#/pages/nonexistent/index')
await page.waitForLoadState('networkidle')
await page.waitForTimeout(1000)
// 应用不白屏,可正常导航回黄历页
await gotoPage(page, '/pages/almanac-search/index')
await expect(page.locator('.page-title')).toBeVisible()
})
})