create-pmos 0.397.0 → 0.398.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 (145) hide show
  1. package/package.json +13 -13
  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 +101 -52
  8. package/workspace/briefing-premium-board-test.js +252 -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 +86 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  13. package/workspace/briefing-premium-initiative-test.js +159 -296
  14. package/workspace/briefing-premium-insights-test.js +337 -219
  15. package/workspace/briefing-premium-metrics-test.js +53 -97
  16. package/workspace/briefing-premium-products-test.js +40 -27
  17. package/workspace/briefing-premium-sources-test.js +66 -48
  18. package/workspace/briefing-premium-test.js +150 -647
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +12 -0
  21. package/workspace/fixtures/board-premium-trail.js +32 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  23. package/workspace/guide/briefing-premium.md +3 -1
  24. package/workspace/guide/home.md +47 -0
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/lib/agent-roles.js +71 -0
  27. package/workspace/lib/board-premium.js +85 -19
  28. package/workspace/lib/board-trail.js +223 -0
  29. package/workspace/lib/home-work-item.js +58 -0
  30. package/workspace/lib/insights-goals.js +196 -0
  31. package/workspace/lib/insights-premium.js +62 -14
  32. package/workspace/lib/insights-records.js +101 -0
  33. package/workspace/lib/jira-tickets.js +1 -1
  34. package/workspace/lib/route-modules.js +4 -0
  35. package/workspace/lib/routes-board-trail.js +33 -0
  36. package/workspace/lib/routes-home-desk.js +176 -0
  37. package/workspace/lib/routes-insights-premium.js +12 -3
  38. package/workspace/lib/routes-insights-records.js +129 -0
  39. package/workspace/lib/routes-notes.js +1 -0
  40. package/workspace/lib/routes-viewer.js +108 -0
  41. package/workspace/lib/transcript-steps.js +123 -0
  42. package/workspace/lib/viewer-meeting.js +205 -0
  43. package/workspace/lib/viewer-report.js +89 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/premium-board-actions-test.js +85 -75
  47. package/workspace/premium-briefing-depth-test.js +66 -53
  48. package/workspace/premium-chat-attach-test.js +54 -63
  49. package/workspace/premium-chat-chart-tab-test.js +35 -37
  50. package/workspace/premium-chat-context-test.js +19 -18
  51. package/workspace/premium-chat-goal-view-test.js +23 -23
  52. package/workspace/premium-chat-notes-test.js +26 -31
  53. package/workspace/premium-chat-report-tab-test.js +32 -28
  54. package/workspace/premium-chat-term-test.js +16 -16
  55. package/workspace/premium-chat-viewer-test.js +60 -59
  56. package/workspace/premium-core-doc-issue-test.js +50 -43
  57. package/workspace/premium-html-viewer-test.js +14 -17
  58. package/workspace/premium-phone-card-test.js +7 -2
  59. package/workspace/premium-phone-room-test.js +41 -35
  60. package/workspace/premium-report-read-test.js +115 -197
  61. package/workspace/premium-viewer-download-test.js +19 -22
  62. package/workspace/premium-viewer-flicker-test.js +11 -16
  63. package/workspace/premium-viewer-share-test.js +6 -9
  64. package/workspace/premium-viewer-test.js +41 -60
  65. package/workspace/premium-vw-backlog-test.js +53 -33
  66. package/workspace/premium-vw-cal-test.js +82 -128
  67. package/workspace/premium-vw-copy-test.js +17 -33
  68. package/workspace/premium-vw-doc-test.js +11 -10
  69. package/workspace/premium-vw-item-test.js +50 -49
  70. package/workspace/premium-vw-jira-test.js +53 -27
  71. package/workspace/premium-vw-meet-test.js +118 -187
  72. package/workspace/premium-vw-notes-test.js +85 -108
  73. package/workspace/premium-vw-rec-test.js +72 -194
  74. package/workspace/premium-vw-slides-test.js +46 -50
  75. package/workspace/premium-welcome-test.js +3 -2
  76. package/workspace/premium-work-depth-test.js +61 -53
  77. package/workspace/public/pm/bd-acts.js +305 -0
  78. package/workspace/public/pm/bd-span.js +186 -82
  79. package/workspace/public/pm/bd-stages.js +25 -11
  80. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  81. package/workspace/public/pm/c3-md.js +3 -395
  82. package/workspace/public/pm/c3-phone-detail.js +1 -1
  83. package/workspace/public/pm/c3-phone-model.js +3 -68
  84. package/workspace/public/pm/chat-term.js +3 -3
  85. package/workspace/public/pm/cozy-board.css +497 -230
  86. package/workspace/public/pm/cozy-home.css +570 -142
  87. package/workspace/public/pm/cozy-home.js +5 -3
  88. package/workspace/public/pm/cozy-insights.css +296 -167
  89. package/workspace/public/pm/cozy-md.js +396 -0
  90. package/workspace/public/pm/cozy-nav.js +17 -6
  91. package/workspace/public/pm/cozy-placeholder.js +26 -0
  92. package/workspace/public/pm/cozy-viewer.css +3 -3
  93. package/workspace/public/pm/cozy-viewer.js +144 -0
  94. package/workspace/public/pm/cozy-vw.css +485 -0
  95. package/workspace/public/pm/cozy.css +83 -1
  96. package/workspace/public/pm/home-adddoc.js +48 -0
  97. package/workspace/public/pm/home-app.js +905 -0
  98. package/workspace/public/pm/home-around.js +515 -0
  99. package/workspace/public/pm/home-chat.js +459 -0
  100. package/workspace/public/pm/home-data.js +312 -0
  101. package/workspace/public/pm/home-draft.js +68 -0
  102. package/workspace/public/pm/home-more.js +249 -0
  103. package/workspace/public/pm/home-phone-card.js +109 -0
  104. package/workspace/public/pm/home-work.js +519 -0
  105. package/workspace/public/pm/phone-moment.js +69 -0
  106. package/workspace/public/pm/pm-work-view.js +1 -1
  107. package/workspace/public/pm/premium-attach.js +4 -0
  108. package/workspace/public/pm/premium-board.js +423 -394
  109. package/workspace/public/pm/premium-chart-tab.js +110 -62
  110. package/workspace/public/pm/premium-deck.js +3 -3
  111. package/workspace/public/pm/premium-first.js +25 -21
  112. package/workspace/public/pm/premium-insights.js +792 -568
  113. package/workspace/public/pm/premium-meeting.js +61 -549
  114. package/workspace/public/pm/premium-notes.js +1 -1
  115. package/workspace/public/pm/premium-report-frame.css +20 -0
  116. package/workspace/public/pm/premium-report-read.js +509 -480
  117. package/workspace/public/pm/premium-report-tab.js +87 -63
  118. package/workspace/public/pm/premium-shell.js +72 -119
  119. package/workspace/public/pm/premium-viewer.js +22 -1
  120. package/workspace/public/pm/premium-vw-cal.js +187 -48
  121. package/workspace/public/pm/premium-vw-doc.css +6 -0
  122. package/workspace/public/pm/premium-vw-doc.js +40 -2
  123. package/workspace/public/pm/premium-vw-file.js +2 -2
  124. package/workspace/public/pm/premium-vw-meet.js +6 -83
  125. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  126. package/workspace/public/pm/premium-vw-notes.js +56 -69
  127. package/workspace/public/pm/premium-vw-open.js +35 -0
  128. package/workspace/public/pm/premium-vw-page.js +16 -0
  129. package/workspace/public/pm/premium-vw-rec.js +11 -218
  130. package/workspace/public/pm/premium-vw-slides.css +5 -0
  131. package/workspace/public/pm/premium-vw-slides.js +44 -8
  132. package/workspace/public/pm/term-view.js +22 -0
  133. package/workspace/public/premium-board.html +28 -70
  134. package/workspace/public/premium-initiative.html +8 -48
  135. package/workspace/public/premium-insights.html +22 -60
  136. package/workspace/public/premium-viewer.html +20 -0
  137. package/workspace/public/premium.html +16 -107
  138. package/workspace/server.js +18 -3
  139. package/workspace/test-files.json +1 -0
  140. package/workspace/test-lists/home-libs.json +9 -0
  141. package/workspace/test-lists/premium-report-read.json +1 -1
  142. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  143. package/workspace/test-lists/premium-vw-notes.json +1 -1
  144. package/workspace/public/pm/premium-work.js +0 -729
  145. 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,106 @@ 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 .vz-grp h3')].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 .vz-grp').length > 0 && document.querySelector('#czViewer .vz-seg [data-c="tab"][data-k="notes"]').getAttribute('aria-selected') === 'true'), 15000), (await text(p)).slice(0, 300));
54
+ ok('N1 the card has Calendar | Notes, New note and the search, and no tabs strip or conversation', await p.evaluate(() => !!document.querySelector('#czViewer [data-c="new"]') && !!document.querySelector('#czViewer [data-c="q"]') && !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-series="viewer-sync"]'); return b ? b.textContent : ''; });
64
+ ok('N3 the two notes of the series are one row: Series · 2 meetings, with its open steps', /Series · 2 meetings/.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', await until(async () => /No note matches “zzz”/.test(await text(p))));
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 its head says Not linked, with Link it', await until(async () => /Not linked/.test(await text(p)) && !!(await p.$('#czViewer [data-a="m-about"]'))));
81
+ await p.evaluate(() => window.czViews.openNotes({}));
82
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-series="viewer-sync"]')));
83
+ await tap(p, '[data-series="viewer-sync"]');
84
+ ok('N5 pressing a series opens its newest note, which says N of M', await until(async () => /Viewer sync · 4 of 4/.test(await text(p))) && A.S.gets.some((x) => /notes\/one\?id=n1/.test(x)), (await text(p)).slice(0, 300));
85
+ await tap(p, '.vz-ser [data-a="note"]');
86
+ 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
87
 
114
88
  /* 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'); })));
89
+ await p.evaluate(() => window.czViews.openNotes({}));
90
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-c="note"][data-id="n3"]')));
91
+ await tap(p, '[data-c="note"][data-id="n3"]');
92
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-a="m-about"]')));
93
+ await tap(p, '[data-a="m-about"]');
94
+ const opts = await until(() => p.evaluate(() => { const s = document.querySelector('#czViewer [data-a="aboutsel"]'); return s ? [...s.options].map((o) => o.textContent) : null; }));
95
+ ok('N6 What it is about lists Portfolio, the board and its initiatives, marked Waiting for design', opts && opts.join('|') === 'Choose|Portfolio|Board: Growth|Initiative: Viewer|Not linked' && !!(await p.$('#czViewer [data-cz-placeholder="About picker"]')), JSON.stringify(opts));
96
+ await p.selectOption('#czViewer [data-a="aboutsel"]', 'i:w1/viewer');
97
+ await tap(p, '[data-a="aboutgo"]');
98
+ const links = () => A.S.posts.filter((x) => x.path === '/api/notes/link');
99
+ await until(() => links().length === 1);
100
+ 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()));
101
+ ok('N6 the note is read again and its head names the initiative', await until(async () => /About\s+Growth › Viewer/.test(await text(p)) && !(await p.$('#czViewer [data-a="aboutsel"]'))), (await text(p)).slice(0, 300));
126
102
 
127
103
  /* 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());
104
+ const posts = [...new Set(A.S.posts.map((x) => x.path))].sort();
105
+ ok('N7 the only write is the note\'s link', posts.join() === '/api/notes/link', posts.join());
130
106
  const res = await fetch(BASE + '/api/notes/link', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: 'n-nothing', portfolio: true }) });
131
107
  ok('N7 /api/notes/link without the launch nonce is refused', res.status === 403, String(res.status));
132
108
  await A.ctx.close();
133
109
 
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 || ''))));
110
+ /* N1 one initiative's notes */
111
+ const I = await open('/premium-viewer.html?open=notes&initiative=saved-views');
112
+ 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)));
113
+ await I.ctx.close();
114
+
115
+ /* N2 an empty store says so */
116
+ const Z = await open('/premium-viewer.html?open=notes');
117
+ await Z.page.route(/\/api\/notes(\?.*)?$/, (r) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true, notes: [], series_open: {} }) }));
118
+ await Z.page.reload();
119
+ 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
120
  await Z.ctx.close();
138
121
 
139
122
  /* N8 floors (PMOS_SHOTS=<dir> also saves pictures) */
140
123
  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))) }; });
124
+ for (const th of ['light', 'dark']) {
125
+ const P = await open('/premium-viewer.html?open=notes&theme=' + th, { w: 390, h: 844 });
126
+ await until(() => P.page.evaluate(() => document.querySelectorAll('#czViewer .vz-grp').length > 0), 15000);
127
+ const fl = () => P.page.evaluate(() => ({ over: document.documentElement.scrollWidth - innerWidth, small: [...document.querySelectorAll('#czViewer .vz-row, #czViewer .vz-seg button, #czViewer [data-c="new"]')].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
149
128
  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]));
129
+ if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `list-390-${th}.png`) });
130
+ await tap(P.page, '[data-c="note"][data-id="n3"]');
131
+ await until(() => P.page.evaluate(() => !!document.querySelector('#czViewer .vz-mtg [data-a="m-about"]')));
132
+ const f1 = await P.page.evaluate(() => ({ over: document.documentElement.scrollWidth - innerWidth }));
133
+ if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `note-390-${th}.png`) });
134
+ 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
135
  await P.ctx.close();
159
136
  }
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)));
137
+ 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
138
  return finish();
162
139
  })().catch((e) => { console.error(e); finish(1); });