test(01-10): wave-3 task-4 — harness A15+A16+A17 (onboarding flag observability + no-re-open settle + design-swap-readiness with @import probe); 24/24 GREEN
Plan 01-10 Wave 3: extends the UAT harness with three new page-side
assertions covering the onboarding contract + the canonical-tokens
design-swap-readiness invariant. UAT baseline 21 → 24 GREEN.
tests/uat/extension-page-harness.ts (page-side):
- assertA15 — chrome.storage.local 'onboarding-completed' === true +
'installed-at' is number. Verifies SW's openWelcomeIfFirstInstall
side-effects.
- assertA16 — 2s settle window; chrome.tabs.query welcome-tab count
delta === 0. Verifies flag-gating across SW respawns.
- assertA17 — 7 sub-checks covering: welcome.html parse + .welcome-hero
+ >=7 mokosh-keyed attrs + welcome.css canonical @import literal OR
inlined --mks-* evidence + (zero hex OR canonical resolved) + >=5
var(--mks-*) refs + bundled JS preserves populate plumbing +
getComputedStyle --mks-rec → rgb(178, 84, 61) (canonical D-04 Loom).
- window.__mokoshHarness surface extended with the three new methods;
type declaration + assignment + page-ready status text updated.
tests/uat/lib/harness-page-driver.ts (host-side):
- driveA15, driveA16, driveA17 — standard page.evaluate wrappers
matching driveA14 / driveA18..A22 idiom. driveA16 dominates the
new wall-clock budget (~2.1s for the settle window).
tests/uat/harness.test.ts (orchestrator):
- Drivers array interleaves A15/A16/A17 AFTER A14 + BEFORE A18.
A22's skip-gate no longer triggers (Plan 01-10 lands welcome.html;
A22 now exercises the substantive token-usage path).
- FORBIDDEN_HOOK_STRINGS unchanged at 12 entries (A15-A17 use only
chrome.tabs.query / chrome.storage.local.get / fetch / DOMParser /
getComputedStyle — all production-API surfaces).
DEVIATION (Rule 1 — auto-fix bug in plan-supplied check):
The plan's A17.6 spec used literal substring checks 'COPY[' and
'chrome.i18n.getMessage(' which fail against minified production
output. Vite/Rollup terser renames `COPY` → `f` (local variable
mangling) and welcome.ts's source uses optional chaining
`chrome?.i18n?.getMessage?.(` which doesn't match the verbatim
literal. Replaced with two minification-survivable witnesses:
1. 'welcome.page.title' — literal Object.freeze key (terser
preserves object-literal keys verbatim).
2. 'i18n' + 'getMessage' + 'welcomeHero' substring conjunction —
chrome global + property access + fallback key literal; all
three survive minification regardless of optional-chaining
insertion or rename.
Both witnesses prove the populate plumbing survives the build (the
ground-truth contract A17.6 enforces). The relaxed contract is
semantically equivalent — neither substring is load-bearing on its
own; both witness the same underlying invariant.
Verify (all GREEN):
- npm run test:uat: 24/24 assertions passed (A0 grep gate + A1..A14
+ A15..A17 + A18..A22 + A23).
- npx tsc --noEmit: clean.
- npm run build:test: clean; dist-test/assets/welcome-wB0e_R_n.js
bundled; harness page bundle includes new asserts.
- SKIP_BUILD=1 npx vitest run tests/background/no-test-hooks-in-prod-bundle.test.ts:
13/13 GREEN (Tier-1 grep gate; FORBIDDEN_HOOK_STRINGS at 12).
- Full vitest baseline preserved: 137 ex-grep-gate + 13 grep-gate
= 150 GREEN (Plan 01-10 target).
A17.7 canonical proof: getComputedStyle.color = 'rgb(178, 84, 61)' —
the @import '../shared/tokens.css' directive resolves through to the
canonical D-04 Loom palette --mks-madder-600 = #b2543d at runtime, as
the empirical proof Plan 01-12 must_have #9 path-B contract demands.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -993,6 +993,65 @@ export async function driveA14(page: Page): Promise<AssertionRecord> {
|
||||
}) as AssertionRecord;
|
||||
}
|
||||
|
||||
/* ─── Plan 01-10 Wave 3 — driveA15..A17 (onboarding + design-swap-readiness) ─── */
|
||||
|
||||
/**
|
||||
* Drive A15 (onboarding flag observability). Standard page.evaluate
|
||||
* wrapper — page side reads chrome.storage.local for the two keys
|
||||
* Plan 01-10 Wave 2's openWelcomeIfFirstInstall writes on first install
|
||||
* ('onboarding-completed' === true; 'installed-at' is number).
|
||||
*
|
||||
* @param page - The harness page from `launchHarnessBrowser`.
|
||||
* @returns Structured AssertionRecord with 2 checks (flag + installed-at type).
|
||||
*/
|
||||
export async function driveA15(page: Page): Promise<AssertionRecord> {
|
||||
return await page.evaluate(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- evaluate runs in browser context where Window types are loose.
|
||||
const harness = (window as any).__mokoshHarness;
|
||||
const r: AssertionRecord = await harness.assertA15();
|
||||
return r;
|
||||
}) as AssertionRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drive A16 (subsequent-install does NOT re-open welcome tab). Standard
|
||||
* page.evaluate wrapper — page side snapshots chrome.tabs.query before
|
||||
* and after a 2-second settle window, asserts no new welcome.html tabs
|
||||
* appeared. The 2s wait dominates A16's wall-clock runtime; total
|
||||
* driver runtime is ~2.1s.
|
||||
*
|
||||
* @param page - The harness page from `launchHarnessBrowser`.
|
||||
* @returns Structured AssertionRecord with 1 check (welcome-tab delta === 0).
|
||||
*/
|
||||
export async function driveA16(page: Page): Promise<AssertionRecord> {
|
||||
return await page.evaluate(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- evaluate runs in browser context where Window types are loose.
|
||||
const harness = (window as any).__mokoshHarness;
|
||||
const r: AssertionRecord = await harness.assertA16();
|
||||
return r;
|
||||
}) as AssertionRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drive A17 (design-swap-readiness invariant). Standard page.evaluate
|
||||
* wrapper — page side fetches welcome.html + welcome.css + the bundled
|
||||
* welcome JS chunk and verifies 7 sub-invariants (parse + slot + ≥7
|
||||
* keyed attrs + canonical @import or inlined tokens + ≥5 var(--mks-*)
|
||||
* + COPY[ or chrome.i18n welcomeHero pattern + --mks-rec resolution
|
||||
* via getComputedStyle).
|
||||
*
|
||||
* @param page - The harness page from `launchHarnessBrowser`.
|
||||
* @returns Structured AssertionRecord with 7 sub-checks.
|
||||
*/
|
||||
export async function driveA17(page: Page): Promise<AssertionRecord> {
|
||||
return await page.evaluate(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- evaluate runs in browser context where Window types are loose.
|
||||
const harness = (window as any).__mokoshHarness;
|
||||
const r: AssertionRecord = await harness.assertA17();
|
||||
return r;
|
||||
}) as AssertionRecord;
|
||||
}
|
||||
|
||||
/* ─── Plan 01-12 Wave 6 — driveA18..A22 (design integration assertions) ─── */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user