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,24 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- /* premium-vw-cal-test.js — the calendar grid in the premium viewer: Day, Week and Month (initiative premium-viewer, R8; planning/prd/premium-viewer-prd.md R6, R7).
4
- * Serves the real Briefing page from the real server. The Briefing model and GET /api/calendar-views are answered by stand-ins; the stand-in
5
- * buckets its meetings with the repo's own calendar model (scripts/calendar-model.js), so each view gets the cells the real route would send.
6
- * R8 the card's button opens the grid · Day, Week, Month · previous, next, Today · a month day opens that day · a meeting opens its detail with the
7
- * calendar as a tab · R6 an empty range and a failed answer say so · R7 390px day list, 44px targets, no sideways scroll, dark theme
3
+ /* premium-vw-cal-test.js — Calendar | Notes in the Viewer card, the Calendar side (initiative premium-viewer, R8; re-pointed for premium-agreed-design,
4
+ * area viewer; redrawn for premium-uncovered-features, area meetings: MtCalendar and MtPhone). Serves the real /premium-viewer.html from the
5
+ * real server; GET /api/calendar-views and the notes are answered by stand-ins (fixtures/premium-viewer-fixtures.js).
6
+ * C1 the card: Calendar | Notes, the range, Day | Week | Month and New note · C2 the week grid: linked filled, not linked dashed with Link it,
7
+ * today's column and its now line · C3 the day: Mon–Fri and the day's entries with chips · C4 a meeting opens its card · C5 Link it opens What
8
+ * it is about · C6 Month, previous, next, Today · C7 honest states · C8 floors at 390px · C9 on Home, the Viewer widens for the week
8
9
  * Every wait polls the page; no fixed sleep stands in for a state. */
9
10
  const path = require('path');
10
11
  const { spawn } = require('child_process');
11
12
  const { findBrowser } = require('./lib/find-browser');
12
13
  const T = require('./test-run').configure({ name: 'premium-vw-cal' });
13
- const B = require('./lib/briefing-premium.js');
14
- const F = require('./fixtures/briefing-premium-facts.js');
15
- const model = require('../scripts/calendar-model.js');
14
+ const F = require('./fixtures/premium-viewer-fixtures.js');
16
15
 
17
- const BASE = T.BASE;
18
- const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
19
- 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); } };
16
+ const BASE = T.BASE, until = F.until;
20
17
  const results = [];
21
- const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
18
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 500) : ''}`); };
22
19
  let srv = null; let browser = null;
23
20
  const finish = async (code) => {
24
21
  if (browser) await browser.close().catch(() => {});
@@ -30,25 +27,6 @@ const finish = async (code) => {
30
27
  };
31
28
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
32
29
 
33
- const pad = (n) => String(n).padStart(2, '0');
34
- const key = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
35
- const TODAY = key(new Date());
36
- const plus = (k, n) => { const [y, m, d] = k.split('-').map(Number); return key(new Date(y, m - 1, d + n)); };
37
- /* today's meetings: two that overlap and one later; one more in five days, so it falls in a later week of the same or the next month */
38
- const EVENTS = [
39
- { id: 'ev-sync', title: 'Onboarding weekly sync', at: `${TODAY}T10:00:00`, end: `${TODAY}T11:00:00`, attendees: ['Sam', 'Lee'] },
40
- { id: 'ev-over', title: 'Billing meter review', at: `${TODAY}T10:30:00`, end: `${TODAY}T11:30:00`, attendees: ['Ana'] },
41
- { id: 'ev-late', title: 'Customer call', at: `${TODAY}T15:00:00`, end: `${TODAY}T15:45:00` },
42
- { id: 'ev-next', title: 'Sprint planning', at: `${plus(TODAY, 8)}T13:00:00`, end: `${plus(TODAY, 8)}T14:30:00` },
43
- ];
44
- const answer = (url, mode) => {
45
- const q = new URL(url).searchParams, view = q.get('view') || 'week', date = q.get('date') || TODAY;
46
- if (mode === 'fail') return { status: 500, body: { ok: false, error: 'the calendar reader stopped' } };
47
- const b = model.bucketEvents(mode === 'empty' ? [] : EVENTS, view, date);
48
- return { status: 200, body: { ok: true, view, range: b.range, unit: b.unit, cells: b.cells, gantt: [], events_source: 'calendar-memory', today: TODAY,
49
- layers: mode === 'empty' ? [] : [{ id: 'ini:x', date: TODAY, kind: 'initiative', layer: 'initiatives', title: 'Self-serve v2 promised', tone: 'warn' }], context: {}, link_boards: [] } };
50
- };
51
-
52
30
  (async () => {
53
31
  const exe = findBrowser();
54
32
  if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
@@ -57,106 +35,97 @@ const answer = (url, mode) => {
57
35
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
58
36
  await T.waitForServer(BASE);
59
37
  browser = await chromium.launch({ executablePath: exe });
38
+ const tap = (p, sel) => p.$eval('#czViewer ' + sel, (b) => b.click());
39
+ const text = (p) => p.evaluate(() => (document.querySelector('#czViewer') || {}).innerText || '');
40
+
41
+ const A = await F.open(browser, BASE, '/premium-viewer.html?open=calendar');
42
+ const p = A.page;
43
+ const up = await until(() => p.evaluate(() => !!document.querySelector('#czViewer .vzc-wk') && document.querySelectorAll('#czViewer .vzc-ev').length > 0), 15000);
44
+ ok('C1 the calendar opens in the Viewer card on its week', up);
45
+ if (!up) return finish(1);
46
+ ok('C1 the card holds Calendar | Notes, Day | Week | Month and New note, and no conversation', await p.evaluate(() => [...document.querySelectorAll('#czViewer [data-c="tab"]')].map((b) => b.textContent).join() === 'Calendar,Notes'
47
+ && [...document.querySelectorAll('#czViewer [data-c="view"]')].map((b) => b.textContent + ':' + b.getAttribute('aria-pressed')).join() === 'Day:false,Week:true,Month:false' && !!document.querySelector('#czViewer [data-c="new"][aria-label="New note"]') && !document.querySelector('#dlg, .stream')));
48
+ ok('C1 the header names it; the range says "N to M Mon"', await p.evaluate(() => document.querySelector('#czViewer .cz-vw-kind').textContent === 'Meetings' && /^\d{1,2}( \w{3})? to \d{1,2} \w{3}$/.test(document.querySelector('#czViewer .vzc-head h2').textContent)));
49
+
50
+ /* C2 the week grid */
51
+ const wk = await p.evaluate(() => ({ cols: document.querySelectorAll('#czViewer .vzc-col').length, now: !!document.querySelector('#czViewer .vzc-hd.now'), line: !!document.querySelector('#czViewer .vzc-nl'),
52
+ sync: [...document.querySelectorAll('#czViewer .vzc-ev')].filter((e) => /Viewer sync/.test(e.textContent)).map((e) => e.className + '|' + e.textContent),
53
+ dita: [...document.querySelectorAll('#czViewer .vzc-ev')].filter((e) => /1:1 with Dita/.test(e.textContent)).map((e) => e.className + '|' + e.textContent),
54
+ styled: document.querySelectorAll('#czViewer .vzc-ev[style*="--t"]').length, inline: document.querySelector('#czViewer .vz-cal').outerHTML.match(/ style="[^"]*"/g) }));
55
+ ok('C2 a gutter and seven days, today marked', wk.cols === 8 && wk.now, JSON.stringify(wk));
56
+ ok('C2 a linked meeting is filled with what it is about; one with no initiative is dashed with Link it', wk.sync.length === 1 && !/\bun\b/.test(wk.sync[0]) && /Viewer/.test(wk.sync[0].split('|')[1]) && wk.dita.length >= 1 && wk.dita.every((x) => /\bun\b/.test(x) && /Link it/.test(x)), JSON.stringify([wk.sync, wk.dita]));
57
+ ok('C2 each block is placed by custom properties set after the markup', wk.styled > 0);
58
+ ok('C2 the legend: Linked, Not linked, and what a press does', /Linked\s*Not linked\s*Press a meeting to open its prep or notes here/.test(await p.evaluate(() => document.querySelector('#czViewer .vzc-leg').innerText.replace(/\n/g, ' '))));
59
+
60
+ /* C3 the day */
61
+ await tap(p, '[data-c="view"][data-k="day"]');
62
+ await until(() => p.evaluate(() => document.querySelectorAll('#czViewer .vzc-dy').length === 5 && document.querySelectorAll('#czViewer .vzc-de').length > 0), 10000);
63
+ const strip = await p.evaluate(() => [...document.querySelectorAll('#czViewer .vzc-dy')].map((d) => ({ dow: d.querySelector('span').textContent, on: d.getAttribute('aria-pressed') })));
64
+ ok('C3 Day: Monday to Friday, today pressed, the range says "· today"', strip.map((d) => d.dow).join() === 'Mon,Tue,Wed,Thu,Fri' && strip.filter((d) => d.on === 'true').length === 1 && /· today$/.test(await p.evaluate(() => document.querySelector('#czViewer .vzc-head h2').textContent)), JSON.stringify(strip));
65
+ const day = await text(p);
66
+ ok('C3 the day: its count, each entry at its time with a chip', /\d (meetings?|entries) · /.test(day) && /Viewer sync/.test(day) && await p.evaluate(() => [...document.querySelectorAll('#czViewer .vzc-de')].every((r) => r.querySelector('.vz-cc'))), day.slice(0, 400));
67
+ ok('C3 a note recorded without an event shows Link it; a done meeting Done', /Compare meeting note apps/.test(day) && /Link it/.test(day) && /Done/.test(day));
68
+ const other = await p.evaluate(() => { const b = [...document.querySelectorAll('#czViewer .vzc-dy')].find((d) => d.getAttribute('aria-pressed') === 'false'); b.click(); return b.dataset.k; });
69
+ ok('C3 another day lists its own meetings', await until(async () => /1:1 with Dita/.test(await text(p))), other);
70
+ await p.evaluate(() => [...document.querySelectorAll('#czViewer .vzc-dy')][[...document.querySelectorAll('#czViewer .vzc-dy')].findIndex((d) => /today/.test(d.getAttribute('aria-label')))].click());
71
+
72
+ /* C4 a meeting opens its card */
73
+ await until(async () => /Viewer sync/.test(await text(p)));
74
+ await p.evaluate(() => [...document.querySelectorAll('#czViewer .vzc-de')].find((r) => /Viewer sync/.test(r.textContent)).click());
75
+ ok('C4 a meeting opens the meeting card in place of the calendar', await until(() => p.evaluate(() => !!document.querySelector('#czViewer .vz-mtg') && /Viewer sync/.test(document.querySelector('#czViewer .cz-vw-title').textContent))), 10000);
76
+ await A.ctx.close();
77
+
78
+ /* C5 Link it */
79
+ const B = await F.open(browser, BASE, '/premium-viewer.html?open=calendar');
80
+ const q = B.page;
81
+ await until(() => q.evaluate(() => !!document.querySelector('#czViewer .vzc-ev [data-c="link"]')), 15000);
82
+ await tap(q, '.vzc-ev [data-c="link"]');
83
+ ok('C5 Link it opens the meeting with What it is about open', await until(() => q.evaluate(() => !!document.querySelector('#czViewer .vz-mtg') && !!document.querySelector('#czViewer .vzm-pop [data-a="aboutq"]'))), (await text(q)).slice(0, 300));
84
+ ok('C5 no Waiting for design marker', await q.evaluate(() => !document.querySelector('#czViewer [data-cz-placeholder]')));
85
+ await B.ctx.close();
60
86
 
61
- const open = async ({ w = 1280, h = 900, theme = 'light' } = {}) => {
62
- const ctx = await browser.newContext({ viewport: { width: w, height: h } });
63
- const page = await ctx.newPage();
64
- const S = { errors: [], mode: 'full', asks: [] };
65
- page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
66
- await page.route('**/api/briefing-premium*', (r) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: B.build(F.facts()), as_of: Date.now() }) }));
67
- await page.route('**/api/calendar-views*', (r) => { S.asks.push(r.request().url()); const a = answer(r.request().url(), S.mode); r.fulfill({ status: a.status, contentType: 'application/json', body: JSON.stringify(a.body) }); });
68
- await page.goto(BASE + '/premium.html?theme=' + theme);
69
- S.up = await until(() => page.evaluate(() => !!document.querySelector('#todayCard .vc-open') && !!window.__premiumViewer), 20000);
70
- return { page, ctx, S };
71
- };
72
- const vis = (page, sel) => page.evaluate((s) => [...document.querySelectorAll(s)].filter((e) => e.getClientRects().length && getComputedStyle(e).visibility !== 'hidden').length, sel);
73
- const ready = (page) => until(() => page.evaluate(() => !!document.querySelector('#vcMain .vc-w .vc-h') || !!document.querySelector('.obody.vw[data-vw="cal"] .vc-w .vc-h')));
74
- const pressed = (page) => page.evaluate(() => { const b = document.querySelector('#dOut .vc-seg [aria-pressed="true"]:not([hidden])'); return b && b.dataset.cv; });
75
- const title = (page) => page.evaluate(() => { const t = [...document.querySelectorAll('#dOut .vc-t')].find((x) => x.getClientRects().length); return t ? t.textContent : ''; });
87
+ /* C6 Month, previous, next, Today */
88
+ const C = await F.open(browser, BASE, '/premium-viewer.html?open=calendar');
89
+ const r = C.page;
90
+ await until(() => r.evaluate(() => !!document.querySelector('#czViewer .vzc-wk')), 15000);
91
+ const n0 = C.S.gets.filter((g) => g.startsWith('/api/calendar-views')).length;
92
+ await tap(r, '[data-c="view"][data-k="month"]');
93
+ ok('C6 Month reads the month and draws its grid', await until(() => C.S.gets.some((g) => /view=month/.test(g))) && await until(() => r.evaluate(() => !!document.querySelector('#czViewer .vzc-mg') && /^\w+ \d{4}$/.test(document.querySelector('#czViewer .vzc-head h2').textContent))));
94
+ const n1 = C.S.gets.filter((g) => g.startsWith('/api/calendar-views')).length;
95
+ await tap(r, '[data-c="nav"][data-k="1"]');
96
+ await until(() => C.S.gets.filter((g) => g.startsWith('/api/calendar-views')).length > n1);
97
+ await tap(r, '[data-c="nav"][data-k="0"]');
98
+ ok('C6 next and Today read again', await until(() => C.S.gets.filter((g) => g.startsWith('/api/calendar-views')).length >= n0 + 3));
99
+ await tap(r, '[data-c="view"][data-k="week"]');
100
+ await until(() => r.evaluate(() => !!document.querySelector('#czViewer .vzc-wk')));
101
+ await tap(r, '.vzc-dn');
102
+ ok('C6 a day name in the week opens that day', await until(() => r.evaluate(() => document.querySelector('#czViewer [data-c="view"][data-k="day"]').getAttribute('aria-pressed') === 'true')));
103
+ await C.ctx.close();
76
104
 
77
- /* R8 desktop */
78
- {
79
- // re-pointed for premium-agreed-design: on Home the dialog is the docked chat and the Viewer column is at most 500 px, so the week grid
80
- // (drawn when the Viewer is 560 px or wider, the agenda below that) needs a wide desktop; at 1600 px the Viewer column is about 650 px
81
- const { page, ctx, S } = await open({ w: 1600 });
82
- ok('R8 the Briefing\'s Calendar card has a button that opens the calendar', S.up);
83
- await page.click('#calMore'); await page.click('#todayCard .vc-open');
84
- ok('R8 the button opens a dialog with the calendar as its detail', await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dTitle').textContent === 'Calendar')) && await ready(page));
85
- await until(() => vis(page, '#vcMain .vc-ev'));
86
- ok('R8 it opens on this week, read from GET /api/calendar-views?view=week', (await pressed(page)) === 'week' && S.asks.some((u) => /view=week&date=/.test(u)), S.asks.join(' '));
87
- ok('R8 the week draws today\'s three meetings as blocks', (await vis(page, '#vcMain .vc-ev')) === 3, String(await vis(page, '#vcMain .vc-ev')));
88
- const lanes = await page.evaluate(() => [...document.querySelectorAll('#vcMain .vc-ev')].filter((b) => /sync|meter/.test(b.textContent)).map((b) => b.getBoundingClientRect()));
89
- ok('R8 two meetings that overlap sit side by side', lanes.length === 2 && Math.abs(lanes[0].left - lanes[1].left) > 20 && lanes[0].width < 200, JSON.stringify(lanes.map((r) => [r.left, r.width])));
90
- ok('R8 the dates row carries the dated layer as a mark', await page.evaluate(() => [...document.querySelectorAll('#vcMain .vc-sc .vc-ad')].some((x) => /promised/.test(x.textContent) && x.tagName === 'SPAN')));
91
- ok('R8 a meeting block is filled, not see-through (the console draws a solid block)', await page.evaluate(() => { const b = document.querySelector('#vcMain .vc-ev'); const c = b && getComputedStyle(b).backgroundColor; return !!c && c !== 'transparent' && !/rgba\(.*,\s*0\)$/.test(c); }));
92
- ok('R8 the first hour of the grid is labelled', await page.evaluate(() => { const i = document.querySelector('#vcMain .vc-gut i'); return !!i && /^\d{2}:00$/.test(i.textContent) && getComputedStyle(i).visibility !== 'hidden' && i.getClientRects().length > 0; }));
93
- ok('R8 the now line is drawn on today', (await vis(page, '#vcMain .vc-now')) <= 1);
94
- const wk = await title(page);
95
- await page.click('#vcMain [data-cn="1"]');
96
- await until(async () => (await title(page)) !== wk);
97
- ok('R8 Next moves a week on', (await title(page)) !== wk && S.asks.some((u) => u.includes('date=' + plus(TODAY, 7))), S.asks.slice(-1)[0]);
98
- await page.click('#vcMain [data-cn="0"]');
99
- await until(async () => (await title(page)) === wk);
100
- ok('R8 Today comes back to this week', (await title(page)) === wk);
101
- await page.click('#vcMain [data-cv="month"]');
102
- await until(async () => (await pressed(page)) === 'month' && (await vis(page, '#vcMain .vc-md')) >= 28);
103
- ok('R8 Month draws whole weeks of days', (await vis(page, '#vcMain .vc-md')) % 7 === 0 && (await vis(page, '#vcMain .vc-md')) >= 28 && /\d{4}$/.test(await title(page)), await title(page));
104
- ok('R8 today\'s cell lists its meetings', await page.evaluate(() => { const c = document.querySelector('#vcMain .vc-md.now'); return !!c && c.querySelectorAll('.vc-me').length === 3; }));
105
- await page.click('#vcMain .vc-md.now .vc-dn');
106
- await until(async () => (await pressed(page)) === 'day');
107
- await until(() => vis(page, '#vcMain .vc-ev'));
108
- ok('R8 a month day opens that day', (await pressed(page)) === 'day' && S.asks.some((u) => u.includes('view=day&date=' + TODAY)) && (await vis(page, '#vcMain .vc-dh')) === 1);
109
- await page.click('#vcMain [data-cv="week"]');
110
- await until(() => vis(page, '#vcMain .vc-ev'));
111
- await page.evaluate(() => [...document.querySelectorAll('#vcMain .vc-ev')].find((b) => /weekly sync/.test(b.textContent)).click());
112
- ok('R8 a meeting opens its detail, the meeting dialog', await until(() => page.evaluate(() => document.querySelector('#dTitle').textContent === 'Onboarding weekly sync')));
113
- const tabs = await page.evaluate(() => ({ ...window.__premiumViewer.vwState(), main: !document.querySelector('#oMain').hidden }));
114
- ok('R8 the calendar stays as a tab beside the meeting, the meeting shown', JSON.stringify(tabs.ids) === '["cal"]' && tabs.on === 'main' && tabs.main, JSON.stringify(tabs));
115
- await page.click('#vTabs .vtab[data-vw="cal"]');
116
- // re-pointed for premium-agreed-design: a row's dialog on Home docks its Viewer in a column of at most 500 px, where the same week view
117
- // draws as its agenda (the grid needs 560 px), so today's three meetings count as blocks or as agenda rows, whichever the width draws
118
- const calEv = '.obody.vw[data-vw="cal"] .vc-ev, .obody.vw[data-vw="cal"] .vc-ar';
119
- await until(() => vis(page, calEv));
120
- ok('R8 the Calendar tab shows the grid at the same view', (await vis(page, calEv)) === 3 && (await pressed(page)) === 'week');
121
- await page.evaluate((q) => [...document.querySelectorAll(q)].find((b) => b.getClientRects().length && /Customer call/.test(b.textContent)).click(), calEv);
122
- ok('R8 a meeting from the tab opens that meeting, with the tab again', await until(() => page.evaluate(() => document.querySelector('#dTitle').textContent === 'Customer call' && JSON.stringify(window.__premiumViewer.vwState().ids) === '["cal"]')));
105
+ /* C7 honest states: a calendar that does not answer */
106
+ const D = await F.open(browser, BASE, '/premium-viewer.html?open=calendar', { init: () => {} });
107
+ await D.page.route('**/api/calendar-views*', (x) => x.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'the calendar is not connected' }) }));
108
+ await D.page.reload();
109
+ ok('C7 a calendar that does not answer says why', await until(async () => /The calendar was not read. the calendar is not connected/.test(await text(D.page))), (await text(D.page)).slice(0, 300));
110
+ await D.ctx.close();
123
111
 
124
- /* R6 honesty */
125
- await page.keyboard.press('Escape');
126
- await until(() => page.evaluate(() => !document.querySelector('#dlg').classList.contains('on')), 3000);
127
- S.mode = 'empty';
128
- await page.click('#calMore'); await page.click('#todayCard .vc-open');
129
- await until(() => page.evaluate(() => /No meetings in this week/.test((document.querySelector('#vcMain') || {}).textContent || '')));
130
- ok('R6 a week with no meetings says so', await page.evaluate(() => /No meetings in this week\./.test(document.querySelector('#vcMain').textContent) && !document.querySelector('#vcMain .vc-ev')));
131
- S.mode = 'fail';
132
- await page.click('#vcMain [data-cv="month"]');
133
- await until(() => page.evaluate(() => /Calendar not read/.test(document.querySelector('#vcMain').textContent)));
134
- ok('R6 a calendar that did not answer says it was not read, and why', await page.evaluate(() => /Calendar not read\. the calendar reader stopped/.test(document.querySelector('#vcMain').textContent)));
135
- ok('R8 no page error', S.errors.length === 0, S.errors.join(' | '));
136
- await ctx.close();
137
- }
112
+ /* C8 floors */
113
+ const E = await F.open(browser, BASE, '/premium-viewer.html?open=calendar', { w: 390, h: 844 });
114
+ ok('C8 390px opens on the day', await until(() => E.page.evaluate(() => document.querySelectorAll('#czViewer .vzc-dy').length === 5 && document.querySelectorAll('#czViewer .vzc-de').length > 0), 15000));
115
+ // the Meetings stylesheet loads after the card is drawn: measure once it applies, and fail if it never does
116
+ const flOf = () => E.page.evaluate(() => ({ over: document.documentElement.scrollWidth - innerWidth, small: [...document.querySelectorAll('#czViewer .vzc-de, #czViewer .vzc-dy')].filter((b) => b.getBoundingClientRect().height < 44).length }));
117
+ const fl = await until(async () => { const v = await flOf(); return v.over <= 0 && v.small === 0 ? v : null; }, 8000) || await flOf();
118
+ ok('C8 390px: no sideways scroll, rows and days at least 44px tall', fl.over <= 0 && fl.small === 0, JSON.stringify(fl));
119
+ ok('C8 no page error', E.errors.length === 0 && A.errors.length === 0, E.errors.concat(A.errors).join(' | '));
120
+ await E.ctx.close();
138
121
 
139
- /* R7 phone and dark theme */
140
- {
141
- const { page, ctx, S } = await open({ w: 390, h: 844, theme: 'dark' });
142
- await page.click('#calMore'); await page.click('#todayCard .vc-open');
143
- await until(() => vis(page, '#vcMain .vc-ar'));
144
- ok('R7 at 390px the week is a day list, not the timeline', (await vis(page, '#vcMain .vc-ar')) === 3 && (await vis(page, '#vcMain .vc-g')) === 0, String(await vis(page, '#vcMain .vc-ar')));
145
- const m = async () => page.evaluate(() => {
146
- const bs = [...document.querySelectorAll('#vcMain button')].filter((b) => b.getClientRects().length).map((b) => b.getBoundingClientRect());
147
- return { minH: Math.min(...bs.map((r) => r.height)), minW: Math.min(...bs.map((r) => r.width)), over: document.documentElement.scrollWidth > window.innerWidth,
148
- right: Math.max(...bs.map((r) => r.right)) <= window.innerWidth + 1, bg: getComputedStyle(document.querySelector('#vcMain .vc-w')).backgroundColor };
149
- });
150
- let x = await m();
151
- ok('R7 every control of the week is at least 44px', x.minH >= 44 && x.minW >= 44, JSON.stringify(x));
152
- ok('R7 the week fits the width, no sideways scroll', x.right && !x.over, JSON.stringify(x));
153
- ok('R7 in the dark theme the calendar is not a light card', (() => { const c = (x.bg.match(/\d+/g) || []).slice(0, 3).map(Number); return c.length === 3 && c[0] + c[1] + c[2] < 3 * 160; })(), x.bg);
154
- await page.click('#vcMain [data-cv="month"]');
155
- await until(() => vis(page, '#vcMain .vc-md'));
156
- x = await m();
157
- ok('R7 the month at 390px: day buttons of 44px, no sideways scroll', x.minH >= 44 && x.minW >= 40 && x.right && !x.over && (await vis(page, '#vcMain .vc-me')) === 0, JSON.stringify(x));
158
- ok('R7 no page error', S.errors.length === 0, S.errors.join(' | '));
159
- await ctx.close();
160
- }
122
+ /* C9 on Home, the Viewer widens for the week */
123
+ const G = await F.open(browser, BASE, '/premium.html', { w: 1440, h: 900 });
124
+ await until(() => G.page.evaluate(() => !!(window.czViews && window.czViews.openCalendar)), 15000);
125
+ await G.page.evaluate(() => window.czViews.openCalendar());
126
+ const wide = await until(() => G.page.evaluate(() => { const v = document.querySelector('#czViewer'); return v && v.dataset.vzw === 'cal' && document.querySelector('#czViewer .vzc-wk') && v.getBoundingClientRect().width > 600 && { w: v.getBoundingClientRect().width, hv: !!document.querySelector('#czViewer .hv') }; }), 15000)
127
+ || await G.page.evaluate(() => { const v = document.querySelector('#czViewer'); return v && { w: v.getBoundingClientRect().width, hv: !!document.querySelector('#czViewer .hv') }; }); // the width comes with the stylesheet
128
+ ok('C9 on premium.html, czViews.openCalendar() draws the week in a wider Viewer, with no bare .hv class in the card', wide && wide.w > 600 && !wide.hv, JSON.stringify(wide));
129
+ await G.ctx.close();
161
130
  finish();
162
131
  })();
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  /* premium-vw-copy-test.js — a Confluence page or Google Doc in the premium viewer (initiative premium-viewer, R11; planning/prd/premium-viewer-prd.md).
4
- * Serves the real Briefing page, opens a row's dialog, then opens the copy view with the /api/docs, /api/doc and /api/docs/read routes answered by stand-ins.
4
+ * Serves the real Home (premium-agreed-design: no dialog; the Viewer is the cozy card #czViewer, one item at a time), then opens the copy view with the /api/docs, /api/doc and /api/docs/read routes answered by stand-ins.
5
5
  * R11 a linked copy that matches · a copy that changed (dimmed, Use with Undo) · a link-only page (Read it now, then the read text) · R7 floors at 390px, dark
6
6
  * Every wait polls the page; no fixed sleep stands in for a state. */
7
7
  const path = require('path');
@@ -43,27 +43,11 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
43
43
  page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
44
44
  await page.route('**/api/briefing-premium*', (r) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: B.build(F.facts()), as_of: Date.now() }) }));
45
45
  await page.goto(BASE + '/premium.html?theme=' + theme);
46
- S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr .rhd').length > 0 && !!window.__premiumViewer), 20000);
46
+ S.up = await until(() => page.evaluate(() => document.querySelectorAll('#hmList .hm-r').length > 0 && !!document.querySelector('#hmChat')), 20000);
47
47
  return { page, ctx, S };
48
48
  };
49
- /* opens the first row that opens a dialog on this page (a row with its own page would navigate away) */
50
- const openDialog = async (page) => {
51
- const n = await page.evaluate(() => document.querySelectorAll('#rank .rr .rhd').length);
52
- for (let i = 0; i < n; i++) {
53
- const url = page.url();
54
- await page.evaluate((k) => document.querySelectorAll('#rank .rr .rhd')[k].click(), i);
55
- if (await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on')), 3000)) return true;
56
- if (page.url() !== url) { await page.goBack(); await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr .rhd').length > 0 && !!window.__premiumViewer), 20000); }
57
- }
58
- return false;
59
- };
60
- const st = (page) => page.evaluate(() => {
61
- const t = document.querySelector('#vTabs'), m = document.querySelector('#oMain'), lab = document.querySelector('#oLab');
62
- const vis = (e) => !!e && !e.hidden && getComputedStyle(e).display !== 'none';
63
- return { ...window.__premiumViewer.vwState(), strip: vis(t), lab: vis(lab), main: vis(m), tabs: t ? [...t.querySelectorAll('.vtab')].map((x) => x.dataset.vw) : [],
64
- sel: t ? [...t.querySelectorAll('.vtab[aria-selected="true"]')].map((x) => x.dataset.vw) : [], panes: [...document.querySelectorAll('#dOut .obody.vw')].map((p) => [p.dataset.vw, vis(p)]) };
65
- });
66
-
49
+ /* Home is up: the list and the chat; the copy view opens in the Viewer beside them (there is no row dialog any more) */
50
+ const openDialog = async (page) => !!(await until(() => page.evaluate(() => document.querySelectorAll('#hmList .hm-r').length > 0 && !document.querySelector('#dlg.on'))));
67
51
  const URL_C = 'https://acme.atlassian.net/wiki/spaces/P/pages/1/Launch+plan', URL_G = 'https://docs.google.com/document/d/1abc/edit', URL_M = 'https://docs.google.com/document/d/9memo/edit';
68
52
  const stand = async (page, S) => {
69
53
  S.sig = 'same'; S.posts = []; S.read = { ok: true, read: null, open: null };
@@ -79,35 +63,35 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
79
63
  await page.route('**/api/docs/check', (r) => { S.posts.push(['check', {}]); return r.fulfill({ status: 200, contentType: 'application/json', body: '{"ok":true,"session":"s3"}' }); });
80
64
  };
81
65
  const openCopy = (page, o) => page.evaluate((x) => import('/pm/premium-vw-copies.js').then((m) => { m.openCopy(x); }), o);
82
- const shown = (page) => page.evaluate(() => { const p = document.querySelector('#dOut .obody.vw:not([hidden])'); return p ? p.innerText : ''; });
66
+ const shown = (page) => page.evaluate(() => { const p = document.querySelector('#czViewer:not([hidden]) .obody.vw'); return p ? p.innerText : ''; });
83
67
 
84
68
  /* R11 desktop */
85
69
  {
86
70
  const { page, ctx, S } = await open();
87
71
  await stand(page, S);
88
- ok('R11 a row opens the dialog', await openDialog(page));
72
+ ok('R11 Home is up, with no old dialog', await openDialog(page));
89
73
  await openCopy(page, { ws: '', path: 'planning/launch.md', kind: 'confluence', url: URL_C, title: 'Launch plan' });
90
74
  ok('R11 a matching copy shows "Same as PMOS" and the PMOS file as the page', await until(async () => { const t = await shown(page); return /Same as PMOS/.test(t) && /Open the beta to 40 accounts/.test(t); }), await shown(page));
91
- ok('R11 a matching copy offers no write, only Check again and Open', await page.evaluate(() => { const p = document.querySelector('#dOut .obody.vw:not([hidden])'); return !p.querySelector('[data-cp="use"]') && !!p.querySelector('[data-cp="check"]') && !!p.querySelector('a[href*="atlassian"]'); }));
75
+ ok('R11 a matching copy offers no write, only Check again and Open', await page.evaluate(() => { const p = document.querySelector('#czViewer:not([hidden]) .obody.vw'); return !p.querySelector('[data-cp="use"]') && !!p.querySelector('[data-cp="check"]') && !!p.querySelector('a[href*="atlassian"]'); }));
92
76
  ok('R11 the stylesheet loads once', await until(() => page.evaluate(() => document.querySelectorAll('link[data-vw-css="copy"]').length === 1)));
93
- await page.click('#dOut .obody.vw:not([hidden]) [data-cp="check"]');
77
+ await page.click('#czViewer:not([hidden]) .obody.vw [data-cp="check"]');
94
78
  ok('R11 Check again posts one check', await until(() => S.posts.some((p) => p[0] === 'check')));
95
79
  await openCopy(page, { ws: '', path: 'planning/launch.md', kind: 'google', url: URL_G, title: 'Launch plan (Doc)' });
96
- ok('R11 a changed copy says so and labels the text as the PMOS version, dimmed', await until(async () => { const t = await shown(page); return /changed after it last matched PMOS/.test(t) && /PMOS version/.test(t) && (await page.$('#dOut .obody.vw:not([hidden]) .cpv-page.dim')); }), await shown(page));
97
- await page.click('#dOut .obody.vw:not([hidden]) [data-cp="use"]');
80
+ ok('R11 a changed copy says so and labels the text as the PMOS version, dimmed', await until(async () => { const t = await shown(page); return /changed after it last matched PMOS/.test(t) && /PMOS version/.test(t) && (await page.$('#czViewer:not([hidden]) .obody.vw .cpv-page.dim')); }), await shown(page));
81
+ await page.click('#czViewer:not([hidden]) .obody.vw [data-cp="use"]');
98
82
  ok('R11 Use waits behind Undo', await until(async () => /five seconds/.test(await shown(page))));
99
- await page.click('#dOut .obody.vw:not([hidden]) [data-cp="undo"]');
83
+ await page.click('#czViewer:not([hidden]) .obody.vw [data-cp="undo"]');
100
84
  await sleep(5600);
101
85
  ok('R11 Undo within five seconds posts no sync', !S.posts.some((p) => p[0] === 'sync'), JSON.stringify(S.posts));
102
- await page.click('#dOut .obody.vw:not([hidden]) [data-cp="use"]');
86
+ await page.click('#czViewer:not([hidden]) .obody.vw [data-cp="use"]');
103
87
  ok('R11 without Undo the sync posts once, with use=copy, after five seconds', await until(() => S.posts.filter((p) => p[0] === 'sync').length === 1, 8000) && S.posts.find((p) => p[0] === 'sync')[1].use === 'copy', JSON.stringify(S.posts));
104
88
  await openCopy(page, { ws: '', url: URL_M, kind: 'google', title: 'Pricing memo', where: 'material for Weekly sync' });
105
89
  ok('R11 a link-only page says PMOS has only the address, with Read it now', await until(async () => { const t = await shown(page); return /PMOS has only the address/.test(t) && /Read it now/.test(t); }), await shown(page));
106
- await page.click('#dOut .obody.vw:not([hidden]) [data-cp="read"]');
90
+ await page.click('#czViewer:not([hidden]) .obody.vw [data-cp="read"]');
107
91
  ok('R11 Read it now posts the page address once and shows that a session is reading', await until(async () => S.posts.filter((p) => p[0] === 'read').length === 1 && /is reading the page/.test(await shown(page))) && S.posts.find((p) => p[0] === 'read')[1].url === URL_M, JSON.stringify(S.posts));
108
92
  S.read = { ok: true, open: null, read: { title: 'Pricing memo', text: '## Recommendation\n\nKeep the Pro tier.', read_at: new Date().toISOString(), by: 'doc-read', revision: '212' } };
109
93
  ok('R11 when the read lands the text shows, with when and who read it', await until(async () => { const t = await shown(page); return /Keep the Pro tier/.test(t) && /Read today/.test(t) && /revision 212/.test(t); }, 12000), await shown(page));
110
- ok('R11 four tabs at most: three copy tabs are open beside the main one', (await page.evaluate(() => window.__premiumViewer.vwState().ids.length)) === 3);
94
+ ok('R11 one Viewer card holds the copy view: no tab strip', await page.evaluate(() => document.querySelectorAll('#czViewer').length === 1 && !document.querySelector('#vTabs .vtab')));
111
95
  ok('R11 no page error', S.errors.length === 0, S.errors.join(' | '));
112
96
  await ctx.close();
113
97
  }
@@ -116,11 +100,11 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
116
100
  {
117
101
  const { page, ctx, S } = await open({ w: 390, h: 844, theme: 'dark' });
118
102
  await stand(page, S);
119
- ok('R7 a row opens the dialog at 390px', await openDialog(page));
103
+ ok('R7 Home is up at 390px, with no old dialog', await openDialog(page));
120
104
  await openCopy(page, { ws: '', path: 'planning/launch.md', kind: 'google', url: URL_G, title: 'Launch plan (Doc)' });
121
- await until(() => page.$('#dOut .obody.vw:not([hidden]) [data-cp="use"]'));
105
+ await until(() => page.$('#czViewer:not([hidden]) .obody.vw [data-cp="use"]'));
122
106
  const m = await page.evaluate(() => {
123
- const p = document.querySelector('#dOut .obody.vw:not([hidden])'), bs = [...p.querySelectorAll('.cpv-acts .dmcta')].filter((b) => b.offsetParent);
107
+ const p = document.querySelector('#czViewer:not([hidden]) .obody.vw'), bs = [...p.querySelectorAll('.cpv-acts .dmcta')].filter((b) => b.offsetParent);
124
108
  return { minH: Math.min(...bs.map((b) => b.getBoundingClientRect().height)), n: bs.length, over: document.documentElement.scrollWidth > window.innerWidth, bg: getComputedStyle(p.querySelector('.cpv-page')).backgroundColor };
125
109
  });
126
110
  ok('R7 the view\'s buttons are at least 44px tall at 390px', m.n >= 2 && m.minH >= 44, JSON.stringify(m));
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  /* premium-vw-doc-test.js — a markdown document as a page in the premium viewer (initiative premium-viewer S2; planning/prd/premium-viewer-prd.md R2, R6, R7).
4
- * Serves the real initiative page from the real server and opens its PRD sheet, then the page in the viewer. The /api/doc-sheet routes are answered by a
4
+ * Serves the real Home from the real server (premium-agreed-design: the initiative is a layout of Home, ?ini=<id>) and opens its PRD from the
5
+ * initiative's Files group; the document opens as its page in the cozy Viewer (#czViewer), one item at a time, so "a tab" is now "the card". The /api/doc-sheet routes are answered by a
5
6
  * small stateful stand-in, so each press can be read off the request the page sent. The routes' own behaviour is in briefing-premium-doc-edit.test.js.
6
7
  * D1 the page · D2 edit in place · D3 Markdown · D4 an agent's edit · D5 Undo all · D6 ask · D7 the sheet reads again · D8 floors */
7
8
  const path = require('path');
@@ -75,11 +76,14 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
75
76
  if (route === 'ask') { S.ask = { ok: true, id: 'ask-1', state: 'working' }; return send({ ok: true, id: 'ask-1', state: 'working' }); }
76
77
  return send({ ok: false, error: 'not in this test' }, 404);
77
78
  });
78
- await page.goto(BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1&theme=' + theme);
79
- await until(() => page.evaluate(() => document.querySelector('#cIniDoc')));
80
- await page.locator('#dmList .dmo[data-doc="prd"]').click();
81
- await until(() => page.evaluate(() => document.querySelector('#oMain [data-ds="page"]')));
82
- await page.click('#oMain [data-ds="page"]');
79
+ await page.goto(BASE + '/premium.html?ini=self-serve-v2&ws=w1&theme=' + theme);
80
+ await until(() => page.evaluate(() => !!document.querySelector('.hm-r[data-id="f:planning/prd/self-serve-v2-prd.md"]')), 15000);
81
+ await until(() => page.evaluate(() => !!document.querySelector('#hmList [data-hi-open="docs"]')), 15000);
82
+ if (!(await page.evaluate(() => !!document.querySelector('#hmList [data-hi-open="docs"]').offsetParent))) await page.click('#hmNeeds'); // a phone may show the list in the top bar's sheet
83
+ // the initiative's Core documents group (in place of the Files group, premium-uncovered-features InDocs) opens every document in the Viewer
84
+ await page.click('#hmList [data-hi-open="docs"]');
85
+ await until(() => page.evaluate(() => !!document.querySelector('#czViewer [data-ov-open="planning/prd/self-serve-v2-prd.md"]')), 15000);
86
+ await page.click('#czViewer [data-ov-open="planning/prd/self-serve-v2-prd.md"]'); // the PRD opens as a page
83
87
  await until(() => page.evaluate(() => document.querySelector('.vwdoc .cf, .vwdoc .vwempty:not(:empty)') && !/Reading the file/.test(document.querySelector('.vwdoc').textContent)));
84
88
  return { ctx, page, S };
85
89
  };
@@ -88,7 +92,7 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
88
92
 
89
93
  /* D1 the page */
90
94
  const A = await open(); const p = A.page;
91
- ok('D1 Open as a page opens the document in a viewer tab, beside the sheet', await p.evaluate(() => { const st = window.__premiumViewer && window.__premiumViewer.vwState(); return !!st && st.ids.includes('doc:planning/prd/self-serve-v2-prd.md') && st.on === 'doc:planning/prd/self-serve-v2-prd.md'; }));
95
+ ok('D1 the PRD in the initiative\'s Files opens as a page in the Viewer', await p.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) .obody.vw[data-vw="doc:planning/prd/self-serve-v2-prd.md"]')));
92
96
  const head = await p.evaluate((v) => { const r = document.querySelector(v); return { t: r.querySelector('.cft').textContent, by: r.querySelector('.cfby').textContent, props: [...r.querySelectorAll('.cfpr tr')].map((x) => [...x.children].map((c) => c.textContent.trim()).join(' ')), labels: [...r.querySelectorAll('.cflb span')].map((x) => x.textContent), h1: r.querySelectorAll('.cfb h1, .cfb h2').length && r.querySelector('.cfb').textContent.includes('PRD: Self-serve'), foot: r.querySelector('.cff').textContent }; }, V);
93
97
  ok('D1 the title comes from the front matter and the first heading is not drawn twice', head.t === 'Self-serve onboarding v2' && !head.h1, JSON.stringify(head));
94
98
  ok('D1 the byline says who changed it last, the version and the read time, from the log', /Last change by Before the sheet · 16 Oct 2026 · v1 · 1 min read/.test(head.by), head.by);
@@ -106,8 +110,11 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
106
110
  await until(() => p.evaluate((v) => /Built from/.test((document.querySelector(v + ' .vwmp') || {}).textContent || ''), V));
107
111
  ok('D9 Links show what it is built from and what uses it, from the document library', /Built from · 1.*Onboarding interviews/.test(await txt(p, V + ' .vwmp')) && /Used by · 1.*Self-serve rubric/.test(await txt(p, V + ' .vwmp')) && /Links 2/.test(await txt(p, V + ' .vwmore')));
108
112
  await p.click(V + ' [data-vd="open:planning/evals/self-serve-v2-rubric.md"]');
109
- ok('D9 a linked document opens as a page in its own tab', await until(() => p.evaluate(() => window.__premiumViewer.vwState().on === 'doc:planning/evals/self-serve-v2-rubric.md')));
110
- await p.evaluate(() => window.__premiumViewer.vwShow('doc:planning/prd/self-serve-v2-prd.md'));
113
+ ok('D9 a linked document opens as a page in the Viewer, in place of this one', await until(() => p.evaluate(() => !!document.querySelector('#czViewer .obody.vw[data-vw="doc:planning/evals/self-serve-v2-rubric.md"]'))));
114
+ await p.click('#hmList [data-hi-open="docs"]'); // back to the PRD: Core documents opens it again
115
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-ov-open="planning/prd/self-serve-v2-prd.md"]')), 15000);
116
+ await p.click('#czViewer [data-ov-open="planning/prd/self-serve-v2-prd.md"]');
117
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer .obody.vw[data-vw="doc:planning/prd/self-serve-v2-prd.md"] .vwdoc .cf')));
111
118
  await p.click(V + ' [data-vd="more:copies"]');
112
119
  ok('D9 Copies says there is none yet and offers to link one', /no copy in Confluence or Google Docs yet/.test(await txt(p, V + ' .vwmp')));
113
120
  await p.fill(V + ' #vwCpUrl', 'https://acme.atlassian.net/wiki/spaces/PM/pages/1'); await p.click(V + ' [data-vd="cplink"]');
@@ -212,7 +219,7 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
212
219
  return { sx: document.documentElement.scrollWidth - innerWidth, bad, out, fs };
213
220
  }, [V, w < 600]);
214
221
  ok(`D8 at ${w} px ${theme}: no sideways scroll, no small target, nothing past the edge, console sizes only`, f.sx <= 0 && f.bad.length === 0 && f.out === 0 && f.fs.every((x) => ['11px', '12px', '14px', '16px', '20px', '28px'].includes(x)), JSON.stringify(f));
215
- const c = await R.page.evaluate((v) => { const e = document.querySelector(v + ' .cf'); return [getComputedStyle(e).backgroundColor, getComputedStyle(e).color]; }, V);
222
+ const c = await R.page.evaluate((v) => { const e = document.querySelector(v + ' .cf'); return [getComputedStyle(document.querySelector('#czViewer')).backgroundColor, getComputedStyle(e).color]; }, V); // the page sits on the Viewer's card
216
223
  ok(`D8 at ${w} px ${theme}: the page follows the theme`, theme === 'dark' ? c[0] === 'rgb(36, 38, 43)' && c[1] === 'rgb(236, 238, 241)' : c[0] === 'rgb(255, 255, 255)' && c[1] === 'rgb(42, 46, 53)', JSON.stringify(c)); // the initiative page is cozy (premium-agreed-design): the card is the cozy white or dark card
217
224
  await R.ctx.close();
218
225
  }