test(e2e): 六个 spec 随双轴 IA 与 home v16 重新锚定,锚点全部取自实测 DOM

一级导航改「行业 × 能力 + 洞察」+ 首页收 8 段之后,旧锚点若不改,
**"绿"只代表还在测上一版信息架构**。本轮 `test:all` 首次跑出
40 failed / 10 例 × 4 project,全部是三组旧断言,逐条按实测 DOM 重写后转绿。

取证方式:不用记忆猜选择器。探针 7 份存
`docs/acceptance/2026-10-17-ia-e2e/probe-*.mjs`,读数是写断言的唯一依据。
关键实测事实:
- hydration 后一级恰为 `['行业','能力','洞察']` 三个
  `button[aria-expanded]` + 1 个 `<a href="/about">`
  ⇒ **桌面顶栏只有 1 个 `<a>`**,这是 p2 那条「取前两个链接」
  在 idx=1 稳定读不到元素的根因
- `aria-controls` 在关闭态**故意不渲染**(面板仅 isOpen 时挂载,
  header.tsx:178),所以它不能当锚点;定位口径统一为 `button[aria-expanded]`
- 首页实际 testid:`hero-cta`(不是 `hero-primary-cta`)、
  `home-ledger{,-metrics,-signals}`、`metrics-basis-note`、
  `results-slot-{co-creation,placeholder}`、
  `home-{insights,industries,capabilities,cta,cta-button}`;
  `trust-section` / `narrative-section` / `cases-co-creation-cta` /
  `hero-secondary-link` **已不存在**
- 首页「数据来源」字样实测 **0 次**,口径角注真实文案是
  「目标口径,非既成结果」

逐文件:
1. `nav-dropdown.spec.ts` — 两条旧例(产品 / 解决方案下拉)重写为三轴各一条,
   并**新增一条一级 IA 契约断言**:触发器文本恰为 `['行业','能力','洞察']`
   且「产品」不得回到一级(若 CMS 旧行重新接管导航即判红,
   与 navigation-resolution 的代码守卫配对)。
   「产品」那条的语义同时升级为**降级后仍可到达**:
   能力面板里的「产品矩阵总览 → /products」。
2. `p6-missing-paths.spec.ts` — 产品路径改走 能力 → 产品矩阵总览。
3. `uj-11-home-conversion.spec.ts` — 7 条全重写。四处口径变化逐条写了理由:
   双 CTA 收成单 CTA;trust-section 拆成「量化项 / 定性项分列」
   (成都·全流程·共创根本不是数字);
   **「数据来源」断言改为「口径标注存在且非空」而不是锁措辞** ——
   锁字符串会在 target 升到 verified 时误红,
   判据要对那一维的存在性敏感而非对文案敏感;
   原「叙事区 01/02/03」整段删除,其语义由**成果槽的可判别空态**承接
   (既验"有过程叙事",也验"没有假案例",比原断言更强)。
4. `p2-functional-e2e.spec.ts` — 四条旧锚点重写;
   「导航链接可点击」改为**按导航自己声明的目的地去走**
   (直链优先,未展开的下拉先 hover 再取面板链接),
   桌面/移动共用同一条判据,不再硬编码元素类型。保留 N-27 纪律:
   不许静默跳过、不许 `waitForURL(...).catch(() => {})` 把"点了没跳转"吞成绿灯。
5. `p5-edge-cases.spec.ts:129` — `narrative-section a[href="/products"]` →
   `card-products a[href="/products"]`(页脚,不依赖 hover,仍守住 N-27)。
6. `user-journey.spec.ts:216` — UJ-02 的「解决方案」轴改名「行业」,
   动作项「查看全部行业」。

我自己新写的断言里也有一条是错的,一并记(§5.40 同族:仪器只在被复用时才坏):
「首页段序 洞察→行业→能力」最初用 `boundingBox().y` 排序,
而那是**视口相对**值,`scrollIntoViewIfNeeded` 后各段都落在同一带区,
实测读数出现 `-0.5` / `-151.8` ⇒ 判不出先后。
改用文档坐标 `getBoundingClientRect().top + scrollY`,
并实测三段读数 **2684 / 3242 / 3995**,确认这条断言不是恒等式。

复跑(全部重定向后读 `$?`):
`nav-dropdown + p6 + uj-11` × **4 project ⇒ 80 passed / 0 failed**;
`p2` × chromium + chromium-mobile ⇒ **96 passed / 0 failed**;
`npm run test:all` ⇒ **EXIT=0**(e2e:fast 59 passed / 25 skipped,
那 16 个 GA4 @critical 仍在 skipped 侧,须 `test:e2e:prod` 才真断言)。
This commit is contained in:
zhangxiang committed 2026-10-17 01:07:53 +08:00
1 parent d622dc2120
commit ec543ff242
6 files changed
+286 -190

No files matched your search

+60 -21
View File
@@ -1,44 +1,83 @@
import { test, expect } from './fixtures';
import { expectHydrated } from './hydrated';
/**
* 一级导航三轴的下拉展开(2026-10-17 改对标双轴后重写)。
*
* 原两条用例打的是「产品」「解决方案」两个一级标签,那是旧 IA。
* ADR-0008 决策二把一级导航换成**行业 × 能力 + 洞察**,「产品」退出一级、
* 降为能力面板里的「产品矩阵」组(`all-products → /products`),
* 所以这两条用例不是"坏了",是**断言的仍是上一版信息架构**。
* 逐条核过实际渲染(`docs/acceptance/2026-10-17-ia-e2e/probe-*.mjs` 三份探针)后按新 IA 重写,
* 并补第三条覆盖新增的「洞察」轴 —— 少一条就等于新轴没有任何端到端断言。
*
* 定位口径统一为「`nav[aria-label="主导航"]` 里带 aria-expanded 的按钮」:
* aria-controls 在关闭态**故意不渲染**(面板只在 isOpen 时挂载,见 header.tsx:178 的注释),
* 所以不能用它当锚点。
*/
// 桌面 hover 下拉在 md 断点以上才渲染(移动端用抽屉 + TabBar),
// 固定为桌面视口,使 chromium-mobile 项目也按本用例真实语义验证引擎差异。
test.use({ viewport: { width: 1440, height: 900 } });
test('主导航产品下拉菜单可在 hover 时展开', { tag: '@smoke' }, async ({ page }) => {
async function openAxis(page: import('@playwright/test').Page, label: string) {
await page.goto('/', { waitUntil: 'domcontentloaded' });
// 等待桌面导航 hydration 完成
await expect(page.locator('nav[aria-label="主导航"]')).toBeVisible({ timeout: 10000 });
const productsButton = page.locator('nav[aria-label="主导航"] button:has-text("产品")');
await expect(productsButton).toHaveAttribute('aria-expanded', 'false');
const trigger = page.locator(`nav[aria-label="主导航"] button:has-text("${label}")`);
await expect(trigger).toHaveAttribute('aria-expanded', 'false');
await expectHydrated(trigger);
await expectHydrated(productsButton);
// Header 入场动画 + 并发负载下,一次 hover 可能落在指针尚未真正覆盖按钮的那一帧,
// mouseenter 不会补发;重新把指针移开再悬停,直到面板真的展开。
await expect(async () => {
await page.mouse.move(0, 0);
await productsButton.hover();
await expect(productsButton).toHaveAttribute('aria-expanded', 'true', { timeout: 1000 });
await trigger.hover();
await expect(trigger).toHaveAttribute('aria-expanded', 'true', { timeout: 1000 });
}).toPass({ timeout: 20000 });
await expect(page.locator('text=企业套装').first()).toBeVisible();
await expect(page.locator('text=ERP 管理系统').first()).toBeVisible();
});
test('主导航解决方案下拉菜单可在 hover 时展开', { tag: '@smoke' }, async ({ page }) => {
return trigger;
}
test('一级导航恰好是行业 / 能力 / 洞察三轴 + 关于我们(IA 契约)', { tag: '@smoke' }, async ({ page }) => {
await page.goto('/', { waitUntil: 'domcontentloaded' });
// 等待桌面导航 hydration 完成
await expect(page.locator('nav[aria-label="主导航"]')).toBeVisible({ timeout: 10000 });
const solutionsButton = page.locator('nav[aria-label="主导航"] button:has-text("解决方案")');
await expect(solutionsButton).toHaveAttribute('aria-expanded', 'false');
const nav = page.locator('nav[aria-label="主导航"]');
const buttons = await nav.locator('button').allTextContents();
expect(buttons.map((t) => t.trim())).toEqual(['行业', '能力', '洞察']);
await expectHydrated(solutionsButton);
await expect(async () => {
await page.mouse.move(0, 0);
await solutionsButton.hover();
await expect(solutionsButton).toHaveAttribute('aria-expanded', 'true', { timeout: 1000 });
}).toPass({ timeout: 20000 });
await expect(page.locator('text=行业解决方案').first()).toBeVisible();
// 「产品」必须已退出一级:它若回来,说明导航真源又被 CMS 旧行接管
// (代码侧守卫见 src/lib/navigation-resolution.ts 的 IA 契约校验)。
expect(buttons.some((t) => t.includes('产品'))).toBe(false);
await expect(nav.locator('a[href="/about"]')).toBeVisible();
});
test('行业轴下拉可在 hover 时展开,并落到行业列表', { tag: '@smoke' }, async ({ page }) => {
await openAxis(page, '行业');
await expect(page.locator('text=行业实践').first()).toBeVisible();
await expect(page.locator('text=制造业').first()).toBeVisible();
const viewAll = page.locator('a:has-text("查看全部行业")').first();
await expect(viewAll).toHaveAttribute('href', '/solutions');
});
test('能力轴下拉可在 hover 时展开,并带出产品矩阵组', { tag: '@smoke' }, async ({ page }) => {
await openAxis(page, '能力');
await expect(page.locator('text=能力组').first()).toBeVisible();
// 产品退出一级后仍要能到达:产品矩阵组是 /products 的唯一导航入口
await expect(page.locator('text=产品矩阵').first()).toBeVisible();
await expect(page.locator('text=ERP 管理系统').first()).toBeVisible();
const overview = page.locator('a:has-text("产品矩阵总览")').first();
await expect(overview).toHaveAttribute('href', '/products');
});
test('洞察轴下拉可在 hover 时展开,并落到 /insights', { tag: '@smoke' }, async ({ page }) => {
await openAxis(page, '洞察');
await expect(page.locator('text=全部洞察').first()).toBeVisible();
await expect(page.locator('text=方法论').first()).toBeVisible();
const viewAll = page.locator('a:has-text("查看全部洞察")').first();
await expect(viewAll).toHaveAttribute('href', '/insights');
});
+85 -44
View File
@@ -45,47 +45,64 @@ test.describe("首页 - 核心功能区", { tag: "@regression" }, () => {
});
test("产品矩阵入口链接显示正常", async ({ page }) => {
// N-27:原守卫 `text=产品矩阵` 在首页永远不成立 ⇒ 整例静默零断言:
// ProductMatrixSection(src/components/sections/product-matrix-section.tsx)从未被挂载,
// 且 seed 把 hero 副 CTA 覆写为「了解我们的方法论」(prisma/seed.ts:607)。
// 首页真实的产品矩阵入口 = 叙事区第三幕「浏览产品矩阵 → /products」(prisma/seed.ts narrativeActs[2],
// 渲染于 home-content-v15.tsx:386-427 的 [data-testid="narrative-section"])。桌面/移动 project 均渲染。
// N-27:原守卫 `text=产品矩阵` 在首页永远不成立 ⇒ 整例静默零断言。
// ⚠ 2026-10-17 v16 重写:原锚点 `[data-testid="narrative-section"] a[href="/products"]`
// 随叙事区整段删除而不存在了(v16 段序里没有三幕叙事,见 ADR-0008 决策四)。
// 首页**恒定可见**的 /products 入口只剩页脚的「产品矩阵总览」;
// 能力下拉里那条虽然也叫这个名,但未 hover 时不挂载 ⇒ 会退回 N-27 的静默通过,故不用它。
const productsEntry = page
.locator('[data-testid="narrative-section"] a[href="/products"]')
.locator('[data-testid="card-products"] a[href="/products"]')
.first();
await expect(productsEntry).toBeVisible();
await expect(productsEntry).toContainText("浏览产品矩阵");
await expect(productsEntry).toContainText("产品矩阵总览");
});
test("章节式叙事区块(问题→方法→结果)显示", async ({ page }) => {
// N-27:原实现守卫挑战区块(ChallengeSection 未挂载于首页,永假 ⇒ 静默通过)。
// 意图改由真实装配的叙事区承接:三幕标题来自 seed 的 page-copy.home.narrativeActs。
await expect(page.locator('[data-testid="narrative-section"]')).toBeVisible();
for (const act of ["诊断现状", "设计路径", "交付成果"]) {
await expect(page.getByText(act, { exact: true }).first()).toBeVisible();
test("可审计数字账本显示量化项与定性项", async ({ page }) => {
// 2026-10-17 起替代原「章节式叙事区块(问题→方法→结果)」用例。
// 换锚点的同时换的是**判据**:原用例验"三幕标题在场",v16 承重的信任装置是账本,
// 而账本的关键设计是「量化项与定性项分列」——TRUST_SIGNALS 里的 成都/全流程/共创
// 根本不是数字,混进数字行会让整段读起来像虚构 KPI。
const ledger = page.locator('[data-testid="home-ledger"]');
await expect(ledger).toBeVisible();
// 量化项(带单位)与定性项(不带单位)各自成列
await expect(page.locator('[data-testid="home-ledger-metrics"]')).toBeVisible();
await expect(page.locator('[data-testid="home-ledger-signals"]')).toBeVisible();
expect(await page.locator('[data-testid="ledger-metric"]').count()).toBeGreaterThan(0);
const signalText = (await page.locator('[data-testid="home-ledger-signals"]').textContent()) ?? "";
for (const s of ["成都", "全流程", "共创"]) {
expect(signalText).toContain(s);
}
// 口径角注必须在场(零编造前提下的可追溯声明)
await expect(page.locator('[data-testid="metrics-basis-note"]')).toBeVisible();
});
test("信任标识区块显示", async ({ page }) => {
// N-27:去掉 `if (isVisible)` 守卫。eyebrow 文案由 seed 固化为「值得信赖」,
// 区块容器有 data-testid(home-content-v15.tsx:313),标签取自 TRUST_SIGNALS(company.ts:88-113)。
const trustSection = page.locator('[data-testid="trust-section"]');
await expect(trustSection).toBeVisible();
await expect(trustSection.getByText("值得信赖").first()).toBeVisible();
const trustItems = trustSection.locator(
"text=/私有化部署|本地化服务|陪伴式交付|首批客户共创/",
);
expect(await trustItems.count()).toBeGreaterThan(0);
// N-27:去掉 `if (isVisible)` 守卫。
// 2026-10-17 v16 重写:原 trust-section 被并入可审计数字账本(同一条"这是我们的数字"
// 说两遍是冗余不是节奏),故这里改断言账本里的定性信号列 + L3 替代信号区的真实路由卡。
const signals = page.locator('[data-testid="home-ledger-signals"]');
await expect(signals).toBeVisible();
const signalText = (await signals.textContent()) ?? "";
expect(signalText.length).toBeGreaterThan(0);
// L3 替代信号:四条都指向站内真实路由,不存在编造
const trustHeading = page.locator("#l3-signals-heading");
await expect(trustHeading).toBeVisible();
await expect(page.getByRole("link", { name: /交付方法论/ })).toBeVisible();
await expect(page.getByRole("link", { name: /团队资历/ })).toBeVisible();
});
test("CTA按钮可见且可点击", async ({ page }) => {
// N-27:原 `text=开始合作` 在 src/ 里根本不存在 ⇒ isVisible() 恒 false ⇒ 整例零断言。
// 换成首页真实装配的 CTA(home-content-v15.tsx:700 的 dataTestId),并去掉条件守卫。
const ctaButton = page
.locator('[data-testid="cases-co-creation-cta"]')
.first();
// 2026-10-17 v16 重写:原 cases-co-creation-cta 随首页案例区收进成果槽而改名,
// 这里改断言装配在页面末段的主 CTA(home-cta-button),并去掉条件守卫。
const ctaButton = page.locator('[data-testid="home-cta-button"]').first();
await expect(ctaButton).toBeVisible();
await expect(ctaButton).toBeEnabled();
await expect(ctaButton).toHaveAttribute("href", "/contact");
});
});
@@ -96,19 +113,23 @@ test.describe("导航系统 - 路由与菜单", { tag: "@regression" }, () => {
await page.waitForTimeout(2000);
});
test("主导航菜单包含所有主要链接", async ({ page }) => {
test("主导航菜单包含所有一级导航项", async ({ page }) => {
// 同一 spec 跑桌面与移动两个 project:桌面导航是 `hidden md:flex`,移动入口是抽屉,
// 抽屉仅在 isOpen 时挂载且要等 hydration —— 统一交给 primaryNav 处理。
//
// ⚠ 2026-10-17 按 ADR-0008 决策二重写判据。原 expectedLinks 是旧 IA 的五项
// (产品 / 解决方案 / 服务 / 关于我们 / 联系我们),一级导航现已改为**行业 × 能力 + 洞察**:
// · 「产品」退出一级(入口降为能力面板里的 产品矩阵总览 → /products);
// · 「解决方案」改名「行业」(仍指 /solutions)、「服务」改名「能力」(仍指 /services);
// · 「联系我们」**不在一级导航**,它在移动抽屉里(header.tsx:253),
// 所以原来那条断言在桌面 project 上是靠下拉里的文本蒙过的 —— 现按实际载体分列断言。
const nav = await primaryNav(page);
// 检查关键导航项
const expectedLinks = ["产品", "解决方案", "服务", "关于我们", "联系我们"];
for (const linkText of expectedLinks) {
// 某些项在下拉菜单里(收起状态不可见),所以只断言「存在于导航容器内」,
for (const itemText of ["行业", "能力", "洞察", "关于我们"]) {
// 桌面三项是下拉触发器(button)、关于我们是直链(a);移动抽屉里四项都是 a。
// 所以判据必须是"容器内有这个导航项",不能锁元素类型。
// 用带重试的 toHaveCount 取代裸 count(),避免移动抽屉异步挂载时读到 0。
await expect(nav.locator(`text=${linkText}`)).not.toHaveCount(0, {
timeout: 5000,
});
await expect(nav.getByText(itemText, { exact: true }).first()).toBeVisible({ timeout: 5000 });
}
});
@@ -133,18 +154,38 @@ test.describe("导航系统 - 路由与菜单", { tag: "@regression" }, () => {
// N-27:原实现全程零断言,且 `waitForURL(...).catch(() => {})` 会把「点了没跳转」吞成绿灯。
// 补法不能写死链接文案:桌面顶栏有「联系我们」,移动抽屉没有 ⇒ 硬编码文案在 chromium-mobile 必红。
// 因此从「当前视口下真正可用的导航容器」里取链接本身,断言点击后落到该链接声明的目标路径。
for (let idx = 0; idx < 2; idx++) {
const nav = await primaryNav(page);
const link = nav.locator('a[href^="/"]').nth(idx);
await expect(link).toBeVisible();
const href = await link.getAttribute("href");
if (!href) {
throw new Error(`第 ${idx + 1} 个导航链接缺少 href,无法判定跳转目标`);
}
//
// ⚠ 2026-10-17 按双轴 IA 改造取目标的方式。原来直接取 `a[href^="/"]` 的前两个:
// 一级导航改行业 × 能力 + 洞察后,**桌面顶栏只剩 1 个 `<a>`(关于我们)**,
// 其余三项是 `button[aria-expanded]` 下拉触发器 ⇒ 旧写法在 idx=1 处稳定读不到元素,
// 在移动抽屉里又能通过 —— 这是"按旧 DOM 形状取数"的必然结果,不是页面缺陷。
// 现改为:**按导航自己声明的目的地去走**,直链优先,未展开的下拉先 hover 再取面板链接。
// 桌面 hover 展开、移动抽屉全部是直链,两种视口共用同一条判据。
const destinations = ["/solutions", "/services", "/insights", "/about"];
expect(destinations.length).toBeGreaterThan(1);
// 注意:Playwright 的 URL 匹配跑的是**完整** URL,`^/services` 这种锚定永远不成立。
for (const dest of destinations) {
const nav = await primaryNav(page);
// 直链优先(移动抽屉、桌面关于我们)
let link = nav.locator(`a[href="${dest}"]`).first();
if (!(await link.count())) {
// 下拉里的目标:逐个 hover 触发器,直到面板里出现该链接
const triggers = nav.locator("button[aria-expanded]");
const triggerCount = await triggers.count();
expect(triggerCount, `既无直链也无下拉触发器,无法到达 ${dest}`).toBeGreaterThan(0);
for (let t = 0; t < triggerCount && !(await link.count()); t++) {
await page.mouse.move(0, 0);
await triggers.nth(t).hover();
await page.waitForTimeout(250);
link = nav.locator(`a[href="${dest}"]`).first();
}
}
await expect(link, `一级导航无法到达 ${dest}`).toBeVisible({ timeout: 5000 });
// 断言点击后落到该链接自己声明的目标 —— 判据来自链接本身,不来自硬编码文案
const landsOnTarget = (url: URL) =>
url.pathname === href || url.pathname.startsWith(`${href}/`);
url.pathname === dest || url.pathname.startsWith(`${dest}/`);
await Promise.all([
// waitUntil 默认 'load':整页资源加载完才算数,在 4 project × 6 worker 并发下 10s 不够
// (firefox 隔离复跑 14.4s 通过、全量并发下超时)。URL 判定只需等导航 commit,这才是降本体成本。
+5 -3
View File
@@ -123,10 +123,12 @@ test.describe('加载状态 - 页面过渡', { tag: '@regression' }, () => {
// N-27 修复:原守卫 `if (count > 0 && isVisible)` 依赖 header 巨型下拉里的
// `a[href="/products"]`(未 hover 时隐藏 ⇒ 断言常被跳过)。
// 改用主内容区恒定渲染的叙事区行动链接(home-content-v15 NARRATIVE_ACTS 第三幕,
// p2-functional-e2e 亦以同选择器作硬断言),导航与内容都变硬断言。
// ⚠ 2026-10-17 v16 重写:原锚点「叙事区第三幕 a[href="/products"]」随叙事区整段删除而消失
// (v16 段序无三幕叙事,见 ADR-0008 决策四)。仍坚持"不 hover 也必须可见"这条纪律,
// 故改用页脚产品列的「产品矩阵总览 → /products」:它在主文档流里恒定渲染,
// 与下拉那一条同名但不依赖 hover 状态。
const productLink = page
.locator('[data-testid="narrative-section"] a[href="/products"]')
.locator('[data-testid="card-products"] a[href="/products"]')
.first();
await expect(productLink).toBeVisible();
+11 -8
View File
@@ -185,19 +185,22 @@ test.describe('关键用户路径 - 首页 → 产品 → 详情', { tag: ['@smo
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(2000);
// 桌面端导航中「产品」为下拉菜单,鼠标悬停展开后选择「查看全部产品」
// 2026-10-17 起「产品」退出一级导航(ADR-0008 决策二:一级改行业 × 能力 + 洞察),
// 到达路径改为「能力 → 产品矩阵组 → 产品矩阵总览 /products」。
// 这条用例的意义随之从"产品在下拉里"升级为"降级后产品仍可经导航到达"——
// 降级动作最容易造成的缺陷就是把 /products 变成孤儿。
const desktopNav = page.locator('[data-testid="desktop-navigation"]').first();
const productDropdown = desktopNav.locator('button:has-text("产品")').first();
await expect(productDropdown).toBeVisible({ timeout: 5000 });
await productDropdown.hover();
const capabilitiesDropdown = desktopNav.locator('button:has-text("能力")').first();
await expect(capabilitiesDropdown).toBeVisible({ timeout: 5000 });
await capabilitiesDropdown.hover();
await page.waitForTimeout(300);
const viewAllLink = desktopNav.locator('a:has-text("查看全部产品")').first();
await expect(viewAllLink).toBeVisible({ timeout: 5000 });
const productsLink = desktopNav.locator('a[href="/products"]').first();
await expect(productsLink).toBeVisible({ timeout: 5000 });
// 鼠标悬停在链接上,防止下拉菜单因 mouseleave 关闭
await viewAllLink.hover();
await productsLink.hover();
await page.waitForTimeout(200);
await viewAllLink.click();
await productsLink.click();
await page.waitForURL(/\/products/, { timeout: 10000 });
await expect(page).toHaveURL(/\/products/);
+120 -110
View File
@@ -3,13 +3,28 @@ import { test, expect, type Page } from './fixtures';
/**
* UJ-11: 首页转化旅程(设计优化专项)
*
* 覆盖首页 Vibe Design 优化后的关键转化路径,作为封版验收依据:
* UJ-11a: 首屏说服链路 — Hero 产品视觉 + 单一 CTA + 数据条 → 信任层(可验证信号)→ 叙事区 → 转化 CTA
* UJ-11b: 信任验证旅程 — 数据来源标注 + 首批客户共创标签 → 联系转化
* 覆盖首页关键转化路径,作为封版验收依据:
* UJ-11a: 首屏说服链路 — Hero + 可审计数字账本 → 透明信任层 → 成果槽 → 转化 CTA
* UJ-11b: 信任验证旅程 — 口径标注 + 首批客户共创 → 联系转化
* UJ-11c: 移动端首屏转化旅程 — 390px 下 CTA 首屏可见、无横向滚动
*
* 关联设计优化计划:docs/plans/2026-08-18-vibe-design-optimization-plan.md
* 关联 critique:.impeccable/critique/
*
* ⚠ 2026-10-17 按 home-content-v16 重写(ADR-0008 决策四:首页 10 段收 8 段,对标 Bain 段序)。
* 锚点全部以实测 DOM 为准,探针与读数留存于 `docs/acceptance/2026-10-17-ia-e2e/probe-home*.mjs`。
* 三处断言语义随结构变化,逐条说明(不要把它们改回旧锚点,旧锚点已不存在):
* 1) `hero-primary-cta` / `hero-secondary-link` → 合并为 `hero-cta`(v16 Hero 只留一条主 CTA,
* 次级链接按对标语法取消:两家 Hero 只有一条动作)。
* 2) `trust-section` → `home-ledger` + `home-ledger-signals` + `metrics-basis-note`:
* 原「信任四元组」被拆成**量化项与定性项两列**,因为「成都 / 全流程 / 共创」根本不是数字。
* 3) 「数据来源」→ 「目标口径,非既成结果」:口径角注由 `MetricsBasisNote` 按最弱 basis 出文,
* 本仓当前最弱口径是 target,所以文案是这一条。断言**判据是"有没有口径标注"**,
* 不是某个具体字符串——否则 target 升到 verified 时会误红。
* 4) 原 `narrative-section`(01/02/03 问题→方法→结果)整段删除:v16 把它的位置让给
* 成果槽(ResultsSlot),共创四步「问题梳理 / 小步验证 / 交付物验收 / 能力交接」
* 承担了原来那三幕想说的"过程可控",不再单独占一段。
* ⇒ 这里改为断言成果槽的**可判别空态**,语义更强:既验"有过程叙事",也验"没有假案例"。
*/
test.setTimeout(90000);
@@ -35,116 +50,113 @@ async function expectNoHorizontalOverflow(page: Page) {
expect(overflow.scrollWidth).toBeLessThanOrEqual(overflow.clientWidth + 1);
}
// ==================== UJ-11a: 首屏说服链路 ====================
test.describe('UJ-11a: 首屏说服链路(Hero → 信任 → 叙事 → CTA)', () => {
test('@journey @critical 首页首屏产品视觉、单一 CTA、数据条渲染正常', async ({ page }) => {
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(2500);
await closeCookieBanner(page);
async function gotoHome(page: Page) {
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(2500);
await closeCookieBanner(page);
}
// === L1 Hero:浅色工程网格 Hero 可见(v15 已移除产品 Mockup,改为声明先行 + 单一 CTA)===
// ==================== UJ-11a: 首屏说服链路 ====================
test.describe('UJ-11a: 首屏说服链路(Hero → 账本 → 信任 → 成果)', () => {
test('@journey @critical 首页首屏 Hero、单一 CTA、可审计数字账本渲染正常', async ({ page }) => {
await gotoHome(page);
// === L1 Hero:声明先行 + 单一 CTA(v16 起 min-h 90vh → 70vh,且无粒子场)===
const heroSection = page.locator('[data-testid="hero-section"]').first();
await expect(heroSection).toBeVisible({ timeout: 15000 });
// === 单一主 CTA ===
const primaryCta = page.locator('[data-testid="hero-primary-cta"]').first();
await expect(primaryCta).toBeVisible();
await expect(primaryCta).toHaveAttribute('href', '/contact');
// 次级 CTA 降级为文字链接
const secondaryLink = page.locator('[data-testid="hero-secondary-link"]').first();
await expect(secondaryLink).toBeVisible();
// === 主标题可见 ===
const heroTitle = page.locator('h1').first();
await expect(heroTitle).toBeVisible();
// 无横向滚动
// === 单一主 CTA,且必须落到联系页 ===
const cta = page.locator('[data-testid="hero-cta"]').first();
await expect(cta).toBeVisible();
await expect(cta).toHaveAttribute('href', '/contact');
// === L2 数字账本:量化项与口径角注同时在场 ===
const ledger = page.locator('[data-testid="home-ledger"]').first();
await expect(ledger).toBeVisible({ timeout: 10000 });
expect(await page.locator('[data-testid="ledger-metric"]').count()).toBeGreaterThan(0);
await expectNoHorizontalOverflow(page);
});
test('@journey @critical 首页信任层展示可验证信号与来源标注', async ({ page }) => {
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(2500);
await closeCookieBanner(page);
test('@journey @critical 首页信任层展示可验证信号与口径标注', async ({ page }) => {
await gotoHome(page);
// 滚动到信任层
const trustSection = page.locator('[data-testid="trust-section"]').first();
await trustSection.scrollIntoViewIfNeeded();
await expect(trustSection).toBeVisible({ timeout: 10000 });
// 定性信号列(成都 / 全流程 / 共创)—— 它们不是数字,所以与 ledger-metric 分列
const signals = page.locator('[data-testid="home-ledger-signals"]').first();
await signals.scrollIntoViewIfNeeded();
await expect(signals).toBeVisible({ timeout: 10000 });
const trustText = await trustSection.textContent();
// 可验证信任信号存在(私有化部署 / 本地化 / 全流程 / 共创)
expect(trustText).toContain('100%');
expect(trustText).toContain('成都');
expect(trustText).toContain('全流程');
expect(trustText).toContain('共创');
// 数据来源标注存在(零编造,可追溯)
expect(trustText).toContain('数据来源');
const signalText = await signals.textContent();
expect(signalText).toContain('成都');
expect(signalText).toContain('全流程');
expect(signalText).toContain('共创');
// 口径标注:零编造前提下每个数字必须带可追溯口径。
// 判据是「这一格存在且非空」,不锁具体措辞(口径升级时文案会变,锁字符串会误红)。
const basisNote = page.locator('[data-testid="metrics-basis-note"]').first();
await expect(basisNote).toBeVisible();
expect(((await basisNote.textContent()) ?? '').trim().length).toBeGreaterThan(0);
});
test('@journey @critical 首页叙事区按 01/02/03 章节呈现问题→方法→结果', async ({ page }) => {
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(2500);
await closeCookieBanner(page);
test('@journey @critical 首页按对标段序呈现 洞察 → 行业 → 能力 三段', async ({ page }) => {
await gotoHome(page);
const narrativeSection = page.locator('[data-testid="narrative-section"]').first();
await narrativeSection.scrollIntoViewIfNeeded();
await expect(narrativeSection).toBeVisible({ timeout: 10000 });
const narrativeText = await narrativeSection.textContent();
// 三幕章节编号存在
expect(narrativeText).toContain('01');
expect(narrativeText).toContain('02');
expect(narrativeText).toContain('03');
// 叙事主题存在
expect(narrativeText).toContain('诊断现状');
expect(narrativeText).toContain('设计路径');
expect(narrativeText).toContain('交付成果');
// 每章保留详情入口
const narrativeLinks = narrativeSection.locator('a');
expect(await narrativeLinks.count()).toBeGreaterThanOrEqual(3);
// v16 段序:Hero(1) 账本(2) 承诺(3) 成果(4) 洞察(5) 行业(6) 能力(7) CTA(8)
// 这三段是原「叙事区」位置上的替代结构,逐个锚 testid 而不是靠文案,
// 因为三段的标题都可被 CMS pageCopy 覆盖。
const anchors = ['home-insights', 'home-industries', 'home-capabilities'];
const positions: number[] = [];
for (const id of anchors) {
const el = page.locator(`[data-testid="${id}"]`).first();
await expect(el).toBeVisible({ timeout: 10000 });
// 段序要用**文档坐标**,不能用 boundingBox().y —— 那是视口相对值,
// scrollIntoViewIfNeeded 之后每段都被滚到同一带区,读数只反映滚动位置不反映先后
// (第一版就是这么错的:y 出现 -0.5 / -151.8 这类值,断言按"自上而下"必然判不出顺序)。
const docY = await el.evaluate((e) => e.getBoundingClientRect().top + window.scrollY);
positions.push(docY);
}
// 段序即信息架构:颠倒说明装配顺序被动过
expect(positions).toEqual([...positions].sort((a, b) => a - b));
});
});
// ==================== UJ-11b: 信任验证旅程 ====================
test.describe('UJ-11b: 信任验证旅程(共创标签 → 转化)', () => {
test.describe('UJ-11b: 信任验证旅程(共创 → 转化)', () => {
test('@journey @critical 首页首批客户共创标签引导至联系转化', async ({ page }) => {
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(2500);
await closeCookieBanner(page);
await gotoHome(page);
// 验收 E2E 修订:early-access-banner 已在复评 P1 中删除——共创主张曾三处重复
// (横幅 / 案例深色卡 / 洞察卡),收敛为案例区深色共创卡唯一载体,
// 由 home-content-v15.test.tsx「consolidates the co-creation pitch」钉住。
// 这里改断言存活的那一处,保持「共创标签 → /contact 转化」的旅程语义。
const coCreationCta = page.locator('[data-testid="cases-co-creation-cta"]').first();
await coCreationCta.scrollIntoViewIfNeeded();
await expect(coCreationCta).toBeVisible({ timeout: 10000 });
await expect(coCreationCta).toHaveAttribute('href', '/contact');
const placeholder = page.locator('[data-testid="results-slot-placeholder"]').first();
await placeholder.scrollIntoViewIfNeeded();
await expect(placeholder).toBeVisible({ timeout: 10000 });
const cardText = await coCreationCta.locator('xpath=ancestor::section[1]').textContent();
// 文案由 CMS pageCopy 可覆盖,故断言主题词而非整句措辞
const cardText = await placeholder.textContent();
expect(cardText).toContain('共创');
const coCreationCta = placeholder.locator('a[href="/contact"]').first();
await expect(coCreationCta).toBeVisible();
await expect(coCreationCta).toContainText('成为首批共创客户');
});
test('@journey @critical 空案例区呈现共创内容块而非裸空态', async ({ page }) => {
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(2500);
await closeCookieBanner(page);
await gotoHome(page);
const bodyText = await page.locator('body').textContent();
// 无「暂无案例数据」裸空态
expect(bodyText).not.toContain('暂无案例数据');
// 出现「共创进行时」前瞻内容块
expect(bodyText).toContain('共创进行时');
// 共创块包含转化 CTA。
// 验收 E2E 修订:原断言的「成为首批共创客户」从未落地为组件文案——
// 预约动作文案由 CTA_LABELS.consult 单一真源约束为「预约咨询」
// (src/lib/constants/cta-labels.ts + DESIGN.md),原测试把设计意图当成了实现。
const coCreationCta = page.locator('[data-testid="cases-co-creation-cta"]').first();
await expect(coCreationCta).toHaveAttribute('href', '/contact');
await expect(coCreationCta).toContainText('预约咨询');
// 成果槽处于**可判别的共创态**,而不是"没数据所以什么都不渲染"
await expect(page.locator('[data-testid="results-slot-co-creation"]').first()).toBeVisible();
// 明说不冒充案例(反伪造不变量的用户可见面)
expect(bodyText).toContain('不会写一个出来');
// 过程叙事在场:原「01/02/03 三幕」的语义由共创四步承担
expect(bodyText).toContain('问题梳理');
expect(bodyText).toContain('交付物验收');
// 转化出口仍在
const placeholder = page.locator('[data-testid="results-slot-placeholder"]').first();
await expect(placeholder.locator('a[href="/contact"]').first()).toBeVisible();
});
});
@@ -153,45 +165,43 @@ test.describe('UJ-11c: 移动端首屏转化旅程', () => {
test('@mobile @journey @critical 移动端 CTA 首屏可见且无横向滚动', async ({ page }) => {
// 模拟移动端视口
await page.setViewportSize({ width: 390, height: 844 });
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(2500);
await closeCookieBanner(page);
await gotoHome(page);
// 无横向滚动
await expectNoHorizontalOverflow(page);
// CTA 首屏可达(在当前视口内可见)
const primaryCta = page.locator('[data-testid="hero-primary-cta"]').first();
await expect(primaryCta).toBeVisible({ timeout: 15000 });
// 首屏 Hero 区块可见(v15 已移除产品 Mockup)
// 首屏 Hero 区块可见
const heroSection = page.locator('[data-testid="hero-section"]').first();
await expect(heroSection).toBeVisible();
await expect(heroSection).toBeVisible({ timeout: 15000 });
// CTA 不只是"存在",必须在 844px 首屏折线内 —— 实测 hero 收 70vh 后 y≈418、h≈51
const cta = page.locator('[data-testid="hero-cta"]').first();
await expect(cta).toBeVisible();
const box = await cta.boundingBox();
expect(box).not.toBeNull();
expect(box!.y).toBeGreaterThanOrEqual(0);
expect(box!.y + box!.height).toBeLessThanOrEqual(844);
});
test('@mobile @journey @critical 移动端信任层与叙事区单列堆叠无溢出', async ({ page }) => {
test('@mobile @journey @critical 移动端信任层与成果区单列堆叠无溢出', async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForTimeout(2500);
await closeCookieBanner(page);
await gotoHome(page);
// 信任层:dev 服务高负载下区块节点会被替换,直接 scrollIntoViewIfNeeded 会撞上
// dev 服务高负载下区块节点会被替换,直接 scrollIntoViewIfNeeded 会撞上
// 「Element is not attached to the DOM」(chain3 实测 firefox),先等可见再滚动。
const trustSection = page.locator('[data-testid="trust-section"]').first();
await expect(trustSection).toBeVisible({ timeout: 15000 });
await trustSection.scrollIntoViewIfNeeded();
await expect(trustSection).toBeVisible();
const trustText = await trustSection.textContent();
expect(trustText).toContain('数据来源');
for (const id of ['home-ledger', 'home-ledger-signals', 'results-slot-placeholder', 'home-capabilities']) {
const el = page.locator(`[data-testid="${id}"]`).first();
await expect(el).toBeVisible({ timeout: 15000 });
await el.scrollIntoViewIfNeeded();
await expect(el).toBeVisible();
}
// 叙事区
const narrativeSection = page.locator('[data-testid="narrative-section"]').first();
await expect(narrativeSection).toBeVisible({ timeout: 15000 });
await narrativeSection.scrollIntoViewIfNeeded();
await expect(narrativeSection).toBeVisible();
expect(await narrativeSection.textContent()).toContain('01');
const basisNote = page.locator('[data-testid="metrics-basis-note"]').first();
await expect(basisNote).toBeVisible();
// 全程无横向滚动
// 全程无横向滚动(滚动到页面底部后再测一次,窄视口下的溢出通常在末段才暴露)
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
await page.waitForTimeout(400);
await expectNoHorizontalOverflow(page);
});
});
+5 -4
View File
@@ -210,15 +210,16 @@ test.describe('UJ-02: 行业客户浏览解决方案到产品的旅程', () => {
const heroTitle = page.locator('h1').first();
await expect(heroTitle).toBeVisible({ timeout: 10000 });
// === Step 2: 导航到解决方案页面 ===
// 通过桌面导航的解决方案下拉菜单
// === Step 2: 导航到行业方案列表页 ===
// 一级导航已改对标双轴(ADR-0008 决策二):原「解决方案」轴改名「行业」,
// 面板底部动作相应是「查看全部行业 → /solutions」。
const desktopNav = page.locator('[data-testid="desktop-navigation"]').first();
const solutionsDropdown = desktopNav.locator('button:has-text("解决方案")').first();
const solutionsDropdown = desktopNav.locator('button:has-text("行业")').first();
await expect(solutionsDropdown).toBeVisible({ timeout: 5000 });
await solutionsDropdown.hover();
await page.waitForTimeout(300);
const viewAllSolutions = desktopNav.locator('a:has-text("查看全部解决方案")').first();
const viewAllSolutions = desktopNav.locator('a:has-text("查看全部行业")').first();
await expect(viewAllSolutions).toBeVisible({ timeout: 5000 });
await viewAllSolutions.hover();
await page.waitForTimeout(200);