create-pmos 0.396.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 (177) 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/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/payload/state/log.md +1 -1
  8. package/workspace/briefing-premium-adddoc-test.js +103 -74
  9. package/workspace/briefing-premium-board-test.js +316 -154
  10. package/workspace/briefing-premium-calendar-2-test.js +135 -195
  11. package/workspace/briefing-premium-calendar-3-test.js +143 -413
  12. package/workspace/briefing-premium-calendar-test.js +86 -185
  13. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  14. package/workspace/briefing-premium-initiative-test.js +166 -294
  15. package/workspace/briefing-premium-insights-test.js +351 -214
  16. package/workspace/briefing-premium-metrics-test.js +53 -118
  17. package/workspace/briefing-premium-products-test.js +40 -27
  18. package/workspace/briefing-premium-sources-test.js +91 -52
  19. package/workspace/briefing-premium-test.js +150 -633
  20. package/workspace/briefing-premium-work-test.js +88 -269
  21. package/workspace/changelog.json +24 -0
  22. package/workspace/fixtures/board-premium-facts.js +2 -1
  23. package/workspace/fixtures/board-premium-jira.js +28 -0
  24. package/workspace/fixtures/board-premium-trail.js +32 -0
  25. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  26. package/workspace/fixtures/initiatives-api/list.json +30 -42
  27. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  28. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  29. package/workspace/fixtures/insights-premium-facts.js +11 -2
  30. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  31. package/workspace/guide/briefing-premium.md +3 -1
  32. package/workspace/guide/home.md +47 -0
  33. package/workspace/guide/index.md +2 -0
  34. package/workspace/guide/lifecycle.md +51 -0
  35. package/workspace/home-shot.js +38 -0
  36. package/workspace/lib/agent-roles.js +71 -0
  37. package/workspace/lib/board-premium.js +160 -3
  38. package/workspace/lib/board-trail.js +223 -0
  39. package/workspace/lib/engine/boards.js +15 -14
  40. package/workspace/lib/engine/nine-stages.js +49 -20
  41. package/workspace/lib/engine/signals/detectors.js +13 -11
  42. package/workspace/lib/home-work-item.js +58 -0
  43. package/workspace/lib/insights-goals.js +196 -0
  44. package/workspace/lib/insights-premium.js +126 -1
  45. package/workspace/lib/insights-records.js +101 -0
  46. package/workspace/lib/jira-tickets.js +1 -1
  47. package/workspace/lib/route-modules.js +4 -0
  48. package/workspace/lib/routes-board-premium.js +3 -2
  49. package/workspace/lib/routes-board-trail.js +33 -0
  50. package/workspace/lib/routes-home-desk.js +176 -0
  51. package/workspace/lib/routes-initiatives.js +1 -1
  52. package/workspace/lib/routes-insights-premium.js +19 -3
  53. package/workspace/lib/routes-insights-records.js +129 -0
  54. package/workspace/lib/routes-notes.js +1 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/transcript-steps.js +123 -0
  57. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  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-agreed-viewer-shots.js +76 -0
  63. package/workspace/premium-board-actions-test.js +85 -73
  64. package/workspace/premium-briefing-depth-test.js +66 -53
  65. package/workspace/premium-chat-attach-test.js +54 -63
  66. package/workspace/premium-chat-chart-tab-test.js +35 -36
  67. package/workspace/premium-chat-context-test.js +22 -19
  68. package/workspace/premium-chat-goal-view-test.js +28 -26
  69. package/workspace/premium-chat-notes-test.js +29 -33
  70. package/workspace/premium-chat-report-tab-test.js +35 -25
  71. package/workspace/premium-chat-term-test.js +16 -14
  72. package/workspace/premium-chat-viewer-test.js +60 -53
  73. package/workspace/premium-core-doc-issue-test.js +50 -41
  74. package/workspace/premium-html-viewer-test.js +17 -18
  75. package/workspace/premium-phone-card-test.js +8 -2
  76. package/workspace/premium-phone-room-test.js +42 -31
  77. package/workspace/premium-report-read-test.js +115 -197
  78. package/workspace/premium-viewer-download-test.js +19 -22
  79. package/workspace/premium-viewer-flicker-test.js +11 -16
  80. package/workspace/premium-viewer-share-test.js +6 -9
  81. package/workspace/premium-viewer-test.js +41 -60
  82. package/workspace/premium-vw-backlog-test.js +53 -31
  83. package/workspace/premium-vw-cal-test.js +82 -123
  84. package/workspace/premium-vw-copy-test.js +17 -33
  85. package/workspace/premium-vw-doc-test.js +12 -11
  86. package/workspace/premium-vw-item-test.js +50 -48
  87. package/workspace/premium-vw-jira-test.js +55 -26
  88. package/workspace/premium-vw-meet-test.js +118 -187
  89. package/workspace/premium-vw-notes-test.js +85 -107
  90. package/workspace/premium-vw-rec-test.js +72 -193
  91. package/workspace/premium-vw-slides-test.js +46 -50
  92. package/workspace/premium-welcome-test.js +3 -2
  93. package/workspace/premium-work-depth-test.js +63 -51
  94. package/workspace/public/pm/bd-acts.js +305 -0
  95. package/workspace/public/pm/bd-span.js +224 -0
  96. package/workspace/public/pm/bd-stages.js +47 -0
  97. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  98. package/workspace/public/pm/c3-md.js +3 -395
  99. package/workspace/public/pm/c3-phone-detail.js +1 -1
  100. package/workspace/public/pm/c3-phone-model.js +3 -68
  101. package/workspace/public/pm/chat-term.js +3 -3
  102. package/workspace/public/pm/cozy-board.css +640 -0
  103. package/workspace/public/pm/cozy-home.css +580 -0
  104. package/workspace/public/pm/cozy-home.js +172 -0
  105. package/workspace/public/pm/cozy-initiative.css +138 -0
  106. package/workspace/public/pm/cozy-insights.css +421 -0
  107. package/workspace/public/pm/cozy-md.js +396 -0
  108. package/workspace/public/pm/cozy-nav.js +65 -0
  109. package/workspace/public/pm/cozy-placeholder.js +26 -0
  110. package/workspace/public/pm/cozy-viewer.css +143 -0
  111. package/workspace/public/pm/cozy-viewer.js +144 -0
  112. package/workspace/public/pm/cozy-vw.css +485 -0
  113. package/workspace/public/pm/cozy.css +254 -0
  114. package/workspace/public/pm/home-adddoc.js +48 -0
  115. package/workspace/public/pm/home-app.js +905 -0
  116. package/workspace/public/pm/home-around.js +515 -0
  117. package/workspace/public/pm/home-chat.js +459 -0
  118. package/workspace/public/pm/home-data.js +312 -0
  119. package/workspace/public/pm/home-draft.js +68 -0
  120. package/workspace/public/pm/home-more.js +249 -0
  121. package/workspace/public/pm/home-phone-card.js +109 -0
  122. package/workspace/public/pm/home-work.js +519 -0
  123. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  124. package/workspace/public/pm/lifecycle-lens.js +22 -11
  125. package/workspace/public/pm/phone-moment.js +69 -0
  126. package/workspace/public/pm/pm-work-view.js +1 -1
  127. package/workspace/public/pm/premium-attach.js +4 -0
  128. package/workspace/public/pm/premium-board.js +544 -253
  129. package/workspace/public/pm/premium-brief.js +1 -1
  130. package/workspace/public/pm/premium-chart-tab.js +110 -62
  131. package/workspace/public/pm/premium-chat.js +17 -10
  132. package/workspace/public/pm/premium-deck.js +3 -3
  133. package/workspace/public/pm/premium-first.js +25 -21
  134. package/workspace/public/pm/premium-initiative-head.js +138 -0
  135. package/workspace/public/pm/premium-initiative.js +28 -4
  136. package/workspace/public/pm/premium-insights.js +950 -440
  137. package/workspace/public/pm/premium-meeting.js +61 -549
  138. package/workspace/public/pm/premium-notes.js +1 -1
  139. package/workspace/public/pm/premium-report-frame.css +20 -0
  140. package/workspace/public/pm/premium-report-read.js +509 -480
  141. package/workspace/public/pm/premium-report-tab.js +87 -63
  142. package/workspace/public/pm/premium-shell.js +107 -124
  143. package/workspace/public/pm/premium-viewer.js +27 -1
  144. package/workspace/public/pm/premium-vw-cal.js +187 -48
  145. package/workspace/public/pm/premium-vw-doc.css +6 -0
  146. package/workspace/public/pm/premium-vw-doc.js +40 -2
  147. package/workspace/public/pm/premium-vw-file.js +2 -2
  148. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  149. package/workspace/public/pm/premium-vw-jira.css +11 -0
  150. package/workspace/public/pm/premium-vw-jira.js +11 -4
  151. package/workspace/public/pm/premium-vw-meet.js +6 -83
  152. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  153. package/workspace/public/pm/premium-vw-notes.js +56 -69
  154. package/workspace/public/pm/premium-vw-open.js +35 -0
  155. package/workspace/public/pm/premium-vw-page.js +16 -0
  156. package/workspace/public/pm/premium-vw-rec.js +11 -215
  157. package/workspace/public/pm/premium-vw-slides.css +5 -0
  158. package/workspace/public/pm/premium-vw-slides.js +44 -8
  159. package/workspace/public/pm/term-view.js +22 -0
  160. package/workspace/public/premium-board.html +57 -64
  161. package/workspace/public/premium-chat.html +7 -33
  162. package/workspace/public/premium-initiative.html +8 -41
  163. package/workspace/public/premium-insights.html +63 -62
  164. package/workspace/public/premium-viewer.html +20 -0
  165. package/workspace/public/premium-work.html +6 -72
  166. package/workspace/public/premium.html +21 -66
  167. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  168. package/workspace/server.js +25 -3
  169. package/workspace/test-files.json +1 -0
  170. package/workspace/test-lists/home-libs.json +9 -0
  171. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  172. package/workspace/test-lists/premium-report-read.json +1 -1
  173. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  174. package/workspace/test-lists/premium-vw-notes.json +1 -1
  175. package/workspace/third-party/README.md +1 -0
  176. package/workspace/public/pm/premium-work.js +0 -719
  177. package/workspace/public/pm/premium.js +0 -1133
@@ -1,24 +1,20 @@
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: Main.dc.html viewer prop cal). Serves the real /premium-viewer.html from the real server; GET /api/calendar-views and the notes are
5
+ * answered by stand-ins (fixtures/premium-viewer-fixtures.js).
6
+ * C1 the card: Calendar | Notes and New note · C2 the Mon–Fri strip with load bars · C3 the day list with chips and the footer · C4 a meeting opens
7
+ * its card · C5 Link it · C6 Day, week and month (plain list, Waiting for design): previous, next, Today · C7 honest states · C8 floors
8
8
  * Every wait polls the page; no fixed sleep stands in for a state. */
9
9
  const path = require('path');
10
10
  const { spawn } = require('child_process');
11
11
  const { findBrowser } = require('./lib/find-browser');
12
12
  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');
13
+ const F = require('./fixtures/premium-viewer-fixtures.js');
16
14
 
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); } };
15
+ const BASE = T.BASE, until = F.until;
20
16
  const results = [];
21
- 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) : ''}`); };
22
18
  let srv = null; let browser = null;
23
19
  const finish = async (code) => {
24
20
  if (browser) await browser.close().catch(() => {});
@@ -30,25 +26,6 @@ const finish = async (code) => {
30
26
  };
31
27
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
32
28
 
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
29
  (async () => {
53
30
  const exe = findBrowser();
54
31
  if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
@@ -57,101 +34,83 @@ const answer = (url, mode) => {
57
34
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
58
35
  await T.waitForServer(BASE);
59
36
  browser = await chromium.launch({ executablePath: exe });
37
+ const tap = (p, sel) => p.$eval('#czViewer ' + sel, (b) => b.click());
38
+ const text = (p) => p.evaluate(() => (document.querySelector('#czViewer') || {}).innerText || '');
39
+
40
+ const A = await F.open(browser, BASE, '/premium-viewer.html?open=calendar');
41
+ const p = A.page;
42
+ const up = await until(() => p.evaluate(() => document.querySelectorAll('#czViewer .vz-day').length === 5 && document.querySelectorAll('#czViewer .vz-row').length > 0), 15000);
43
+ ok('C1 the calendar opens in the Viewer card', up);
44
+ if (!up) return finish(1);
45
+ ok('C1 the card holds Calendar | Notes and New note, and no tabs strip or conversation', await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-seg [data-c="tab"]')].map((b) => b.textContent).join() === 'Calendar,Notes' && !!document.querySelector('#czViewer [data-c="new"]') && !document.querySelector('#dlg, .stream')));
46
+ ok('C1 the header names it', await p.evaluate(() => document.querySelector('#czViewer .cz-vw-kind').textContent === 'Meetings' && document.querySelector('#czViewer .cz-vw-title').textContent === 'Calendar and notes'));
47
+
48
+ /* C2 the strip */
49
+ const strip = await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-day')].map((d) => ({ dow: d.querySelector('span').textContent, on: d.getAttribute('aria-pressed'), bar: d.querySelector('i').hasAttribute('data-on'), sub: d.querySelector('small').textContent })));
50
+ ok('C2 Monday to Friday, today pressed', strip.map((d) => d.dow).join() === 'MON,TUE,WED,THU,FRI' && strip.filter((d) => d.on === 'true').length === 1 && strip.some((d) => /today/.test(d.sub)), JSON.stringify(strip));
51
+ ok('C2 a day with meetings has its load bar', strip.filter((d) => d.bar).length >= 4, JSON.stringify(strip));
52
+
53
+ /* C3 the day */
54
+ const day = await text(p);
55
+ ok('C3 the day list: Today, its entries and a chip on each', /Today, /.test(day) && /Viewer sync/.test(day) && await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-row')].every((r) => r.querySelector('.vz-cc'))), day.slice(0, 400));
56
+ 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));
57
+ ok('C3 the footer says PMOS never writes the calendar', /PMOS never writes to it/.test(day));
58
+ const other = await p.evaluate(() => { const b = [...document.querySelectorAll('#czViewer .vz-day')].find((d) => d.getAttribute('aria-pressed') === 'false' && d.querySelector('i').hasAttribute('data-on')); b.click(); return b.dataset.k; });
59
+ ok('C3 another day lists its own meetings', await until(async () => /1:1 with Dita/.test(await text(p))), other);
60
+ await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-day')].find((d) => /today/.test(d.querySelector('small').textContent)).click());
61
+
62
+ /* C4 a meeting opens its card */
63
+ await until(async () => /Viewer sync/.test(await text(p)));
64
+ await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-row')].find((r) => /Viewer sync/.test(r.textContent)).click());
65
+ 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);
66
+ await A.ctx.close();
67
+
68
+ /* C5 Link it */
69
+ const B = await F.open(browser, BASE, '/premium-viewer.html?open=calendar');
70
+ const q = B.page;
71
+ await until(() => q.evaluate(() => !!document.querySelector('#czViewer [data-c="link"]')), 15000);
72
+ await tap(q, '[data-c="link"]');
73
+ ok('C5 Link it opens the meeting with the about picker, marked Waiting for design', await until(() => q.evaluate(() => !!document.querySelector('#czViewer .vz-mtg') && !!document.querySelector('#czViewer [data-cz-placeholder]'))), (await text(q)).slice(0, 300));
74
+ await B.ctx.close();
60
75
 
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 : ''; });
76
+ /* C6 Day, week and month */
77
+ const C = await F.open(browser, BASE, '/premium-viewer.html?open=calendar');
78
+ const r = C.page;
79
+ await until(() => r.evaluate(() => !!document.querySelector('#czViewer [data-c="more"]')), 15000);
80
+ await tap(r, '[data-c="more"]');
81
+ ok('C6 Day, week and month opens the plain list, marked Waiting for design', await until(() => r.evaluate(() => !!document.querySelector('#czViewer [data-cz-placeholder="Day/Week/Month calendar"]') && document.querySelectorAll('#czViewer [data-c="mrow"]').length > 0)), (await text(r)).slice(-400));
82
+ const n0 = C.S.gets.filter((g) => g.startsWith('/api/calendar-views')).length;
83
+ await tap(r, '[data-c="mv"][data-k="month"]');
84
+ ok('C6 Month reads the month', await until(() => C.S.gets.some((g) => /view=month/.test(g))));
85
+ await until(() => r.evaluate(() => !!document.querySelector('#czViewer [data-c="mrow"], #czViewer [data-cz-placeholder="Day/Week/Month calendar"] .vz-empty')));
86
+ const n1 = C.S.gets.filter((g) => g.startsWith('/api/calendar-views')).length;
87
+ await tap(r, '[data-c="mn"][data-k="1"]');
88
+ await until(() => C.S.gets.filter((g) => g.startsWith('/api/calendar-views')).length > n1);
89
+ await tap(r, '[data-c="mn"][data-k="0"]');
90
+ ok('C6 next and Today read again', await until(() => C.S.gets.filter((g) => g.startsWith('/api/calendar-views')).length >= n0 + 3));
91
+ await C.ctx.close();
76
92
 
77
- /* R8 desktop */
78
- {
79
- const { page, ctx, S } = await open();
80
- ok('R8 the Briefing\'s Calendar card has a button that opens the calendar', S.up);
81
- await page.click('#calMore'); await page.click('#todayCard .vc-open');
82
- 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));
83
- await until(() => vis(page, '#vcMain .vc-ev'));
84
- 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(' '));
85
- 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')));
86
- const lanes = await page.evaluate(() => [...document.querySelectorAll('#vcMain .vc-ev')].filter((b) => /sync|meter/.test(b.textContent)).map((b) => b.getBoundingClientRect()));
87
- 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])));
88
- 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')));
89
- 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); }));
90
- 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; }));
91
- ok('R8 the now line is drawn on today', (await vis(page, '#vcMain .vc-now')) <= 1);
92
- const wk = await title(page);
93
- await page.click('#vcMain [data-cn="1"]');
94
- await until(async () => (await title(page)) !== wk);
95
- 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]);
96
- await page.click('#vcMain [data-cn="0"]');
97
- await until(async () => (await title(page)) === wk);
98
- ok('R8 Today comes back to this week', (await title(page)) === wk);
99
- await page.click('#vcMain [data-cv="month"]');
100
- await until(async () => (await pressed(page)) === 'month' && (await vis(page, '#vcMain .vc-md')) >= 28);
101
- 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));
102
- 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; }));
103
- await page.click('#vcMain .vc-md.now .vc-dn');
104
- await until(async () => (await pressed(page)) === 'day');
105
- await until(() => vis(page, '#vcMain .vc-ev'));
106
- 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);
107
- await page.click('#vcMain [data-cv="week"]');
108
- await until(() => vis(page, '#vcMain .vc-ev'));
109
- await page.evaluate(() => [...document.querySelectorAll('#vcMain .vc-ev')].find((b) => /weekly sync/.test(b.textContent)).click());
110
- ok('R8 a meeting opens its detail, the meeting dialog', await until(() => page.evaluate(() => document.querySelector('#dTitle').textContent === 'Onboarding weekly sync')));
111
- const tabs = await page.evaluate(() => ({ ...window.__premiumViewer.vwState(), main: !document.querySelector('#oMain').hidden }));
112
- 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));
113
- await page.click('#vTabs .vtab[data-vw="cal"]');
114
- await until(() => vis(page, '.obody.vw[data-vw="cal"] .vc-ev'));
115
- ok('R8 the Calendar tab shows the grid at the same view', (await vis(page, '.obody.vw[data-vw="cal"] .vc-ev')) === 3 && (await pressed(page)) === 'week');
116
- await page.evaluate(() => [...document.querySelectorAll('.obody.vw[data-vw="cal"] .vc-ev')].find((b) => /Customer call/.test(b.textContent)).click());
117
- 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"]')));
93
+ /* C7 honest states: a calendar that does not answer */
94
+ const D = await F.open(browser, BASE, '/premium-viewer.html?open=calendar', { init: () => {} });
95
+ 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' }) }));
96
+ await D.page.reload();
97
+ 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));
98
+ await D.ctx.close();
118
99
 
119
- /* R6 honesty */
120
- await page.keyboard.press('Escape');
121
- await until(() => page.evaluate(() => !document.querySelector('#dlg').classList.contains('on')), 3000);
122
- S.mode = 'empty';
123
- await page.click('#calMore'); await page.click('#todayCard .vc-open');
124
- await until(() => page.evaluate(() => /No meetings in this week/.test((document.querySelector('#vcMain') || {}).textContent || '')));
125
- 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')));
126
- S.mode = 'fail';
127
- await page.click('#vcMain [data-cv="month"]');
128
- await until(() => page.evaluate(() => /Calendar not read/.test(document.querySelector('#vcMain').textContent)));
129
- 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)));
130
- ok('R8 no page error', S.errors.length === 0, S.errors.join(' | '));
131
- await ctx.close();
132
- }
100
+ /* C8 floors */
101
+ const E = await F.open(browser, BASE, '/premium-viewer.html?open=calendar', { w: 390, h: 844 });
102
+ await until(() => E.page.evaluate(() => document.querySelectorAll('#czViewer .vz-day').length === 5), 15000);
103
+ const fl = await E.page.evaluate(() => ({ over: document.documentElement.scrollWidth - innerWidth, small: [...document.querySelectorAll('#czViewer .vz-row, #czViewer .vz-day')].filter((b) => b.getBoundingClientRect().height < 44).length }));
104
+ ok('C8 390px: no sideways scroll, rows and days at least 44px tall', fl.over <= 0 && fl.small === 0, JSON.stringify(fl));
105
+ ok('C8 no page error', E.errors.length === 0 && A.errors.length === 0, E.errors.concat(A.errors).join(' | '));
106
+ await E.ctx.close();
133
107
 
134
- /* R7 phone and dark theme */
135
- {
136
- const { page, ctx, S } = await open({ w: 390, h: 844, theme: 'dark' });
137
- await page.click('#calMore'); await page.click('#todayCard .vc-open');
138
- await until(() => vis(page, '#vcMain .vc-ar'));
139
- 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')));
140
- const m = async () => page.evaluate(() => {
141
- const bs = [...document.querySelectorAll('#vcMain button')].filter((b) => b.getClientRects().length).map((b) => b.getBoundingClientRect());
142
- return { minH: Math.min(...bs.map((r) => r.height)), minW: Math.min(...bs.map((r) => r.width)), over: document.documentElement.scrollWidth > window.innerWidth,
143
- right: Math.max(...bs.map((r) => r.right)) <= window.innerWidth + 1, bg: getComputedStyle(document.querySelector('#vcMain .vc-w')).backgroundColor };
144
- });
145
- let x = await m();
146
- ok('R7 every control of the week is at least 44px', x.minH >= 44 && x.minW >= 44, JSON.stringify(x));
147
- ok('R7 the week fits the width, no sideways scroll', x.right && !x.over, JSON.stringify(x));
148
- 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);
149
- await page.click('#vcMain [data-cv="month"]');
150
- await until(() => vis(page, '#vcMain .vc-md'));
151
- x = await m();
152
- 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));
153
- ok('R7 no page error', S.errors.length === 0, S.errors.join(' | '));
154
- await ctx.close();
155
- }
108
+ /* C9 on Home, the calendar keeps its rows: Home's own stylesheet has a .hv class, and the card's hover class must not meet it */
109
+ const G = await F.open(browser, BASE, '/premium.html');
110
+ await until(() => G.page.evaluate(() => !!(window.czViews && window.czViews.openCalendar)), 15000);
111
+ await G.page.evaluate(() => window.czViews.openCalendar());
112
+ const row = await until(() => G.page.evaluate(() => { const r = document.querySelector('#czViewer .vz-row'); return r && { dir: getComputedStyle(r).flexDirection, disp: getComputedStyle(r).display, hv: !!document.querySelector('#czViewer .hv') }; }), 15000);
113
+ ok('C9 on premium.html, czViews.openCalendar() draws each row as one line (flex row), with no bare .hv class in the card', row && row.disp === 'flex' && row.dir === 'row' && !row.hv, JSON.stringify(row));
114
+ await G.ctx.close();
156
115
  finish();
157
116
  })();
@@ -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,10 @@ 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
+ if (w < 761) await page.click('#hmNeeds'); // a phone: the list is the top bar's sheet
82
+ await page.click('.hm-r[data-id="f:planning/prd/self-serve-v2-prd.md"] .hm-rm'); // the initiative's Files group: the PRD opens as a page
83
83
  await until(() => page.evaluate(() => document.querySelector('.vwdoc .cf, .vwdoc .vwempty:not(:empty)') && !/Reading the file/.test(document.querySelector('.vwdoc').textContent)));
84
84
  return { ctx, page, S };
85
85
  };
@@ -88,7 +88,7 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
88
88
 
89
89
  /* D1 the page */
90
90
  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'; }));
91
+ 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
92
  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
93
  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
94
  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 +106,9 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
106
106
  await until(() => p.evaluate((v) => /Built from/.test((document.querySelector(v + ' .vwmp') || {}).textContent || ''), V));
107
107
  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
108
  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'));
109
+ 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"]'))));
110
+ await p.click('.hm-r[data-id="f:planning/prd/self-serve-v2-prd.md"] .hm-rm'); // back to the PRD: its row opens it again
111
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer .obody.vw[data-vw="doc:planning/prd/self-serve-v2-prd.md"] .vwdoc .cf')));
111
112
  await p.click(V + ' [data-vd="more:copies"]');
112
113
  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
114
  await p.fill(V + ' #vwCpUrl', 'https://acme.atlassian.net/wiki/spaces/PM/pages/1'); await p.click(V + ' [data-vd="cplink"]');
@@ -212,8 +213,8 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
212
213
  return { sx: document.documentElement.scrollWidth - innerWidth, bad, out, fs };
213
214
  }, [V, w < 600]);
214
215
  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);
216
- ok(`D8 at ${w} px ${theme}: the page follows the theme`, theme === 'dark' ? c[0] === 'rgb(23, 26, 35)' : c[0] === 'rgb(253, 253, 252)', JSON.stringify(c));
216
+ 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
217
+ 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
218
  await R.ctx.close();
218
219
  }
219
220
  finish();