test(qa): e2e 装配修正 + 集成/门禁测试与工具链重构
- e2e:修死选择器与蜜罐误命中、补断言、GA4/security-headers 用例诚实标注 skip 边界;新增 assert-helpers/fixtures/hydrated/primary-nav/touch-targets 等复用桩。 - 集成层:config/test/jest.integration.config.js + tests-integration/ 真库 一次性 SQLite 用例,teardown 守卫开发库指纹。 - 门禁工具链:jest.setup 归位到根、scripts/accessibility 全站 axe 节点计数、 check-brand-text-token/check-motion-constraints 机械守卫、stryker/lighthouse 配置收敛。
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { test, expect, type Page } from '@playwright/test';
|
||||
import { test, expect, type Page } from './fixtures';
|
||||
|
||||
/**
|
||||
* UJ-11: 首页转化旅程(设计优化专项)
|
||||
@@ -114,18 +114,18 @@ test.describe('UJ-11b: 信任验证旅程(共创标签 → 转化)', () => {
|
||||
await page.waitForTimeout(2500);
|
||||
await closeCookieBanner(page);
|
||||
|
||||
// 首批客户共创横幅存在(无虚构客户,如实标注)
|
||||
const earlyAccessBanner = page.locator('[data-testid="early-access-banner"]').first();
|
||||
await earlyAccessBanner.scrollIntoViewIfNeeded();
|
||||
await expect(earlyAccessBanner).toBeVisible({ timeout: 10000 });
|
||||
// 验收 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 bannerText = await earlyAccessBanner.textContent();
|
||||
expect(bannerText).toContain('首批客户共创中');
|
||||
|
||||
// 引导至联系转化
|
||||
const cta = earlyAccessBanner.locator('a[href="/contact"]').first();
|
||||
await expect(cta).toBeVisible();
|
||||
await expect(cta).toHaveAttribute('href', '/contact');
|
||||
const cardText = await coCreationCta.locator('xpath=ancestor::section[1]').textContent();
|
||||
// 文案由 CMS pageCopy 可覆盖,故断言主题词而非整句措辞
|
||||
expect(cardText).toContain('共创');
|
||||
});
|
||||
|
||||
test('@journey @critical 空案例区呈现共创内容块而非裸空态', async ({ page }) => {
|
||||
@@ -138,8 +138,13 @@ test.describe('UJ-11b: 信任验证旅程(共创标签 → 转化)', () => {
|
||||
expect(bodyText).not.toContain('暂无案例数据');
|
||||
// 出现「共创进行时」前瞻内容块
|
||||
expect(bodyText).toContain('共创进行时');
|
||||
// 共创块包含转化 CTA
|
||||
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('预约咨询');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -170,8 +175,10 @@ test.describe('UJ-11c: 移动端首屏转化旅程', () => {
|
||||
await page.waitForTimeout(2500);
|
||||
await closeCookieBanner(page);
|
||||
|
||||
// 信任层
|
||||
// 信任层: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();
|
||||
@@ -179,6 +186,7 @@ test.describe('UJ-11c: 移动端首屏转化旅程', () => {
|
||||
|
||||
// 叙事区
|
||||
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');
|
||||
|
||||
Reference in New Issue
Block a user