create-pmos 0.691.0 → 0.693.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 (111) hide show
  1. package/package.json +20 -14
  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 +19 -0
  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/cli.md +3 -1
  17. package/workspace/guide/home.md +1 -1
  18. package/workspace/guide/layout.md +2 -2
  19. package/workspace/guide/settings-and-switches.md +0 -1
  20. package/workspace/impact-screens-test.js +2 -47
  21. package/workspace/ini-workflow-test.js +1 -1
  22. package/workspace/lib/board-premium.js +10 -2
  23. package/workspace/lib/initiative-cli.js +31 -4
  24. package/workspace/lib/initiative-origin.js +131 -0
  25. package/workspace/lib/initiative-writer.js +35 -2
  26. package/workspace/lib/routes-boards.js +4 -1
  27. package/workspace/live-pill-round-test.js +6 -18
  28. package/workspace/milestone-suggest-test.js +4 -28
  29. package/workspace/news-viewers-test.js +3 -29
  30. package/workspace/package-lock.json +2 -2
  31. package/workspace/package.json +1 -1
  32. package/workspace/premium-board-actions-test.js +2 -2
  33. package/workspace/premium-briefing-depth-test.js +4 -4
  34. package/workspace/premium-chat-attach-test.js +3 -2
  35. package/workspace/premium-chat-chart-tab-test.js +8 -7
  36. package/workspace/premium-chat-context-test.js +3 -1
  37. package/workspace/premium-chat-goal-view-test.js +3 -1
  38. package/workspace/premium-chat-line-test.js +8 -6
  39. package/workspace/premium-chat-report-tab-test.js +13 -5
  40. package/workspace/premium-chat-term-test.js +2 -2
  41. package/workspace/premium-chat-viewer-test.js +10 -16
  42. package/workspace/premium-core-doc-issue-test.js +7 -2
  43. package/workspace/premium-discuss-landing-test.js +9 -5
  44. package/workspace/premium-html-viewer-test.js +7 -3
  45. package/workspace/premium-link-suggest-test.js +6 -10
  46. package/workspace/premium-phone-card-test.js +2 -2
  47. package/workspace/premium-viewer-download-test.js +1 -1
  48. package/workspace/premium-viewer-flicker-test.js +1 -1
  49. package/workspace/premium-viewer-share-test.js +2 -2
  50. package/workspace/premium-viewer-test.js +1 -1
  51. package/workspace/premium-vw-cal-test.js +1 -1
  52. package/workspace/premium-vw-copy-test.js +3 -3
  53. package/workspace/premium-vw-doc-test.js +1 -1
  54. package/workspace/premium-vw-item-test.js +1 -1
  55. package/workspace/premium-work-depth-test.js +2 -2
  56. package/workspace/program-charter-test.js +1 -12
  57. package/workspace/program-leave-test.js +2 -2
  58. package/workspace/program-order-test.js +3 -65
  59. package/workspace/project-onboard-flow-test.js +5 -5
  60. package/workspace/public/pm/bd-work.js +24 -5
  61. package/workspace/public/pm/cozy-home.css +0 -6
  62. package/workspace/public/pm/cozy-panels.js +2 -6
  63. package/workspace/public/pm/cozy-popup.css +1 -0
  64. package/workspace/public/pm/cozy-popup.js +15 -2
  65. package/workspace/public/pm/cozy-today-page.css +1 -1
  66. package/workspace/public/pm/cozy-today.css +0 -14
  67. package/workspace/public/pm/cozy-viewer.js +14 -38
  68. package/workspace/public/pm/goal-chat.js +2 -2
  69. package/workspace/public/pm/home-app.js +8 -67
  70. package/workspace/public/pm/home-chat.js +1 -1
  71. package/workspace/public/pm/home-ses-name.js +3 -2
  72. package/workspace/public/pm/home-today.js +4 -18
  73. package/workspace/public/premium-intelligence.html +1 -1
  74. package/workspace/public/premium-viewer.html +1 -1
  75. package/workspace/public/premium-workflows.html +1 -1
  76. package/workspace/ready-dash-ui-test.js +1 -1
  77. package/workspace/rename-test.js +2 -2
  78. package/workspace/server.js +11 -12
  79. package/workspace/session-names-test.js +34 -56
  80. package/workspace/sort-order-test.js +2 -71
  81. package/workspace/split-merge-ui-test.js +1 -1
  82. package/workspace/stage-card-tasks-test.js +1 -1
  83. package/workspace/stage-card-test.js +1 -1
  84. package/workspace/task-card-test.js +1 -1
  85. package/workspace/task-press-test.js +1 -1
  86. package/workspace/task-views-test.js +1 -1
  87. package/workspace/test-lists/adler-seasons-art.json +3 -6
  88. package/workspace/test-lists/batch18-asks.json +1 -1
  89. package/workspace/test-lists/briefing-premium.json +1 -11
  90. package/workspace/test-lists/premium-agreed-viewer.json +1 -1
  91. package/workspace/test-lists/who-raised-each-idea.json +5 -0
  92. package/workspace/test-run.js +0 -2
  93. package/workspace/test-timings.json +0 -4
  94. package/workspace/tk-tasks-test.js +3 -17
  95. package/workspace/viewer-trail-test.js +2 -2
  96. package/workspace/workflows-setup-test.js +4 -2
  97. package/workspace/adler-seasons-art-test.js +0 -116
  98. package/workspace/briefing-premium-initiative-test.js +0 -289
  99. package/workspace/briefing-premium-products-test.js +0 -209
  100. package/workspace/briefing-premium-sources-test.js +0 -250
  101. package/workspace/briefing-premium-test.js +0 -282
  102. package/workspace/home-other-product-test.js +0 -197
  103. package/workspace/home-pill-test.js +0 -138
  104. package/workspace/home-railcard-test.js +0 -196
  105. package/workspace/home-rows-test.js +0 -389
  106. package/workspace/panels-test.js +0 -454
  107. package/workspace/public/premium.html +0 -48
  108. package/workspace/test-lists/batch18-panels.json +0 -9
  109. package/workspace/test-lists/home-railcard.json +0 -9
  110. package/workspace/test-lists/home-sessions-pill.json +0 -6
  111. package/workspace/test-lists/viewer-home-rows.json +0 -9
@@ -1,197 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
- /* home-other-product-test.js — an initiative and a product of ANOTHER product Home reads (testing fix, 2026-10-25). Home on IDPF also lists
4
- * Microsites as its own group (D.others). Pressing a Microsites initiative read it from IDPF's board, so the Viewer said "The initiative could
5
- * not be read", and pressing the Microsites heading moved the whole page to the Microsites workspace, so the IDPF chat was gone.
6
- * O1 a Microsites initiative is read from the Microsites board (ws=microsites), and its page opens in the Viewer under its own title
7
- * O2 the chat is the initiative's own, named by its title (its target carries ws=microsites)
8
- * O3 the Microsites heading opens its page in the Viewer and Home stays on IDPF: no navigation, the list keeps the IDPF group
9
- * O5 its chat's first message starts a session in Microsites, and "A new session" (In: chip, + New) starts a second one beside it
10
- * O6 batch 11 item 10: an initiative `pmos initiative new` made in Microsites sits in Later, so the Microsites model does not list it. Its
11
- * next step (tagged ws=microsites) puts it on Home; pressing it reads it from Microsites, never IDPF's board, under its title
12
- * O8 batch 14 item 9: the product's name in its page's header renames it (POST /api/workspaces/rename), with Undo
13
- * O7 the same initiative opened by a link with no next step: the read on IDPF fails, the Microsites one finds it, and its chat is Microsites'
14
- * Serves the real page from the real server; the reads are fixtures (fixtures/program-ascent.js through the Board and Home fixtures). */
15
- const path = require('path');
16
- const { spawn } = require('child_process');
17
- const { findBrowser } = require('./lib/find-browser');
18
- const { besidePage } = require('./lib/beside-page'); // these checks are about work beside the page, not the popup
19
- const T = require('./test-run').configure({ name: 'home-other-product' });
20
- const IP = require('./lib/initiative-premium.js');
21
- const F = require('./fixtures/initiative-premium-facts.js');
22
- const BP = require('./lib/board-premium.js');
23
- const BF = require('./fixtures/board-premium-facts.js');
24
- const BRP = require('./lib/briefing-premium.js');
25
- const BRF = require('./fixtures/briefing-premium-facts.js');
26
-
27
- const BASE = T.BASE;
28
- const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
29
- const until = async (fn, ms = 20000, step = 100) => { const t0 = Date.now(); for (;;) { let v = null; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
30
- const results = [];
31
- const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 400) : ''}`); };
32
- let srv = null; let browser = null;
33
- const finish = async (code) => {
34
- if (browser) await browser.close().catch(() => {});
35
- if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
36
- T.killTmux();
37
- const bad = results.filter((x) => !x.cond).length;
38
- console.log(`\n${results.length - bad}/${results.length} home-other-product assertions passed`);
39
- process.exit(code !== undefined ? code : (bad ? 1 : 0));
40
- };
41
- process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
42
-
43
- const ID = 'psle-refresh', TITLE = 'PSLE microsite refresh'; // a Microsites initiative (fixtures/program-ascent.js)
44
- // the Microsites initiative's model: the Initiatives fixture, as this initiative on the Microsites board
45
- const model = () => { const m = IP.build(F.facts()); return { ...m, id: ID, key: 'init:' + ID, title: TITLE, board: { ...m.board, ws: 'microsites', id: 'microsites', name: 'Microsites' } }; };
46
-
47
- (async () => {
48
- const exe = findBrowser();
49
- if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
50
- let chromium;
51
- try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
52
- srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
53
- await T.waitForServer(BASE);
54
- browser = besidePage(await chromium.launch({ executablePath: exe }));
55
-
56
- const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
57
- const page = await ctx.newPage();
58
- const errors = [], reads = [], opens = [];
59
- page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
60
- page.on('load', () => opens.push(page.url())); // a full load; pushState and replaceState are not one
61
- const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
62
- // the real route reads the board the query names: the Microsites initiative is not on IDPF's board, so a read there is a 404
63
- await page.route('**/api/initiative-premium*', (r) => {
64
- const q = new URL(r.request().url()).searchParams; reads.push({ id: q.get('id'), ws: q.get('ws'), board: q.get('board') });
65
- if (q.get('id') === ID && q.get('ws') === 'microsites') return json(r, { ok: true, state: 'ready', model: model(), as_of: Date.now() });
66
- return json(r, { ok: false, state: 'error', error: 'no work-lane initiative ' + q.get('id') + ' in this workspace' }, 404);
67
- });
68
- 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() }); });
69
- await page.route(/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BRP.buildMany(BRF.programFacts()), as_of: Date.now() }));
70
- await page.route('**/api/programs', (r) => json(r, { ok: true, programs: [] })); // no program: each initiative sits in its product's group
71
- await page.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
72
- await page.goto(BASE + '/premium.html?ws=idpf');
73
- const row = `#hmList [data-hm-sel="i:${ID}"]`;
74
- const listed = await until(async () => {
75
- // a closed group opens; "N more" opens the rows with no call (home-nav-rows-with-a-call)
76
- await page.evaluate(() => document.querySelectorAll('#hmList [data-hm-pg][aria-expanded="false"], #hmList .hv-fold[aria-expanded="false"]').forEach((b) => b.click())).catch(() => {});
77
- return page.evaluate((s) => { const b = document.querySelector(s); return !!b && !!b.offsetParent; }, row);
78
- }, 40000);
79
- ok('O0 Home on IDPF lists the Microsites initiative in the Microsites group', listed);
80
-
81
- await page.click(row);
82
- const V = '#czViewer:not([hidden])';
83
- const st = await until(() => page.evaluate((v) => { const o = document.querySelector(v); if (!o) return null; if (o.querySelector('[data-hi-v="page"]')) return 'ok'; return /could not be read/.test(o.textContent) ? 'err' : null; }, V), 30000);
84
- ok('O1 the initiative\'s page opens in the Viewer, not "The initiative could not be read"', st === 'ok', st);
85
- const last = reads.filter((x) => x.id === ID).pop();
86
- ok('O1 it is read from the Microsites board', !!last && last.ws === 'microsites' && last.board === 'microsites', JSON.stringify(reads));
87
- ok('O1 the Viewer names it by its title, not its id', await until(() => page.evaluate((a) => ((document.querySelector(a[0] + ' .cz-vw-title, ' + a[0] + ' h1, ' + a[0] + ' [data-cz-vw-title]') || {}).textContent || '').includes(a[1]), [V, TITLE]), 5000));
88
- ok('O2 the chat is the initiative\'s own, named by its title', await page.evaluate((t) => (document.querySelector('#hmChat textarea, textarea') || {}).placeholder === 'Message PMOS about ' + t, TITLE));
89
-
90
- // O3 the Microsites heading: its page in the Viewer, Home stays on IDPF
91
- const navs = opens.length;
92
- const head = await page.evaluate(() => { const b = [...document.querySelectorAll('#hmList [data-hm-prodopen]')].find((x) => /Microsites/.test(x.getAttribute('aria-label') || '')); if (!b) return false; b.click(); return true; });
93
- ok('O3 the Microsites heading is pressable', head);
94
- ok('O3 its page opens in the Viewer with its goals', await until(() => page.evaluate((v) => { const o = document.querySelector(v); return !!o && !!o.querySelector('[aria-label="Goals"]') && /Microsites/.test(o.textContent); }, V), 10000));
95
- await sleep(500);
96
- ok('O3 Home stays on IDPF: no navigation, and the IDPF group is still in the list', opens.length === navs && new URL(page.url()).searchParams.get('ws') === 'idpf' && await page.evaluate(() => [...document.querySelectorAll('#hmList [data-hm-prodopen]')].some((b) => /IDPF/.test(b.getAttribute('aria-label') || ''))), JSON.stringify(opens.slice(navs)) + ' ' + page.url());
97
- ok('O3 the chat is the Microsites product\'s own', await page.evaluate(() => (document.querySelector('#hmChat textarea, textarea') || {}).placeholder === 'Message PMOS about Microsites'));
98
- // O8 batch 14 item 9 (Wawan, "Should be able to rename product"): the product's name in its page's header is the rename press. It saves
99
- // the PM's name for the repository (POST /api/workspaces/rename, the id stays) and the header shows the new name.
100
- const renames = [];
101
- await page.route('**/api/workspaces/rename', (r) => { renames.push(JSON.parse(r.request().postData() || '{}')); return json(r, { ok: true, workspace: { id: 'microsites', name: 'Microsites web', label: 'Microsites web' } }); });
102
- const rnBtn = await until(() => page.evaluate((v) => { const b = document.querySelector(v + ' [data-cz-vw-rn]'); if (!b || !/Microsites/.test(b.textContent)) return false; b.click(); return true; }, V), 5000);
103
- ok('O8 the product\'s name in its page header is a rename press', rnBtn);
104
- if (rnBtn) { await page.fill(V + ' [data-cz-vw-ren] input', 'Microsites web'); await page.keyboard.press('Enter'); }
105
- ok('O8 it saves the name for the Microsites repository', await until(() => renames.length === 1, 5000) && renames[0].id === 'microsites' && renames[0].name === 'Microsites web', JSON.stringify(renames));
106
- ok('O8 the header shows the new name, with Undo in the toast', await until(() => page.evaluate((v) => /Microsites web/.test((document.querySelector(v + ' #czVwTitle') || {}).textContent || '') && /Undo/.test((document.querySelector('#toast') || {}).textContent || ''), V), 5000));
107
- // O5 a product's chat starts its first session and, like an initiative, a new one beside it (batch 9 item 3, Wawan 2026-10-26: "I can't
108
- // initiate a new session" on pmos-scarlet). Each send asks with the product's own key in its own workspace; a new session has the next key.
109
- const asks = [];
110
- await page.route('**/api/briefing-premium/ask*', (r) => { asks.push({ ws: new URL(r.request().url()).searchParams.get('ws'), ...JSON.parse(r.request().postData() || '{}') }); return json(r, { ok: true, session: 'sess-' + asks.length, started: true }); });
111
- await page.fill('#hmIn', 'How is Microsites doing?'); await page.keyboard.press('Enter');
112
- ok('O5 the first message starts the Microsites product chat in its workspace', await until(() => asks.length === 1, 5000) && asks[0].key === 'chat:product:microsites' && asks[0].ws === 'microsites', JSON.stringify(asks));
113
- await page.click('#hmChat [data-hm-scope]');
114
- const fresh = await until(() => page.evaluate(() => { const b = [...document.querySelectorAll('#hmMenu [role=menuitem], #hmMenu button')].find((x) => /A new session/.test(x.textContent)); if (!b) return null; const sub = b.textContent; b.click(); return sub; }), 3000);
115
- ok('O5 its In: chip offers "A new session" in Microsites', !!fresh && /Microsites/.test(fresh), fresh);
116
- ok('O5 the new session\'s chat is open, empty and still about Microsites', await until(() => page.evaluate(() => { const t = document.querySelector('#hmIn'); return !!t && t.placeholder === 'Message PMOS about Microsites' && /A new session in Microsites/.test(document.querySelector('#hmChat').textContent); }), 3000));
117
- await page.fill('#hmIn', 'A second thread'); await page.keyboard.press('Enter');
118
- ok('O5 it sends with the next key, so a second session starts beside the first', await until(() => asks.length === 2, 5000) && asks[1].key === 'chat:product:microsites:2' && asks[1].ws === 'microsites', JSON.stringify(asks));
119
- await page.click('[data-hm-new]');
120
- const nw = await until(() => page.evaluate(() => [...document.querySelectorAll('#hmMenu [role=menuitem], #hmMenu button')].map((x) => x.textContent).find((x) => /^Chat/.test(x)) || null), 3000);
121
- ok('O5 the + New menu\'s Chat names the product on its right: "Chat Microsites" (batch 14 item 10)', !!nw && /^ChatMicrosites$/.test(nw), nw);
122
- await page.keyboard.press('Escape');
123
-
124
- // O4 a phone (Wawan, 2026-10-25): the chat is not beside the page, so the page ends with the way to its own chat
125
- const pctx = await browser.newContext({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true });
126
- const pp = await pctx.newPage();
127
- pp.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
128
- for (const [pat, fn] of [['**/api/initiative-premium*', (r) => json(r, { ok: false, state: 'error', error: 'none' }, 404)],
129
- [/\/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() }); }],
130
- [/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BRP.buildMany(BRF.programFacts()), as_of: Date.now() })],
131
- ['**/api/programs', (r) => json(r, { ok: true, programs: [] })],
132
- ['**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false })]]) await pp.route(pat, fn);
133
- await pp.goto(BASE + '/premium.html?ws=idpf');
134
- const ph = await until(() => pp.evaluate(() => { const b = [...document.querySelectorAll('#hmList [data-hm-prodopen]')].find((x) => /Microsites/.test(x.getAttribute('aria-label') || '')); if (!b || !b.offsetParent) return false; b.click(); return true; }), 40000);
135
- ok('O4 a phone: the Microsites heading is pressable', ph);
136
- const tk = await until(() => pp.evaluate((v) => { const t = document.querySelector(v + ' .hi-talk'); return !!t && !!t.offsetParent && /Message PMOS about Microsites/.test(t.textContent); }, V), 10000);
137
- ok('O4 a phone: its page ends with "Message PMOS about Microsites"', tk);
138
- if (tk) await pp.click(V + ' .hi-talk');
139
- ok('O4 a phone: the press opens the Microsites chat full screen, the page closed', await until(() => pp.evaluate(() => { const t = document.querySelector('#hmChat textarea, textarea'); return !document.querySelector('#czViewer:not([hidden]) .hi-talk') && !!t && !!t.offsetParent && t.placeholder === 'Message PMOS about Microsites'; }), 5000));
140
- await pctx.close();
141
-
142
- // O6, O7 (batch 11 item 10): an initiative made by `pmos initiative new` in Microsites, unplaced (Later), so not on the model's list
143
- const NEW = 'psle-addon-follow-on', NEW_TITLE = 'PSLE Companion add-on follow-on plan';
144
- const newModel = () => ({ ...model(), id: NEW, key: 'init:' + NEW, title: NEW_TITLE });
145
- const later = async (withStep) => {
146
- const c = await browser.newContext({ viewport: { width: 1440, height: 900 } });
147
- const pg = await c.newPage(), rd = [], asked = [];
148
- pg.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
149
- await pg.route('**/api/initiative-premium*', (r) => {
150
- const q = new URL(r.request().url()).searchParams; rd.push({ id: q.get('id'), ws: q.get('ws'), board: q.get('board') });
151
- // the real route: a workspace's default board when none is named; an id on another board is a 404
152
- if (q.get('id') === NEW && q.get('ws') === 'microsites' && (!q.get('board') || q.get('board') === 'microsites')) return json(r, { ok: true, state: 'ready', model: newModel(), as_of: Date.now() });
153
- return json(r, { ok: false, state: 'error', error: 'no work-lane initiative ' + q.get('id') + ' in this workspace' }, 404);
154
- });
155
- await pg.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() }); });
156
- await pg.route(/\/api\/briefing-premium(\?.*)?$/, (r) => {
157
- const m = BRP.buildMany(BRF.programFacts());
158
- if (withStep) m.list.rows = [{ key: 'blocked:' + NEW + ':microsites', kind: 'blocked', title: 'Unblock the brief step', subject: NEW_TITLE, prepared: '', product: 'Microsites', ws: 'microsites', from: [NEW] }].concat(m.list.rows || []);
159
- return json(r, { ok: true, state: 'ready', model: m, as_of: Date.now() });
160
- });
161
- await pg.route('**/api/programs', (r) => json(r, { ok: true, programs: [] }));
162
- // the last route added wins: the ask's own after the catch-all
163
- await pg.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
164
- await pg.route('**/api/briefing-premium/ask*', (r) => { asked.push({ ws: new URL(r.request().url()).searchParams.get('ws') }); return json(r, { ok: true, session: 'sess-x', started: true }); });
165
- await pg.goto(BASE + '/premium.html?ws=idpf' + (withStep ? '' : '&ini=' + NEW));
166
- return { c, pg, rd, asked };
167
- };
168
- const pageState = (pg) => until(() => pg.evaluate((v) => { const o = document.querySelector(v); if (!o) return null; if (o.querySelector('[data-hi-v="page"]')) return 'ok'; return /could not be read/.test(o.textContent) ? 'err' : null; }, V), 30000);
169
- {
170
- const { c, pg, rd } = await later(true);
171
- const nrow = `#hmList [data-hm-sel="i:${NEW}"]`;
172
- const seen = await until(async () => {
173
- await pg.evaluate(() => document.querySelectorAll('#hmList [data-hm-pg][aria-expanded="false"]').forEach((b) => b.click())).catch(() => {});
174
- return pg.evaluate((s) => { const b = document.querySelector(s); return !!b && !!b.offsetParent; }, nrow);
175
- }, 40000);
176
- ok('O6 the Microsites initiative in Later shows on Home under its next step', seen);
177
- if (seen) await pg.click(nrow);
178
- const s6 = await pageState(pg);
179
- ok('O6 its page opens, not "The initiative could not be read"', s6 === 'ok', s6);
180
- ok('O6 it is read from Microsites, never from IDPF\'s board', rd.some((x) => x.id === NEW && x.ws === 'microsites') && !rd.some((x) => x.id === NEW && (x.board === 'idpf' || (x.ws || 'idpf') === 'idpf')), JSON.stringify(rd));
181
- ok('O6 the chat names it by its title, not its id', await until(() => pg.evaluate((t) => (document.querySelector('#hmIn') || {}).placeholder === 'Message PMOS about ' + t, NEW_TITLE), 5000), await pg.evaluate(() => (document.querySelector('#hmIn') || {}).placeholder));
182
- await c.close();
183
- }
184
- {
185
- const { c, pg, rd, asked } = await later(false);
186
- const s7 = await pageState(pg);
187
- ok('O7 opened by a link with no next step: its page opens from Microsites', s7 === 'ok', s7 + ' ' + JSON.stringify(rd));
188
- ok('O7 the chat is its own, in Microsites', await until(() => pg.evaluate((t) => (document.querySelector('#hmIn') || {}).placeholder === 'Message PMOS about ' + t, NEW_TITLE), 5000), await pg.evaluate(() => (document.querySelector('#hmIn') || {}).placeholder));
189
- await pg.fill('#hmIn', 'What is next?'); await pg.keyboard.press('Enter');
190
- ok('O7 its first message starts the session in Microsites', await until(() => asked.length >= 1, 5000) && asked[0].ws === 'microsites', JSON.stringify(asked));
191
- await c.close();
192
- }
193
-
194
- ok('no page error', errors.length === 0, errors.join(' | '));
195
- await ctx.close();
196
- return finish();
197
- })().catch((e) => { console.error(e); finish(1); });
@@ -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
- })();