create-pmos 0.397.0 → 0.399.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 (195) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  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/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +105 -52
  8. package/workspace/briefing-premium-board-test.js +284 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +85 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +99 -83
  13. package/workspace/briefing-premium-initiative-test.js +175 -290
  14. package/workspace/briefing-premium-insights-test.js +414 -219
  15. package/workspace/briefing-premium-metrics-test.js +55 -97
  16. package/workspace/briefing-premium-products-test.js +44 -28
  17. package/workspace/briefing-premium-sources-test.js +70 -49
  18. package/workspace/briefing-premium-test.js +155 -648
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +24 -0
  21. package/workspace/ev-everywhere-test.js +210 -0
  22. package/workspace/fixtures/board-premium-trail.js +32 -0
  23. package/workspace/fixtures/premium-viewer-fixtures.js +187 -0
  24. package/workspace/guide/briefing-premium.md +3 -1
  25. package/workspace/guide/home.md +68 -0
  26. package/workspace/guide/index.md +1 -0
  27. package/workspace/lib/agent-roles.js +71 -0
  28. package/workspace/lib/board-grill.js +63 -0
  29. package/workspace/lib/board-premium.js +121 -24
  30. package/workspace/lib/board-trail.js +223 -0
  31. package/workspace/lib/home-work-item.js +58 -0
  32. package/workspace/lib/initiative-layout.js +77 -0
  33. package/workspace/lib/insights-goals.js +196 -0
  34. package/workspace/lib/insights-premium.js +64 -15
  35. package/workspace/lib/insights-records.js +115 -0
  36. package/workspace/lib/jira-tickets.js +1 -1
  37. package/workspace/lib/meeting-points.js +52 -0
  38. package/workspace/lib/news-for-you.js +88 -0
  39. package/workspace/lib/notes-series.js +29 -6
  40. package/workspace/lib/report-confirm.js +48 -0
  41. package/workspace/lib/route-modules.js +12 -0
  42. package/workspace/lib/routes-board-docs.js +46 -0
  43. package/workspace/lib/routes-board-grill.js +90 -0
  44. package/workspace/lib/routes-board-trail.js +33 -0
  45. package/workspace/lib/routes-home-desk.js +176 -0
  46. package/workspace/lib/routes-home-review.js +108 -0
  47. package/workspace/lib/routes-initiative-layout.js +57 -0
  48. package/workspace/lib/routes-insights-premium.js +16 -4
  49. package/workspace/lib/routes-insights-records.js +133 -0
  50. package/workspace/lib/routes-meeting-points.js +37 -0
  51. package/workspace/lib/routes-news.js +57 -0
  52. package/workspace/lib/routes-notes.js +3 -1
  53. package/workspace/lib/routes-report-confirm.js +31 -0
  54. package/workspace/lib/routes-search.js +38 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/search-index.js +176 -0
  57. package/workspace/lib/transcript-steps.js +123 -0
  58. package/workspace/lib/viewer-meeting.js +205 -0
  59. package/workspace/lib/viewer-report.js +89 -0
  60. package/workspace/package-lock.json +2 -2
  61. package/workspace/package.json +1 -1
  62. package/workspace/premium-board-actions-test.js +128 -82
  63. package/workspace/premium-briefing-depth-test.js +104 -90
  64. package/workspace/premium-chat-attach-test.js +54 -63
  65. package/workspace/premium-chat-chart-tab-test.js +37 -37
  66. package/workspace/premium-chat-context-test.js +19 -18
  67. package/workspace/premium-chat-goal-view-test.js +23 -23
  68. package/workspace/premium-chat-notes-test.js +26 -31
  69. package/workspace/premium-chat-report-tab-test.js +46 -28
  70. package/workspace/premium-chat-term-test.js +16 -16
  71. package/workspace/premium-chat-viewer-test.js +60 -59
  72. package/workspace/premium-core-doc-issue-test.js +52 -43
  73. package/workspace/premium-html-viewer-test.js +14 -17
  74. package/workspace/premium-phone-card-test.js +10 -3
  75. package/workspace/premium-phone-room-test.js +41 -35
  76. package/workspace/premium-report-read-test.js +152 -197
  77. package/workspace/premium-viewer-download-test.js +19 -22
  78. package/workspace/premium-viewer-flicker-test.js +11 -16
  79. package/workspace/premium-viewer-share-test.js +6 -9
  80. package/workspace/premium-viewer-test.js +41 -60
  81. package/workspace/premium-vw-backlog-test.js +53 -33
  82. package/workspace/premium-vw-cal-test.js +97 -128
  83. package/workspace/premium-vw-copy-test.js +17 -33
  84. package/workspace/premium-vw-doc-test.js +17 -10
  85. package/workspace/premium-vw-item-test.js +50 -49
  86. package/workspace/premium-vw-jira-test.js +53 -27
  87. package/workspace/premium-vw-meet-test.js +115 -187
  88. package/workspace/premium-vw-notes-test.js +88 -109
  89. package/workspace/premium-vw-rec-test.js +71 -194
  90. package/workspace/premium-vw-slides-test.js +46 -50
  91. package/workspace/premium-welcome-test.js +3 -2
  92. package/workspace/premium-work-depth-test.js +61 -53
  93. package/workspace/public/pm/bd-acts.js +383 -0
  94. package/workspace/public/pm/bd-asks.js +261 -0
  95. package/workspace/public/pm/bd-pop.js +59 -0
  96. package/workspace/public/pm/bd-span.js +222 -82
  97. package/workspace/public/pm/bd-stages.js +25 -11
  98. package/workspace/public/pm/bd-views.js +169 -0
  99. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  100. package/workspace/public/pm/c3-md.js +3 -395
  101. package/workspace/public/pm/c3-phone-detail.js +1 -1
  102. package/workspace/public/pm/c3-phone-model.js +3 -68
  103. package/workspace/public/pm/chat-term.js +3 -3
  104. package/workspace/public/pm/cozy-board.css +798 -230
  105. package/workspace/public/pm/cozy-ev.css +228 -0
  106. package/workspace/public/pm/cozy-evmodel.js +106 -0
  107. package/workspace/public/pm/cozy-evui.js +47 -0
  108. package/workspace/public/pm/cozy-home.css +570 -142
  109. package/workspace/public/pm/cozy-home.js +5 -3
  110. package/workspace/public/pm/cozy-insights.css +437 -170
  111. package/workspace/public/pm/cozy-md.js +396 -0
  112. package/workspace/public/pm/cozy-nav.js +104 -29
  113. package/workspace/public/pm/cozy-news.js +140 -0
  114. package/workspace/public/pm/cozy-placeholder.js +26 -0
  115. package/workspace/public/pm/cozy-search.js +203 -0
  116. package/workspace/public/pm/cozy-settings.js +198 -0
  117. package/workspace/public/pm/cozy-sources.js +89 -0
  118. package/workspace/public/pm/cozy-today.css +217 -0
  119. package/workspace/public/pm/cozy-viewer.css +3 -3
  120. package/workspace/public/pm/cozy-viewer.js +145 -0
  121. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  122. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  123. package/workspace/public/pm/cozy-vw.css +485 -0
  124. package/workspace/public/pm/cozy.css +83 -1
  125. package/workspace/public/pm/home-adddoc.js +48 -0
  126. package/workspace/public/pm/home-app.js +1179 -0
  127. package/workspace/public/pm/home-around.js +413 -0
  128. package/workspace/public/pm/home-chat.js +512 -0
  129. package/workspace/public/pm/home-data.js +312 -0
  130. package/workspace/public/pm/home-dictate.js +54 -0
  131. package/workspace/public/pm/home-draft.js +68 -0
  132. package/workspace/public/pm/home-ini-model.js +190 -0
  133. package/workspace/public/pm/home-ini.css +171 -0
  134. package/workspace/public/pm/home-ini.js +456 -0
  135. package/workspace/public/pm/home-list.js +276 -0
  136. package/workspace/public/pm/home-more.js +132 -0
  137. package/workspace/public/pm/home-phone-card.js +109 -0
  138. package/workspace/public/pm/home-review.js +104 -0
  139. package/workspace/public/pm/home-task.js +67 -0
  140. package/workspace/public/pm/home-today.js +144 -0
  141. package/workspace/public/pm/home-work.js +547 -0
  142. package/workspace/public/pm/phone-moment.js +69 -0
  143. package/workspace/public/pm/pm-work-view.js +1 -1
  144. package/workspace/public/pm/premium-attach.js +4 -0
  145. package/workspace/public/pm/premium-board.js +548 -395
  146. package/workspace/public/pm/premium-chart-tab.js +109 -62
  147. package/workspace/public/pm/premium-deck.js +3 -3
  148. package/workspace/public/pm/premium-first.js +23 -21
  149. package/workspace/public/pm/premium-insights.js +1102 -581
  150. package/workspace/public/pm/premium-meeting.js +61 -549
  151. package/workspace/public/pm/premium-mtg-present.js +138 -0
  152. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  153. package/workspace/public/pm/premium-notes.js +1 -1
  154. package/workspace/public/pm/premium-report-frame.css +20 -0
  155. package/workspace/public/pm/premium-report-read.js +669 -476
  156. package/workspace/public/pm/premium-report-tab.js +116 -67
  157. package/workspace/public/pm/premium-shell.js +76 -123
  158. package/workspace/public/pm/premium-viewer.js +22 -1
  159. package/workspace/public/pm/premium-vw-cal.js +277 -48
  160. package/workspace/public/pm/premium-vw-doc.css +6 -0
  161. package/workspace/public/pm/premium-vw-doc.js +40 -2
  162. package/workspace/public/pm/premium-vw-file.js +2 -2
  163. package/workspace/public/pm/premium-vw-meet.js +6 -83
  164. package/workspace/public/pm/premium-vw-mtg.js +958 -0
  165. package/workspace/public/pm/premium-vw-notes.js +116 -68
  166. package/workspace/public/pm/premium-vw-open.js +35 -0
  167. package/workspace/public/pm/premium-vw-page.js +16 -0
  168. package/workspace/public/pm/premium-vw-rec.js +11 -218
  169. package/workspace/public/pm/premium-vw-slides.css +5 -0
  170. package/workspace/public/pm/premium-vw-slides.js +44 -8
  171. package/workspace/public/pm/rp-parts.js +269 -0
  172. package/workspace/public/pm/term-view.js +22 -0
  173. package/workspace/public/premium-board.html +29 -70
  174. package/workspace/public/premium-initiative.html +8 -48
  175. package/workspace/public/premium-insights.html +26 -64
  176. package/workspace/public/premium-viewer.html +20 -0
  177. package/workspace/public/premium.html +18 -107
  178. package/workspace/r/m1.png +0 -0
  179. package/workspace/r/m2.png +0 -0
  180. package/workspace/r/m3.png +0 -0
  181. package/workspace/r/nl.png +0 -0
  182. package/workspace/server.js +18 -3
  183. package/workspace/test-files.json +1 -0
  184. package/workspace/test-lists/home-libs.json +9 -0
  185. package/workspace/test-lists/initiative-layout.json +9 -0
  186. package/workspace/test-lists/premium-report-read.json +1 -1
  187. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  188. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  189. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  190. package/workspace/test-lists/premium-vw-notes.json +1 -1
  191. package/workspace/test-lists/uf-everywhere.json +15 -0
  192. package/workspace/test-lists/uf-home.json +9 -0
  193. package/workspace/test-lists/uncovered-board.json +9 -0
  194. package/workspace/public/pm/premium-work.js +0 -729
  195. package/workspace/public/pm/premium.js +0 -1146
@@ -1,22 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- /* premium-vw-notes-test.js — the Notes list and a note opened beside it (initiative premium-viewer, R9; planning/prd/premium-viewer-prd.md).
4
- * Serves the real Briefing from the real server. The Briefing model, the calendar, the notes, the boards, the search and the note are answered by stand-ins,
5
- * so each press can be read off the request the page sent. The routes' own behaviour is in their own suites; the pure half is in premium-vw-notes.test.js.
6
- * N1 open · N2 groups · N3 series · N4 search · N5 the note tab · N6 Change what it is about · N7 writes · N8 floors
3
+ /* premium-vw-notes-test.js — the Notes list and a note opened from it (initiative premium-viewer, R9; re-pointed for premium-agreed-design, area
4
+ * viewer: Main.dc.html viewer prop cal, the Notes side). Serves the real /premium-viewer.html from the real server; the notes, the boards, the
5
+ * search and the note are answered by stand-ins (fixtures/premium-viewer-fixtures.js), so each press can be read off the request the page sent.
6
+ * The routes' own behaviour is in their own suites; the pure half (notesGroups) is in premium-vw-agreed.test.js.
7
+ * N1 open · N2 groups · N3 series · N4 search · N5 a note opens in the card · N6 Change what it is about · N7 writes · N8 floors
7
8
  * Every wait polls the page; no fixed sleep stands in for a state. */
8
9
  const path = require('path');
9
10
  const { spawn } = require('child_process');
10
11
  const { findBrowser } = require('./lib/find-browser');
11
12
  const T = require('./test-run').configure({ name: 'premium-vw-notes' });
12
- const B = require('./lib/briefing-premium.js');
13
- const F = require('./fixtures/briefing-premium-facts.js');
13
+ const F = require('./fixtures/premium-viewer-fixtures.js');
14
14
 
15
- const BASE = T.BASE;
16
- const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
17
- const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
15
+ const BASE = T.BASE, until = F.until;
18
16
  const results = [];
19
- const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
17
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 500) : ''}`); };
20
18
  let srv = null; let browser = null;
21
19
  const finish = async (code) => {
22
20
  if (browser) await browser.close().catch(() => {});
@@ -28,15 +26,6 @@ const finish = async (code) => {
28
26
  };
29
27
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
30
28
 
31
- const NOW = new Date();
32
- const ROWS = [
33
- { id: 'n1', title: 'Weekly sync', state: 'ended', updated_at: NOW.toISOString(), meeting: { kind: 'event', title: 'Weekly sync', start: '2026-10-19T10:00:00+07:00' }, board: { id: 'b1', ws: 'w1', title: 'Growth' }, initiative: { id: 'ux', ws: 'w1', title: 'Premium UX' }, series: { key: 'wk', by: 'calendar' }, meeting_ms: 32 * 60000, summary_lines: ['The copy test was agreed.'] },
34
- { id: 'n0', title: 'Weekly sync', state: 'ended', updated_at: NOW.toISOString(), meeting: { kind: 'event', title: 'Weekly sync', start: '2026-10-12T10:00:00+07:00' }, board: { id: 'b1', ws: 'w1', title: 'Growth' }, series: { key: 'wk', by: 'calendar' }, summary_lines: ['The runbook was asked for.'] },
35
- { id: 'n2', title: 'Exec sync', state: 'ended', updated_at: NOW.toISOString(), meeting: { kind: 'event', title: 'Exec sync', start: '2026-10-16T10:00:00+07:00' }, portfolio: true, meeting_ms: 28 * 60000 },
36
- { id: 'n3', title: 'Call with a partner', state: 'ended', updated_at: NOW.toISOString(), created_at: '2026-10-15T08:00:00Z', meeting: null, summary_lines: ['They want SSO before they move 40 seats.'] },
37
- ];
38
- const NOTE = { id: 'n3', title: 'Call with a partner', state: 'ended', meeting: null, meeting_ms: 22 * 60000, final_notes: { overview: 'The partner wants SSO first.', decisions: [{ text: 'Price SSO in the team plan', why: 'Two partners asked.' }], actions: [{ text: 'Send the SSO plan', owner: 'Ana', due: '2026-10-24' }], questions: [] } };
39
-
40
29
  (async () => {
41
30
  const exe = findBrowser();
42
31
  if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
@@ -45,118 +34,108 @@ const NOTE = { id: 'n3', title: 'Call with a partner', state: 'ended', meeting:
45
34
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
46
35
  await T.waitForServer(BASE);
47
36
  browser = await chromium.launch({ executablePath: exe });
48
-
49
- const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
50
- const SESS = [];
51
- const open = async ({ w = 1280, h = 900, theme = 'light', notes = ROWS } = {}) => {
52
- const ctx = await browser.newContext({ viewport: { width: w, height: h } });
53
- const page = await ctx.newPage();
54
- const S = { errors: [], reqs: [], linkPosts: [], oneGets: [], searches: [], note: { ...NOTE } };
55
- page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
56
- page.on('request', (r) => { if (r.url().startsWith(BASE)) S.reqs.push(r.method() + ' ' + new URL(r.url()).pathname); });
57
- await page.route('**/api/briefing-premium*', (r) => json(r, { ok: true, state: 'ready', model: B.build(F.facts()), as_of: Date.now() }));
58
- await page.route('**/api/calendar-views*', (r) => json(r, { ok: true, view: 'week', cells: [], events_source: 'calendar-memory', context: {}, link_boards: [], gantt: [] }));
59
- await page.route('**/api/notes/search*', (r) => { const q = new URL(r.request().url()).searchParams.get('q'); S.searches.push(q); return json(r, { ok: true, ids: /runbook|said/.test(q) ? ['n0'] : [] }); });
60
- await page.route('**/api/notes/one*', (r) => { const id = new URL(r.request().url()).searchParams.get('id'); S.oneGets.push(id);
61
- const n = id === 'n3' ? S.note : { ...ROWS.find((x) => x.id === id), final_notes: { overview: 'Notes of ' + id, decisions: [], actions: [], questions: [] } };
62
- return json(r, { ok: true, note: n, place: id === 'n3' ? null : { key: 'wk', title: 'Weekly sync', pos: id === 'n1' ? 2 : 1, count: 2, prev: id === 'n1' ? { id: 'n0', at: '2026-10-12T03:00:00Z' } : null, next: id === 'n0' ? { id: 'n1', at: '2026-10-19T03:00:00Z' } : null } }); });
63
- await page.route('**/api/notes/link', (r) => { const b = JSON.parse(r.request().postData() || '{}'); S.linkPosts.push(b); if (b.initiative) S.note = { ...S.note, board: b.board, initiative: b.initiative }; return json(r, { ok: true }); });
64
- await page.route(/\/api\/notes(\?.*)?$/, (r) => json(r, { ok: true, notes, series_open: { wk: { open: 2, carried: false } } }));
65
- await page.route(/\/api\/boards(\?.*)?$/, (r) => json(r, { ok: true, boards: [{ id: 'b1', ws: 'w1', name: 'Growth' }] }));
66
- await page.route('**/api/boards/backlog*', (r) => json(r, { ok: true, rows: [{ id: 'ux', title: 'Premium UX' }, { id: 'sso', title: 'SSO for teams' }] }));
67
- await page.goto(BASE + '/premium.html?theme=' + theme);
68
- S.up = await until(() => page.evaluate(() => !!document.querySelector('#vnOpen') && !!document.querySelector('#vnOpenFoot') && document.querySelectorAll('#rank .rr').length > 0), 20000);
69
- if (S.up) { if (w <= 600 && await page.evaluate(() => document.querySelector('#todayCard').classList.contains('calhid'))) await page.click('#todayCard .foldb'); if (w > 600) await page.click('#calMore'); await page.click(w <= 600 ? '#vnOpenFoot' : '#vnOpen'); S.dlg = await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelectorAll('#vnBody .vn-g').length > 0)); }
70
- SESS.push(S);
71
- return Object.assign(S, { ctx, page });
37
+ const tap = (p, sel) => p.$eval('#czViewer ' + sel, (b) => b.click());
38
+ const text = (p) => p.evaluate(() => (document.querySelector('#czViewer') || {}).innerText || '');
39
+ const groups = (p) => p.evaluate(() => [...document.querySelectorAll('#czViewer .vzc-grp > .vzm-lbl')].map((h) => h.firstChild.textContent.trim() + ':' + h.querySelector('small').textContent));
40
+ const ids = (p) => p.evaluate(() => [...document.querySelectorAll('#czViewer [data-c="note"]')].map((b) => b.dataset.id));
41
+ const ALL = [];
42
+ const open = async (url, o = {}) => {
43
+ const X = await F.open(browser, BASE, url, { noLive: true, ...o });
44
+ ALL.push(X);
45
+ /* search what was said: the server finds n0 for "said", nothing else */
46
+ await X.page.route('**/api/notes/search*', (r) => { const q = new URL(r.request().url()).searchParams.get('q'); X.S.searches = (X.S.searches || []).concat(q); return r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true, ids: /said/.test(q) ? ['n0'] : [] }) }); });
47
+ return X;
72
48
  };
73
- const A = await open();
74
- ok('N1 the Calendar card has a Notes button that opens the dialog with the list', A.up && A.dlg && await A.page.evaluate(() => document.querySelector('#dTitle').textContent === 'Notes'));
75
- if (!A.up || !A.dlg) return finish(1);
49
+
50
+ /* N1 open */
51
+ const A = await open('/premium-viewer.html?open=notes');
76
52
  const p = A.page;
53
+ ok('N1 ?open=notes opens the Viewer card on its Notes side', await until(() => p.evaluate(() => document.querySelectorAll('#czViewer .vzc-grp').length > 0 && document.querySelector('#czViewer .vzc-tabs [data-c="tab"][data-k="notes"]').getAttribute('aria-selected') === 'true'), 15000), (await text(p)).slice(0, 300));
54
+ ok('N1 the card has the Calendar and Notes tabs, the search and the kind chips, and no tabs strip or conversation', await p.evaluate(() => !!document.querySelector('#czViewer [data-c="tab"][data-k="cal"]') && !!document.querySelector('#czViewer [data-c="q"]') && document.querySelectorAll('#czViewer [data-c="filter"]').length === 4 && !document.querySelector('#vTabs, #dlg, .stream')));
77
55
 
78
56
  /* N2 groups */
79
- const g = await p.evaluate(() => ({ groups: [...document.querySelectorAll('#vnBody .vn-g h4')].map((x) => x.firstChild.textContent), count: document.querySelector('#vnCount').textContent }));
80
- ok('N2 the notes are grouped: Portfolio, the board, then Not linked, with a count', g.groups.join('|') === 'Portfolio|Growth|Not linked' && g.count === '4 notes', JSON.stringify(g));
81
- const r3 = await p.evaluate(() => document.querySelector('[data-vn-note="n3"]').textContent);
82
- ok('N2 a note with no meeting is tagged no meeting; the Portfolio note shows its length', /no meeting/.test(r3) && /28 min/.test(await p.evaluate(() => document.querySelector('[data-vn-note="n2"]').textContent)), r3);
57
+ const g = await groups(p);
58
+ ok('N2 grouped by initiative, newest first, Not linked last, each with its count', g.join('|') === 'Viewer:2 notes|Saved views for teams:1 note|Not linked:1 note', JSON.stringify(g));
59
+ const r3 = await p.evaluate(() => { const b = document.querySelector('#czViewer [data-c="note"][data-id="n3"]'); return b ? b.textContent : ''; });
60
+ ok('N2 a note that is not linked shows Link it and its length', /Link it/.test(r3) && /20 min/.test(r3), r3);
83
61
 
84
62
  /* N3 series */
85
- const ser = await p.evaluate(() => document.querySelector('[data-vn-series="wk"]').textContent);
86
- ok('N3 the two notes of the series are one entry with 2 meetings, series and 2 open', /2 meetings/.test(ser) && /series/.test(ser) && /2 open/.test(ser), ser);
87
- await p.click('[data-vn-fold="wk"]');
88
- ok('N3 folding the series open lists its notes with their first summary line', await until(() => p.evaluate(() => !!document.querySelector('.vn-sub [data-vn-note="n0"]') && /The runbook was asked for\./.test(document.querySelector('#vnBody').textContent) && document.querySelector('[data-vn-fold="wk"]').getAttribute('aria-expanded') === 'true')));
63
+ const ser = await p.evaluate(() => { const b = document.querySelector('#czViewer [data-c="ser"][data-k="viewer-sync"]'); return b ? b.textContent : ''; });
64
+ ok('N3 the two notes of the series are one folded card: 2 notes · series, with its open steps', /2 notes · series/.test(ser) && /2 steps open/.test(ser) && (await ids(p)).filter((x) => x === 'n0').length === 0, ser);
89
65
 
90
66
  /* N4 search */
91
- await p.fill('#vnQ', 'sso');
92
- ok('N4 typing filters the list at once and the count says N of M', await until(() => p.evaluate(() => document.querySelectorAll('#vnBody [data-vn-note]').length === 1 && !!document.querySelector('[data-vn-note="n3"]') && document.querySelector('#vnCount').textContent === '1 of 4 notes')));
93
- await p.fill('#vnQ', 'what was said');
94
- ok('N4 a note found by the server search in what was said is listed', await until(() => p.evaluate(() => !!document.querySelector('[data-vn-note="n0"]'))) && A.searches.includes('what was said'), JSON.stringify(A.searches));
95
- await p.fill('#vnQ', 'zzz');
96
- ok('N4 no match says so', await until(() => p.evaluate(() => /No note matches “zzz”/.test(document.querySelector('#vnBody').textContent))));
97
- ok('N4 the search field keeps focus while typing', await p.evaluate(() => document.activeElement && document.activeElement.id === 'vnQ'));
98
- await p.fill('#vnQ', '');
67
+ await p.fill('#czViewer [data-c="q"]', 'compare');
68
+ ok('N4 typing filters the list at once', await until(async () => (await ids(p)).join() === 'n3'), JSON.stringify(await ids(p)));
69
+ ok('N4 the search field keeps focus while typing', await p.evaluate(() => document.activeElement && document.activeElement.dataset.c === 'q'));
70
+ await p.fill('#czViewer [data-c="q"]', 'what was said');
71
+ ok('N4 a note found by the server search in what was said is listed', await until(async () => (await ids(p)).length === 1) && (A.S.searches || []).includes('what was said'), JSON.stringify(A.S.searches));
72
+ await p.fill('#czViewer [data-c="q"]', 'zzz');
73
+ ok('N4 no match says so: 0 notes, no note row, the series kept folded as none match', await until(async () => /0 notes/.test(await text(p)) && /2 notes · none match/.test(await text(p)) && (await ids(p)).length === 0), (await text(p)).slice(0, 400));
74
+ await p.fill('#czViewer [data-c="q"]', '');
75
+ await until(async () => (await ids(p)).length === 3);
99
76
 
100
- /* N5 the note tab */
101
- await until(() => p.evaluate(() => !!document.querySelector('[data-vn-note="n3"]')));
102
- await p.click('[data-vn-note="n3"]');
103
- const tab = await until(() => p.evaluate(() => { const t = document.querySelector('#vTabs'), pane = document.querySelector('#dOut .obody.vw[data-vw="meet-note"]'); return t && !t.hidden && pane && !pane.hidden && /Price SSO in the team plan/.test(pane.textContent) ? { tabs: [...t.querySelectorAll('.vtab')].map((x) => x.textContent.trim()), ph: [...pane.querySelectorAll('.vm-part')].map((b) => b.dataset.part + ':' + b.open).join(), text: pane.textContent } : null; }));
104
- ok('N5 a note opens as a viewer tab beside the list, with Notes first and open', tab && tab.tabs.length === 2 && /Notes/.test(tab.tabs[0]) && /Call with a partner/.test(tab.tabs[1]) && /^after:true,before:false/.test(tab.ph), JSON.stringify(tab && { tabs: tab.tabs, ph: tab.ph }));
105
- ok('N5 the tab has the summary, the Decision and Why table and the next step table from the note', tab && /The partner wants SSO first\./.test(tab.text) && /Two partners asked\./.test(tab.text) && /Send the SSO plan/.test(tab.text) && /Ana/.test(tab.text) && /No meeting/.test(tab.text));
106
- await p.click('#dOut .obody.vw[data-vw="meet-note"] .vm-body[data-part="before"] > summary');
107
- ok('N5 Prep says the note has no calendar event', await until(() => p.evaluate(() => { const b = document.querySelector('#dOut .obody.vw[data-vw="meet-note"] .vm-body[data-part="before"]'); return b && b.open && /not linked to a calendar event/.test(b.textContent); })));
108
- await p.click('#vTabs .vtab[data-vw="main"]');
109
- await p.click('[data-vn-series="wk"]');
110
- ok('N5 pressing a series opens its newest note, which says N of M', await until(() => p.evaluate(() => /Weekly sync · 2 of 2/.test((document.querySelector('#dOut .obody.vw[data-vw="meet-note"] .vm-ser') || {}).textContent || ''))) && A.oneGets.includes('n1'));
111
- await p.click('#dOut .obody.vw[data-vw="meet-note"] [data-vm="prev"]');
112
- ok('N5 paging reads the meeting before into the same tab', await until(() => A.oneGets.includes('n0')) && await p.evaluate(() => document.querySelectorAll('#vTabs .vtab').length === 2));
77
+ /* N5 a note opens in the card */
78
+ await tap(p, '[data-c="note"][data-id="n3"]');
79
+ ok('N5 a note opens as the meeting card in place of the list', await until(() => p.evaluate(() => !!document.querySelector('#czViewer .vz-mtg') && /Compare meeting note apps/.test(document.querySelector('#czViewer .cz-vw-title').textContent))), (await text(p)).slice(0, 300));
80
+ ok('N5 a note that is not linked offers What it is about', await until(async () => /What it is about/.test(await text(p)) && !!(await p.$('#czViewer [data-a="m-about"]'))), (await text(p)).slice(0, 400));
81
+ await p.evaluate(() => window.czViews.openNotes({}));
82
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-c="ser"][data-k="viewer-sync"]')));
83
+ await tap(p, '[data-c="ser"][data-k="viewer-sync"]');
84
+ ok('N3 pressing the series card unfolds its notes, newest first', await until(async () => (await ids(p)).slice(0, 2).join() === 'n1,n0'), JSON.stringify(await ids(p)));
85
+ await tap(p, '[data-c="note"][data-id="n1"]');
86
+ ok('N5 a note of the series opens and says N of M', await until(async () => /4 of 4/.test(await text(p))) && A.S.gets.some((x) => /notes\/one\?id=n1/.test(x)), (await text(p)).slice(0, 300));
87
+ await tap(p, '.vzm-ser [data-a="note"]');
88
+ ok('N5 paging reads the meeting before into the same card', await until(() => A.S.gets.some((x) => /notes\/one\?id=n0/.test(x))) && await p.evaluate(() => document.querySelectorAll('#czViewer .vz-mtg').length === 1));
113
89
 
114
90
  /* N6 Change what it is about */
115
- await p.click('#vTabs .vtab[data-vw="main"]');
116
- await p.click('[data-vn-note="n3"]');
117
- await until(() => p.evaluate(() => /Call with a partner/.test((document.querySelector('#dOut .obody.vw[data-vw="meet-note"] h3') || {}).textContent || '')));
118
- await p.click('#dOut .obody.vw[data-vw="meet-note"] [data-vm="nabout"]');
119
- const opts = await until(() => p.evaluate(() => { const s = document.querySelector('#dOut .vm-nabout select'); return s ? [...s.options].map((o) => o.textContent) : null; }));
120
- ok('N6 Choose what it is about lists Portfolio, the board and its initiatives', opts && opts.join('|') === 'Choose what it is about|Portfolio|Board: Growth|Initiative: Premium UX|Initiative: SSO for teams', JSON.stringify(opts));
121
- await p.selectOption('#dOut .vm-nabout select', 'i:w1/sso');
122
- await p.click('#dOut [data-vm="nsave"]');
123
- await until(() => A.linkPosts.length === 1);
124
- ok('N6 Save posts the console\'s link body for the note', JSON.stringify(A.linkPosts[0]) === JSON.stringify({ id: 'n3', board: { id: 'b1', ws: 'w1', title: 'Growth' }, initiative: { id: 'sso', ws: 'w1', title: 'SSO for teams' } }), JSON.stringify(A.linkPosts));
125
- ok('N6 the note is read again and its head names the initiative, with Change', await until(() => p.evaluate(() => { const pn = document.querySelector('#dOut .obody.vw[data-vw="meet-note"]'); return /Growth › SSO for teams/.test(pn.textContent) && /Change/.test(pn.querySelector('[data-vm="nabout"]').textContent) && !pn.querySelector('.vm-nabout'); })));
91
+ await p.evaluate(() => window.czViews.openNotes({}));
92
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-c="note"][data-id="n3"]')));
93
+ await tap(p, '[data-c="note"][data-id="n3"]');
94
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-a="m-about"]')));
95
+ await tap(p, '[data-a="m-about"]');
96
+ const opts = await until(() => p.evaluate(() => { const s = [...document.querySelectorAll('#czViewer [data-a="aboutpick"]')]; return s.length ? s.map((o) => o.dataset.v) : null; }));
97
+ ok('N6 What it is about lists the initiatives, the product, the portfolio and Leave it out, with no Waiting for design marker', opts && opts.join('|') === 'i:w1/viewer|b:w1/b1|p|none' && !(await p.$('#czViewer [data-cz-placeholder]')), JSON.stringify(opts));
98
+ await tap(p, '[data-a="aboutpick"][data-v="i:w1/viewer"]');
99
+ const links = () => A.S.posts.filter((x) => x.path === '/api/notes/link');
100
+ await until(() => links().length === 1);
101
+ ok('N6 Link it posts the console\'s link body for the note', JSON.stringify(links()[0] && links()[0].body) === JSON.stringify({ id: 'n3', board: { id: 'b1', ws: 'w1', title: 'Growth' }, initiative: { id: 'viewer', ws: 'w1', title: 'Viewer' } }), JSON.stringify(links()));
102
+ ok('N6 the note is read again and its head names the initiative', await until(async () => /Growth › Viewer/.test(await text(p)) && !(await p.$('#czViewer [data-a="aboutpick"]'))), (await text(p)).slice(0, 300));
126
103
 
127
104
  /* N7 writes */
128
- const posts = [...new Set(A.reqs.filter((r) => /^POST /.test(r)))].sort();
129
- ok('N7 the only write is the note\'s link', posts.join() === 'POST /api/notes/link', posts.join());
105
+ const posts = [...new Set(A.S.posts.map((x) => x.path))].sort();
106
+ ok('N7 the only write is the note\'s link', posts.join() === '/api/notes/link', posts.join());
130
107
  const res = await fetch(BASE + '/api/notes/link', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: 'n-nothing', portfolio: true }) });
131
108
  ok('N7 /api/notes/link without the launch nonce is refused', res.status === 403, String(res.status));
132
109
  await A.ctx.close();
133
110
 
134
- /* an empty store says so */
135
- const Z = await open({ notes: [] });
136
- ok('N2 with no notes the list says notes you record show here', Z.up && await until(() => Z.page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && /No notes yet/.test((document.querySelector('#vnBody') || {}).textContent || ''))));
111
+ /* N1 one initiative's notes */
112
+ const I = await open('/premium-viewer.html?open=notes&initiative=saved-views');
113
+ ok('N1 ?initiative= shows that initiative\'s notes only', await until(async () => (await groups(I.page)).join('|') === 'Saved views for teams:1 note'), JSON.stringify(await groups(I.page)));
114
+ await I.ctx.close();
115
+
116
+ /* N2 an empty store says so */
117
+ const Z = await open('/premium-viewer.html?open=notes');
118
+ await Z.page.route(/\/api\/notes(\?.*)?$/, (r) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true, notes: [], series_open: {} }) }));
119
+ await Z.page.reload();
120
+ ok('N2 with no notes the list says notes you record show here', await until(async () => /No notes yet/.test(await text(Z.page))), (await text(Z.page)).slice(0, 300));
137
121
  await Z.ctx.close();
138
122
 
139
123
  /* N8 floors (PMOS_SHOTS=<dir> also saves pictures) */
140
124
  const shotDir = process.env.PMOS_SHOTS || '';
141
- for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
142
- if (w === 1280 && !shotDir) continue;
143
- const P = await open({ w, h, theme: th });
144
- if (!P.dlg) { ok(`N8 ${w} ${th} opens`, false); await P.ctx.close(); continue; }
145
- await P.page.click('[data-vn-fold="wk"]');
146
- const fl = () => P.page.evaluate(() => { const pane = [...document.querySelectorAll('#oMain, #dOut .obody.vw')].find((x) => !x.hidden) || document.querySelector('#oMain');
147
- return { scroll: document.documentElement.scrollWidth <= innerWidth + 1 && pane.scrollWidth <= pane.clientWidth + 1,
148
- btn: [...pane.querySelectorAll('.vn-o, .vn-x, .vn-q, .vm-sh, .vm-lk')].filter((b) => b.getClientRects().length).map((b) => Math.round(Math.min(b.getBoundingClientRect().width, b.getBoundingClientRect().height))) }; });
149
- const f0 = await fl();
150
- // re-pointed for premium-agreed-design: Home's card header mixes a small fold button with 44 px presses, so one line is read by centres, not tops
151
- if (w === 390) ok(`N8 at 390 px (${th}) the Calendar card header keeps one line and Notes sits under the day`, await P.page.evaluate(() => { const h = document.querySelector('#todayCard .ch'), r = (e) => e.getBoundingClientRect(); const bs = [...h.querySelectorAll('button')].filter((b) => b.getClientRects().length); return !document.querySelector('#vnOpen').getClientRects().length && bs.every((b) => Math.abs(r(b).top + r(b).height / 2 - r(bs[0]).top - r(bs[0]).height / 2) < 4) && r(document.querySelector('#vnOpenFoot')).height >= 44; }));
152
- if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `list-${w}-${th}.png`) });
153
- await P.page.click('[data-vn-note="n3"]');
154
- await until(() => P.page.evaluate(() => /Price SSO/.test((document.querySelector('#dOut .obody.vw[data-vw="meet-note"]') || {}).textContent || '')));
155
- const f1 = await fl();
156
- if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `note-${w}-${th}.png`) });
157
- if (w === 390) ok(`N8 at 390 px (${th}) the list and the note have no sideways scroll and every press is at least 44 px`, f0.scroll && f1.scroll && f0.btn.length > 3 && [...f0.btn, ...f1.btn].every((n) => n >= 44), JSON.stringify([f0, f1]));
125
+ for (const th of ['light', 'dark']) {
126
+ const P = await open('/premium-viewer.html?open=notes&theme=' + th, { w: 390, h: 844 });
127
+ await until(() => P.page.evaluate(() => document.querySelectorAll('#czViewer .vzc-grp').length > 0), 15000);
128
+ const fl = () => P.page.evaluate(() => ({ over: document.documentElement.scrollWidth - innerWidth, small: [...document.querySelectorAll('#czViewer .vzc-nr, #czViewer .vzc-tabs button, #czViewer [data-c="filter"]')].filter((b) => { if (!b.getClientRects().length) return false; const pb = getComputedStyle(b, '::before'), hit = pb.content !== 'none' && pb.position === 'absolute' ? parseFloat(pb.height) || 0 : 0; return Math.max(b.getBoundingClientRect().height, hit) < 44; }).length })); // a press may keep its drawn size (the Agreed mockup's segment and New note) and take a 44 px hit area from ::before
129
+ // the Meetings stylesheet loads after the list is drawn: measure once it applies, and fail if it never does
130
+ const f0 = await until(async () => { const v = await fl(); return v.small === 0 ? v : null; }, 8000) || await fl();
131
+ if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `list-390-${th}.png`) });
132
+ await tap(P.page, '[data-c="note"][data-id="n3"]');
133
+ await until(() => P.page.evaluate(() => !!document.querySelector('#czViewer .vz-mtg [data-a="m-about"]')));
134
+ const f1 = await P.page.evaluate(() => ({ over: document.documentElement.scrollWidth - innerWidth }));
135
+ if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `note-390-${th}.png`) });
136
+ ok(`N8 at 390 px (${th}) the list and the note have no sideways scroll and the list's presses are at least 44 px`, f0.over <= 0 && f1.over <= 0 && f0.small === 0, JSON.stringify([f0, f1]));
158
137
  await P.ctx.close();
159
138
  }
160
- ok('N7 no page error in any run', SESS.every((x) => x.errors.length === 0), JSON.stringify(SESS.map((x) => x.errors).filter((e) => e.length)));
139
+ ok('N7 no page error in any run', ALL.every((x) => x.errors.length === 0), JSON.stringify(ALL.map((x) => x.errors).filter((e) => e.length)));
161
140
  return finish();
162
141
  })().catch((e) => { console.error(e); finish(1); });