create-pmos 0.692.0 → 0.694.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/package.json +22 -16
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/adler-moments-test.js +3 -35
  7. package/workspace/adler-seasons-test.js +1 -1
  8. package/workspace/briefing-premium-adddoc-test.js +1 -1
  9. package/workspace/briefing-premium-board-test.js +1 -1
  10. package/workspace/briefing-premium-doc-edit-test.js +1 -1
  11. package/workspace/briefing-premium-work-test.js +2 -2
  12. package/workspace/changelog.json +21 -2
  13. package/workspace/chat-asks-test.js +1 -1
  14. package/workspace/core-docs-workflow-test.js +1 -1
  15. package/workspace/ev-everywhere-test.js +3 -14
  16. package/workspace/guide/home.md +2 -2
  17. package/workspace/guide/layout.md +2 -2
  18. package/workspace/guide/settings-and-switches.md +0 -1
  19. package/workspace/impact-screens-test.js +2 -47
  20. package/workspace/ini-workflow-test.js +1 -1
  21. package/workspace/lib/board-grill.js +17 -24
  22. package/workspace/lib/discovery-questions.js +36 -0
  23. package/workspace/lib/routes-board-grill.js +31 -3
  24. package/workspace/live-pill-round-test.js +6 -18
  25. package/workspace/milestone-suggest-test.js +4 -28
  26. package/workspace/news-viewers-test.js +3 -29
  27. package/workspace/package-lock.json +2 -2
  28. package/workspace/package.json +1 -1
  29. package/workspace/premium-board-actions-test.js +3 -3
  30. package/workspace/premium-briefing-depth-test.js +4 -4
  31. package/workspace/premium-chat-attach-test.js +3 -2
  32. package/workspace/premium-chat-chart-tab-test.js +8 -7
  33. package/workspace/premium-chat-context-test.js +3 -1
  34. package/workspace/premium-chat-goal-view-test.js +3 -1
  35. package/workspace/premium-chat-line-test.js +8 -6
  36. package/workspace/premium-chat-report-tab-test.js +13 -5
  37. package/workspace/premium-chat-term-test.js +2 -2
  38. package/workspace/premium-chat-viewer-test.js +10 -16
  39. package/workspace/premium-core-doc-issue-test.js +7 -2
  40. package/workspace/premium-discuss-landing-test.js +9 -5
  41. package/workspace/premium-html-viewer-test.js +7 -3
  42. package/workspace/premium-link-suggest-test.js +6 -10
  43. package/workspace/premium-phone-card-test.js +2 -2
  44. package/workspace/premium-viewer-download-test.js +1 -1
  45. package/workspace/premium-viewer-flicker-test.js +1 -1
  46. package/workspace/premium-viewer-share-test.js +2 -2
  47. package/workspace/premium-viewer-test.js +1 -1
  48. package/workspace/premium-vw-cal-test.js +1 -1
  49. package/workspace/premium-vw-copy-test.js +3 -3
  50. package/workspace/premium-vw-doc-test.js +1 -1
  51. package/workspace/premium-vw-item-test.js +1 -1
  52. package/workspace/premium-work-depth-test.js +2 -2
  53. package/workspace/program-charter-test.js +1 -12
  54. package/workspace/program-leave-test.js +2 -2
  55. package/workspace/program-order-test.js +3 -65
  56. package/workspace/project-onboard-flow-test.js +5 -5
  57. package/workspace/public/pm/bd-asks.js +6 -5
  58. package/workspace/public/pm/cozy-home.css +0 -6
  59. package/workspace/public/pm/cozy-panels.js +2 -6
  60. package/workspace/public/pm/cozy-popup.css +1 -0
  61. package/workspace/public/pm/cozy-popup.js +15 -2
  62. package/workspace/public/pm/cozy-today-page.css +1 -1
  63. package/workspace/public/pm/cozy-today.css +0 -14
  64. package/workspace/public/pm/cozy-viewer.js +14 -38
  65. package/workspace/public/pm/goal-chat.js +2 -2
  66. package/workspace/public/pm/home-app.js +8 -67
  67. package/workspace/public/pm/home-chat.js +1 -1
  68. package/workspace/public/pm/home-ses-name.js +3 -2
  69. package/workspace/public/pm/home-today.js +4 -18
  70. package/workspace/public/pm/ini-view-model.js +2 -2
  71. package/workspace/public/pm/premium-board.js +1 -1
  72. package/workspace/public/premium-intelligence.html +1 -1
  73. package/workspace/public/premium-viewer.html +1 -1
  74. package/workspace/public/premium-workflows.html +1 -1
  75. package/workspace/ready-dash-ui-test.js +1 -1
  76. package/workspace/rename-test.js +2 -2
  77. package/workspace/server.js +11 -12
  78. package/workspace/session-names-test.js +34 -56
  79. package/workspace/sort-order-test.js +2 -71
  80. package/workspace/split-merge-ui-test.js +1 -1
  81. package/workspace/stage-card-tasks-test.js +1 -1
  82. package/workspace/stage-card-test.js +1 -1
  83. package/workspace/task-card-test.js +1 -1
  84. package/workspace/task-press-test.js +1 -1
  85. package/workspace/task-views-test.js +1 -1
  86. package/workspace/test-lists/adler-seasons-art.json +3 -6
  87. package/workspace/test-lists/batch18-asks.json +1 -1
  88. package/workspace/test-lists/briefing-premium.json +1 -11
  89. package/workspace/test-lists/discovery-three-questions.json +5 -0
  90. package/workspace/test-lists/premium-agreed-viewer.json +1 -1
  91. package/workspace/test-run.js +0 -2
  92. package/workspace/test-timings.json +0 -4
  93. package/workspace/tk-tasks-test.js +3 -17
  94. package/workspace/viewer-trail-test.js +2 -2
  95. package/workspace/workflows-setup-test.js +4 -2
  96. package/workspace/adler-seasons-art-test.js +0 -116
  97. package/workspace/briefing-premium-initiative-test.js +0 -289
  98. package/workspace/briefing-premium-products-test.js +0 -209
  99. package/workspace/briefing-premium-sources-test.js +0 -250
  100. package/workspace/briefing-premium-test.js +0 -282
  101. package/workspace/home-other-product-test.js +0 -197
  102. package/workspace/home-pill-test.js +0 -138
  103. package/workspace/home-railcard-test.js +0 -196
  104. package/workspace/home-rows-test.js +0 -389
  105. package/workspace/panels-test.js +0 -454
  106. package/workspace/public/premium.html +0 -48
  107. package/workspace/test-lists/batch18-panels.json +0 -9
  108. package/workspace/test-lists/home-railcard.json +0 -9
  109. package/workspace/test-lists/home-sessions-pill.json +0 -6
  110. package/workspace/test-lists/viewer-home-rows.json +0 -9
@@ -1,138 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
- /* home-pill-test.js — what sits in an initiative shows as a pill on its Home row (feedback batch 12 item 6, agreed A; canvas HsA1Desk,
4
- * HsA2Phone, HsA3Sheet; public/pm/home-today.js pillOf, kidSub, iniHtml, sesSheetHtml; home-app.js sesPill).
5
- * P pure: the pill's most urgent state (waits on you > blocked > running > a meeting > open), its count and words; none: no pill;
6
- * the quiet line under each row of its list
7
- * D1 a desktop: sessions are no rows under the initiative any more; its row has the pill (a blue dot and 3), no chevron
8
- * D2 a press lists them right under the pill, waiting first, each with one quiet line; Escape closes it and gives the focus back
9
- * D3 a press on one opens its chat and closes the list; + starts a new session in the initiative
10
- * D4 a phone (390 px): the pill opens a sheet with the initiative's name; the scrim closes it
11
- * The real page from the real server, its routes answered from the fixtures. PMOS_SHOTS=<dir> also saves a screenshot of each state. */
12
- const path = require('path');
13
- const fs = require('fs');
14
- const { spawn } = require('child_process');
15
- const { pathToFileURL } = require('url');
16
- const { findBrowser } = require('./lib/find-browser');
17
- const T = require('./test-run').configure({ name: 'home-pill' });
18
- const BP = require('./lib/board-premium.js');
19
- const BF = require('./fixtures/board-premium-facts.js');
20
- const BRP = require('./lib/briefing-premium.js');
21
- const BRF = require('./fixtures/briefing-premium-facts.js');
22
-
23
- const BASE = T.BASE;
24
- const SHOTS = process.env.PMOS_SHOTS || '';
25
- const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
26
- const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
27
- const results = [];
28
- const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
29
- let srv = null; let browser = null;
30
- const finish = async (code) => {
31
- if (browser) await browser.close().catch(() => {});
32
- if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
33
- T.killTmux();
34
- const bad = results.filter((x) => !x.cond).length;
35
- console.log(`\n${results.length - bad}/${results.length} home-pill assertions passed`);
36
- process.exit(code !== undefined ? code : (bad ? 1 : 0));
37
- };
38
- process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
39
-
40
- const now = new Date().toISOString();
41
- const ses = (id, title, shown, extra = {}) => ({ id, name: 'chat: ' + title, agent: 'claude', state: shown === 'working' ? 'running' : 'idle', shown, initiative: 'self-serve-v2', created: now, hx: { title }, ...extra });
42
- const SESSIONS = [ses('q1', 'Investigate stage cards not updating', 'quiet'), ses('n1', 'Remove duplicate tasks', 'needs'), ses('w1', 'Plan the sprint tasks', 'working')];
43
-
44
- (async () => {
45
- /* P */
46
- const TD = await import(pathToFileURL(path.join(__dirname, 'public/pm/home-today.js')).href);
47
- const r = (kids) => ({ name: 'Tender', kids });
48
- const s = (state, extra = {}) => ({ kind: 'session', state, hint: 'PMOS', ...extra });
49
- const m1 = TD.pillOf(r([s('quiet'), s('needs'), s('working')]));
50
- ok('P the pill leads with what waits on you and counts all three', m1 && m1.top === 'needs' && m1.n === 3 && m1.say === '3 things in Tender: 1 waits on you, 1 running, 1 open', JSON.stringify(m1));
51
- ok('P running beats a meeting and an open session', TD.pillOf(r([s('quiet'), { kind: 'meeting', state: 'quiet', hint: '14:00 meeting' }, s('working')])).top === 'working');
52
- ok('P a meeting today beats an open session', TD.pillOf(r([s('quiet'), { kind: 'meeting', state: 'quiet' }])).top === 'meeting');
53
- ok('P a next step waits on you', TD.pillOf(r([s('quiet'), { kind: 'need', step: true, state: 'quiet', hint: 'Next step' }])).top === 'needs');
54
- ok('P nothing in it: no pill (zero is silence)', TD.pillOf(r([])) === null);
55
- ok('P the quiet line: the state in words, then who', TD.kidSub(s('needs')) === 'Asks you · PMOS' && TD.kidSub(s('working')) === 'Running · PMOS' && TD.kidSub(s('blocked')) === 'Blocked, asks you · PMOS' && TD.kidSub({ kind: 'meeting', hint: '14:00 meeting' }) === '14:00 meeting');
56
-
57
- const exe = findBrowser();
58
- if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the home-pill suite cannot run'); return finish(1); }
59
- let chromium;
60
- try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed — the home-pill suite cannot run'); return finish(1); }
61
- srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
62
- await T.waitForServer(BASE);
63
- browser = await chromium.launch({ executablePath: exe });
64
- const BOARD = BP.build(BF.facts()), BRIEF = BRP.build(BRF.facts());
65
- if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
66
-
67
- const open = async ({ w = 1440, h = 900, theme = 'light' } = {}) => {
68
- const ctx = await browser.newContext({ viewport: { width: w, height: h }, hasTouch: w < 500 });
69
- const page = await ctx.newPage();
70
- const errors = [];
71
- page.on('pageerror', (e) => errors.push(String(e)));
72
- const json = (rq, b) => rq.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(b) });
73
- await page.route(/\/api\/board-premium(\?.*)?$/, (rq) => json(rq, { ok: true, state: 'ready', model: BOARD, as_of: Date.now() }));
74
- await page.route(/\/api\/briefing-premium(\?.*)?$/, (rq) => json(rq, { ok: true, state: 'ready', model: BRIEF, as_of: Date.now() }));
75
- await page.route('**/api/briefing-premium/**', (rq) => json(rq, { ok: true, turns: [], working: false }));
76
- await page.route(/\/api\/sessions(\?.*)?$/, (rq) => json(rq, { sessions: SESSIONS }));
77
- await page.goto(BASE + '/premium.html?theme=' + theme);
78
- const up = await until(() => page.evaluate(() => !!document.querySelector('#hmList [data-hm-ses$="|i:self-serve-v2"]')), 30000);
79
- return { ctx, page, errors, up };
80
- };
81
- const shot = async (p, name) => { if (!SHOTS) return; await sleep(300); await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
82
- const PILL = '#hmList [data-hm-ses$="|i:self-serve-v2"]';
83
-
84
- /* D1 to D3, a desktop */
85
- {
86
- const A = await open(), p = A.page;
87
- ok('D1 the initiative row has its pill', A.up);
88
- if (!A.up) return finish(1);
89
- const row = await p.evaluate((sel) => {
90
- const b = document.querySelector(sel), rw = b.closest('.hv-r');
91
- return { cls: b.className, n: b.querySelector('.n').textContent, dot: !!b.querySelector('.hv-pm.needs'), aria: b.getAttribute('aria-label'), chev: !!rw.querySelector('.hv-xc'),
92
- nested: !!document.querySelector('#hmList .hm-nest'), rows: [...document.querySelectorAll('#hmList .hm-rt b')].map((x) => x.textContent).filter((t) => /Remove duplicate|Plan the sprint|Investigate stage/.test(t)) };
93
- }, PILL);
94
- ok('D1 the pill: a blue dot and 3, said in words', /\bneeds\b/.test(row.cls) && row.n === '3' && row.dot && /^3 things in Self-serve onboarding v2: 1 waits on you, 1 running, 1 open\. Show$/.test(row.aria), JSON.stringify(row));
95
- ok('D1 no session is a row under the initiative, and the row has no chevron', !row.nested && !row.chev && row.rows.length === 0, JSON.stringify(row));
96
- await shot(p, 'pill-desk');
97
-
98
- await p.click(PILL);
99
- const L = await until(() => p.evaluate(() => { const d = document.querySelector('#hmList .hv-spp'); return d ? { rows: [...d.querySelectorAll('.hv-r')].map((x) => [x.querySelector('.hm-rt b').textContent, x.querySelector('.hm-rt em').textContent]), plus: !!d.querySelector('[data-hm-sesnew="self-serve-v2"]'), focus: document.activeElement && d.contains(document.activeElement), exp: document.querySelector('[data-hm-ses$="|i:self-serve-v2"]').getAttribute('aria-expanded') } : null; }));
100
- ok('D2 a press lists them under the pill, waiting first, each with its quiet line', !!L && JSON.stringify(L.rows) === JSON.stringify([['Remove duplicate tasks', 'Asks you · PMOS'], ['Plan the sprint tasks', 'Running · PMOS'], ['Investigate stage cards not updating', 'Open · PMOS']]), JSON.stringify(L));
101
- ok('D2 + is there, the focus is in the list and the pill says it is open', !!L && L.plus && L.focus && L.exp === 'true', JSON.stringify(L));
102
- await shot(p, 'pill-desk-open');
103
- await p.keyboard.press('Escape');
104
- const shut = await until(() => p.evaluate((sel) => (!document.querySelector('#hmList .hv-spp') && document.activeElement === document.querySelector(sel) ? true : null), PILL));
105
- ok('D2 Escape closes it and gives the focus back to the pill', !!shut);
106
-
107
- await p.click(PILL);
108
- await until(() => p.evaluate(() => !!document.querySelector('#hmList .hv-spp')));
109
- await p.evaluate(() => [...document.querySelectorAll('#hmList .hv-spp .hm-rm')].find((b) => /Remove duplicate tasks/.test(b.textContent)).click());
110
- const opened = await until(() => p.evaluate(() => (!document.querySelector('#hmList .hv-spp') && /Remove duplicate tasks/.test((document.querySelector('#hmChat, .hm-chat, main') || document.body).textContent) ? true : null)));
111
- ok('D3 a press on one opens its chat and closes the list', !!opened);
112
- await p.click(PILL);
113
- await until(() => p.evaluate(() => !!document.querySelector('#hmList .hv-spp')));
114
- await p.click('#hmList [data-hm-sesnew="self-serve-v2"]');
115
- const fresh = await until(() => p.evaluate(() => (!document.querySelector('#hmList .hv-spp') && /A new session in Self-serve onboarding v2/.test(document.body.textContent) ? true : null)));
116
- ok('D3 + starts a new session in the initiative', !!fresh);
117
- ok('D the page raised no error', A.errors.length === 0, A.errors.join(' | '));
118
- await A.ctx.close();
119
- }
120
-
121
- /* D4 a phone, dark */
122
- {
123
- const A = await open({ w: 390, h: 844, theme: 'dark' }), p = A.page;
124
- ok('D4 the phone draws the pill', A.up);
125
- if (A.up) {
126
- await p.click(PILL);
127
- const S = await until(() => p.evaluate(() => { const d = document.querySelector('#hmList .hv-sps'); return d ? { title: d.querySelector('.hv-sbar b').textContent, n: d.querySelectorAll('.hv-r').length, pop: !!document.querySelector('#hmList .hv-spp') } : null; }));
128
- ok('D4 the pill opens a sheet with the initiative\'s name and its 3 rows (no popover)', !!S && S.title === 'Self-serve onboarding v2' && S.n === 3 && !S.pop, JSON.stringify(S));
129
- await shot(p, 'pill-phone-sheet');
130
- await p.click('#hmList .hv-scrim');
131
- const gone = await until(() => p.evaluate(() => (!document.querySelector('#hmList .hv-sps') ? true : null)));
132
- ok('D4 the scrim closes the sheet', !!gone);
133
- ok('D4 the page raised no error', A.errors.length === 0, A.errors.join(' | '));
134
- }
135
- await A.ctx.close();
136
- }
137
- finish();
138
- })();
@@ -1,196 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
- /* home-railcard-test.js — the folded rail's card on Home (feedback batch 18 item 14; canvas FlA1, FlA2, FlA3Dark, FlA4After, FlA5Dark;
4
- * public/pm/home-app.js drawRailCard, home-today.js railCardHtml, cozy-viewer.js railCard).
5
- * Serves the real page from the real server; GET /api/briefing-premium answers the fixture model (as home-rows-test.js does).
6
- * C1 a wide Viewer folds the list to a rail; a tile's press opens a card beside it with that group's rows (Home's own), the tile has a
7
- * ring and aria-expanded; the rail and the Viewer's width do not change
8
- * C2 the card's header: the group's name opens it (›), × closes; a program shows its next milestone
9
- * C3 the pill lists the sessions in place inside the card (no second popover), waiting first, with + for a new session
10
- * C4 a row's press opens it as on Home and closes the card; the rail stays folded and the Viewer as wide
11
- * C5 the tile of the group that holds what is open has the blue bar and "(open)"; the other tiles none
12
- * C6 Escape closes the card and gives the focus back to its tile; Enter on a tile opens it with the focus on its first row; arrows move;
13
- * a second press on the tile and a press outside close it
14
- * C7 dark: the card's colours come from the tokens; no page error anywhere
15
- * Screenshots (1440x900) go to PMOS_SHOTS when it is set. Every wait polls the page. */
16
- const fs = require('fs');
17
- const path = require('path');
18
- const { spawn } = require('child_process');
19
- const { findBrowser } = require('./lib/find-browser');
20
- const { besidePage } = require('./lib/beside-page'); // these checks are about work beside the page, not the popup
21
- const T = require('./test-run').configure({ name: 'home-railcard' });
22
- const B = require('./lib/briefing-premium.js');
23
- const F = require('./fixtures/briefing-premium-facts.js');
24
-
25
- const BASE = T.BASE;
26
- const SHOTS = process.env.PMOS_SHOTS || '';
27
- const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
28
- const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
29
- const results = [];
30
- const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
31
- let srv = null; let browser = null;
32
- const finish = async (code) => {
33
- if (browser) await browser.close().catch(() => {});
34
- if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
35
- T.killTmux();
36
- const bad = results.filter((x) => !x.cond).length;
37
- console.log(`\n${results.length - bad}/${results.length} home-railcard assertions passed`);
38
- process.exit(code !== undefined ? code : (bad ? 1 : 0));
39
- };
40
- process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
41
- const BP = require('./lib/board-premium.js');
42
- const BF = require('./fixtures/board-premium-facts.js');
43
-
44
- (async () => {
45
- const exe = findBrowser();
46
- if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the home-railcard suite cannot run'); return finish(1); }
47
- let chromium;
48
- try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed — the home-railcard suite cannot run'); return finish(1); }
49
- srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
50
- await T.waitForServer(BASE);
51
- browser = besidePage(await chromium.launch({ executablePath: exe }));
52
-
53
- const open = async ({ w = 1440, h = 900, dark = false } = {}) => {
54
- const ctx = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: dark ? 'dark' : 'light' });
55
- const page = await ctx.newPage();
56
- const errors = [];
57
- page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
58
- const json = (r, b) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(b) });
59
- // Home with Project Ascent across IDPF and Microsites (fixtures/briefing-premium-facts.js): a program's group and the products' groups
60
- await page.route(/\/api\/board-premium(\?.*)?$/, (r) => { const ws = new URL(r.request().url()).searchParams.get('ws') || 'idpf'; return json(r, { ok: true, state: 'ready', model: BP.build(BF.programFacts(ws)), as_of: Date.now() }); });
61
- await page.route(/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: B.buildMany(F.programFacts()), as_of: Date.now() }));
62
- await page.route('**/api/programs', (r) => json(r, { ok: true, programs: F.programs() }));
63
- // two sessions in Descope feature parity: one waits on the PM, one runs (the pill, FlA2)
64
- await page.route('**/api/sessions', (r) => json(r, { ok: true, sessions: [
65
- { id: 's-run', name: 'Paywall copy review', initiative: 'descope-parity', shown: 'working', state: 'working' },
66
- { id: 's-ask', name: 'Pick the price test length', initiative: 'descope-parity', shown: 'needs', state: 'needs' }] }));
67
- await page.goto(BASE + '/premium.html');
68
- const up = await until(() => page.evaluate(() => document.querySelectorAll('#hmList [data-cz-rail-tile]').length > 0), 20000);
69
- const close = async () => { await ctx.unrouteAll({ behavior: 'ignoreErrors' }).catch(() => {}); await ctx.close().catch(() => {}); };
70
- return { ctx, page, errors, up, close };
71
- };
72
- const shot = async (page, name) => { if (!SHOTS) return; await sleep(400); fs.mkdirSync(SHOTS, { recursive: true }); await page.screenshot({ path: path.join(SHOTS, name + '.png') }); };
73
- const lay = (page) => page.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); const l = document.getElementById('hmList'); return { rail: window.czViewer.railOn(), vw: v ? Math.round(v.getBoundingClientRect().width) : 0, list: Math.round(l.getBoundingClientRect().width), title: v ? (v.querySelector('#czVwTitle') || {}).textContent : '' }; });
74
- const card = (page) => page.evaluate(() => {
75
- const c = document.querySelector('#hmList .hv-rc'); if (!c) return null;
76
- const r = c.getBoundingClientRect(), on = document.querySelector('.cz-vw-railtile.on');
77
- return { name: (c.querySelector('.hv-rch .hv-pt b') || {}).textContent || '', head: (c.querySelector('.hv-rch .hv-pt') || { getAttribute: () => '' }).getAttribute('aria-label'), ms: !!c.querySelector('.hv-rch .hv-msd'), x: !!c.querySelector('.hv-rch [data-hm-rcx]'),
78
- rows: [...c.querySelectorAll('.hv-rcb > .hv-r .hm-rt b, .hv-rcb > .hm-r .hm-rt b')].map((b) => b.textContent), fold: (c.querySelector('.hv-rcb .hv-fold') || {}).textContent || '', pills: c.querySelectorAll('.hv-rcb .hv-sp').length,
79
- ses: [...c.querySelectorAll('.hv-rcs .hm-rt b')].map((b) => b.textContent), plus: !!c.querySelector('.hv-rcs [data-hm-sesnew]'), spp: !!c.querySelector('.hv-spp'), grip: !!c.querySelector('.po-grip, [data-po-grip]'),
80
- left: Math.round(r.left), top: Math.round(r.top), w: Math.round(r.width), bottom: Math.round(r.bottom), bg: getComputedStyle(c).backgroundColor, dialog: c.getAttribute('role'), on: on ? on.dataset.czVwRail : null, exp: on ? on.getAttribute('aria-expanded') : null };
81
- });
82
- const tiles = (page) => page.evaluate(() => [...document.querySelectorAll('.cz-vw-railtile')].map((b) => ({ key: b.dataset.czVwRail, here: b.classList.contains('here'), label: b.getAttribute('aria-label'), on: b.classList.contains('on'), r: (() => { const x = b.getBoundingClientRect(); return [Math.round(x.right), Math.round(x.top)]; })() })));
83
-
84
- const A = await open();
85
- ok('0 Home draws its groups', !!A.up);
86
- // the first initiative row on Home opens its page in the Viewer; the list's own fold folds it to the rail (batch 20 item 6: wide no longer does)
87
- const first = await A.page.evaluate(() => { const b = document.querySelector('#hmList .hv-r.ini .hm-rm'); return b ? b.dataset.hmSel : null; });
88
- await A.page.click(`#hmList .hv-r.ini .hm-rm[data-hm-sel="${first}"]`);
89
- await until(() => A.page.evaluate(() => !!document.querySelector('#czViewer:not([hidden])')));
90
- await A.page.click('#hmList .hm-hd [data-hm-fold]');
91
- const l0 = await until(() => lay(A.page).then((l) => (l.rail ? l : null)));
92
- ok('C1 the folded list is a rail of tiles beside the Viewer', !!l0 && l0.list < 100, JSON.stringify(l0));
93
- const T0 = await tiles(A.page);
94
- ok('C1 the rail has a tile per group, each a dialog press', T0.length >= 2 && T0.every((t) => / Show its initiatives$/.test(t.label)), JSON.stringify(T0));
95
- ok('C5 the tile of the group that holds the open initiative has the blue bar and "(open)"; the others none', T0.filter((t) => t.here).length === 1 && T0.filter((t) => t.here).every((t) => /\(open\)/.test(t.label)) && T0.filter((t) => !t.here).every((t) => !/\(open\)/.test(t.label)), JSON.stringify(T0));
96
- await shot(A.page, 'rail-1440');
97
-
98
- // C1 the program's tile: a card beside it with the program's rows
99
- const prog = T0.find((t) => /^g:/.test(t.key)), prod = T0.find((t) => /^p:/.test(t.key) && !t.here) || T0.find((t) => /^p:/.test(t.key));
100
- await A.page.click(`.cz-vw-railtile[data-cz-vw-rail="${prog.key}"]`);
101
- const c1 = await until(() => card(A.page));
102
- const l1 = await lay(A.page);
103
- ok('C1 a tile press opens a card (a dialog) beside the tile, its top with the tile, about 372 px wide', !!c1 && c1.dialog === 'dialog' && c1.left >= prog.r[0] && c1.left <= prog.r[0] + 20 && Math.abs(c1.top - prog.r[1]) <= 14 && c1.w >= 360 && c1.w <= 380 && c1.bottom <= 900, JSON.stringify(c1));
104
- ok('C1 the tile has a ring and aria-expanded', !!c1 && c1.on === prog.key && c1.exp === 'true', JSON.stringify(c1 && [c1.on, c1.exp]));
105
- ok('C1 the rail and the Viewer\'s width do not change', l1.rail && l1.vw === l0.vw && l1.list === l0.list, JSON.stringify([l0, l1]));
106
- const homeRows = await A.page.evaluate(() => { const s = document.querySelector('#hmList section.prg'); return s ? [...s.querySelectorAll('.hv-card .hm-rt b')].map((b) => b.textContent) : []; });
107
- ok('C1 the card shows Home\'s own rows for the program, in Home\'s order (no grip)', !!c1 && c1.rows.length > 0 && JSON.stringify(c1.rows) === JSON.stringify(homeRows) && !c1.grip, JSON.stringify([c1 && c1.rows, homeRows]));
108
- ok('C2 the header: the program\'s name opens it, its next milestone, ×', !!c1 && c1.name === 'Project Ascent' && /^Open Project Ascent, a program$/.test(c1.head) && c1.x, JSON.stringify(c1));
109
- ok('C6 a press on the tile opened it with the focus on its first row', await A.page.evaluate(() => !!document.activeElement && !!document.activeElement.closest('.hv-rc .hv-rcb')));
110
- await shot(A.page, 'card-program-1440');
111
-
112
- // C3 the pill: the sessions in place
113
- const hasPill = await A.page.evaluate(() => !!document.querySelector('#hmList .hv-rc .hv-sp'));
114
- if (hasPill) {
115
- await A.page.click('#hmList .hv-rc .hv-sp');
116
- const c3 = await until(() => card(A.page).then((c) => (c && c.ses.length ? c : null)));
117
- ok('C3 the pill lists its sessions in place inside the card, with +; no second popover', !!c3 && c3.ses.length > 0 && c3.plus && !c3.spp, JSON.stringify(c3));
118
- ok('C3 waiting first: the session that asks you leads', !!c3 && c3.ses[0] === 'Pick the price test length', JSON.stringify(c3 && c3.ses));
119
- ok('C3 the focus is on the first session', await A.page.evaluate(() => !!document.activeElement && !!document.activeElement.closest('.hv-rcs')));
120
- ok('C3 the rail and the Viewer stay', (await lay(A.page)).vw === l0.vw);
121
- await shot(A.page, 'card-sessions-1440');
122
- await A.page.keyboard.press('Escape');
123
- const c3b = await until(() => card(A.page).then((c) => (c && !c.ses.length ? c : null)));
124
- ok('C3 Escape folds the sessions first; the card stays', !!c3b);
125
- await A.page.click('#hmList .hv-rc .hv-sp');
126
- await until(() => card(A.page).then((c) => (c && c.ses.length ? c : null)));
127
- await A.page.click('#hmList .hv-rc .hv-rcs .hm-rm');
128
- await until(() => card(A.page).then((c) => !c));
129
- const l3 = await lay(A.page);
130
- const chatT = await A.page.evaluate(() => (document.getElementById('hmChat') || {}).textContent || '');
131
- ok('C3 a session press opens it in the chat and closes the card; the rail and the Viewer stay', !(await card(A.page)) && l3.rail && l3.vw === l0.vw && /Pick the price test length/.test(chatT), JSON.stringify(l3));
132
- await A.page.click(`.cz-vw-railtile[data-cz-vw-rail="${prog.key}"]`); await until(() => card(A.page));
133
- } else ok('C3 the fixture has an initiative with a session pill', false);
134
-
135
- // C6 keys: arrows move between rows; Escape closes and gives the focus back to the tile
136
- await A.page.focus('#hmList .hv-rc .hv-rcb .hm-rm');
137
- await A.page.keyboard.press('ArrowDown');
138
- const mv = await A.page.evaluate(() => { const all = [...document.querySelectorAll('#hmList .hv-rc .hv-rcb .hm-rm, #hmList .hv-rc .hv-rcb .hv-fold')]; return all.indexOf(document.activeElement); });
139
- ok('C6 ArrowDown moves to the next row', mv === 1, String(mv));
140
- await A.page.keyboard.press('Escape');
141
- await until(() => card(A.page).then((c) => !c));
142
- ok('C6 Escape closes the card and gives the focus back to its tile', !(await card(A.page)) && await A.page.evaluate((k) => document.activeElement && document.activeElement.dataset.czVwRail === k, prog.key), String(prog.key));
143
- ok('C6 the Viewer is still open after Escape closed the card', (await lay(A.page)).vw === l0.vw);
144
- await A.page.keyboard.press('Enter');
145
- const c6 = await until(() => card(A.page));
146
- ok('C6 Enter on the tile opens it again, the focus on its first row', !!c6 && await A.page.evaluate(() => !!document.activeElement.closest('.hv-rc .hv-rcb')));
147
- await A.page.click(`.cz-vw-railtile[data-cz-vw-rail="${prog.key}"]`);
148
- await until(() => card(A.page).then((c) => !c));
149
- ok('C6 a second press on the tile closes it', !(await card(A.page)));
150
- await A.page.click(`.cz-vw-railtile[data-cz-vw-rail="${prog.key}"]`); await until(() => card(A.page));
151
- await A.page.mouse.click(900, 600);
152
- await until(() => card(A.page).then((c) => !c));
153
- ok('C6 a press outside closes it', !(await card(A.page)));
154
- await A.page.click(`.cz-vw-railtile[data-cz-vw-rail="${prog.key}"]`); await until(() => card(A.page));
155
- await A.page.click('#hmList .hv-rc [data-hm-rcx]');
156
- await until(() => card(A.page).then((c) => !c));
157
- ok('C2 × closes it', !(await card(A.page)));
158
-
159
- // C4 a product's row: it opens, the card closes, the rail and the Viewer stay
160
- await A.page.click(`.cz-vw-railtile[data-cz-vw-rail="${prod.key}"]`);
161
- const c4 = await until(() => card(A.page));
162
- ok('C2 a product\'s card: its name opens the product; no milestone', !!c4 && /, a product$/.test(c4.head) && !c4.ms, JSON.stringify(c4));
163
- await shot(A.page, 'card-product-1440');
164
- // Home shows only the rows with a call (home-nav-rows-with-a-call): the card folds the rest into "N more", which opens them in place
165
- if (await A.page.$('#hmList .hv-rc .hv-fold[aria-expanded="false"]')) { await A.page.click('#hmList .hv-rc .hv-fold[aria-expanded="false"]'); await until(() => A.page.$('#hmList .hv-rc .hv-rcb .hv-r.ini .hm-rm')); }
166
- const pick = await A.page.evaluate(() => { const b = document.querySelector('#hmList .hv-rc .hv-rcb .hv-r.ini:not(.sel) .hm-rm'); return b ? { id: b.dataset.hmSel, t: b.querySelector('.hm-rt b').textContent } : null; });
167
- if (pick) {
168
- await A.page.click(`#hmList .hv-rc .hm-rm[data-hm-sel="${pick.id}"]`);
169
- await until(() => card(A.page).then((c) => !c));
170
- const l4 = await until(() => lay(A.page).then((l) => (l.title && l.title.includes(pick.t) ? l : null)), 8000);
171
- ok('C4 a row press opens it in the Viewer and closes the card', !!l4 && !(await card(A.page)), JSON.stringify([pick, await lay(A.page)]));
172
- ok('C4 the rail stays folded and the Viewer as wide', !!l4 && l4.rail && l4.vw === l0.vw, JSON.stringify([l0, l4]));
173
- const T4 = await tiles(A.page);
174
- ok('C5 the blue bar moves to the tile of the group that now holds what is open', T4.filter((t) => t.here).map((t) => t.key).join() === prod.key, JSON.stringify(T4));
175
- await shot(A.page, 'after-pick-1440');
176
- } else ok('C4 the product card has an initiative to pick', false, JSON.stringify(c4));
177
- ok('C the list button keeps its job: it is no card press', await A.page.evaluate(() => { const b = document.querySelector('.cz-vw-railbar [data-cz-vw-rail="show"]'); return !!b && !b.hasAttribute('aria-haspopup') && b.getAttribute('aria-label') === 'Show the list'; }));
178
- ok('C no page error', !A.errors.length, A.errors.join(' | '));
179
- await A.close();
180
-
181
- /* C7 dark */
182
- const K = await open({ dark: true });
183
- await K.page.click('#hmList .hv-r.ini .hm-rm');
184
- await until(() => K.page.evaluate(() => !!document.querySelector('#czViewer:not([hidden])')));
185
- await K.page.click('#hmList .hm-hd [data-hm-fold]');
186
- await until(() => lay(K.page).then((l) => l.rail));
187
- const kt = (await tiles(K.page)).find((t) => /^p:/.test(t.key));
188
- await K.page.click(`.cz-vw-railtile[data-cz-vw-rail="${kt.key}"]`);
189
- const k1 = await until(() => card(K.page));
190
- const lightBg = c1 && c1.bg;
191
- ok('C7 dark: the card takes the dark card colour from the tokens', !!k1 && k1.bg !== lightBg && k1.bg === await K.page.evaluate(() => getComputedStyle(document.querySelector('.cz')).getPropertyValue('--cz-card').trim() ? getComputedStyle(document.querySelector('#hmList .hv-rc')).backgroundColor : ''), JSON.stringify([k1 && k1.bg, lightBg]));
192
- await shot(K.page, 'card-dark-1440');
193
- ok('C7 no page error', !K.errors.length, K.errors.join(' | '));
194
- await K.close();
195
- return finish();
196
- })();