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,10 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- /* premium-report-read-test.js — a report document read on the premium Insights page (initiative premium-report-read;
4
- * planning/prd/premium-report-read-prd.md R1 to R11). A real server on a scratch git repository with two cycles of one report (one issued), and a
5
- * stub `claude` on the PATH that plays the report-design job (as c3-report-design-real-test.js does). The real page presses the real routes:
6
- * O opening · C the cycles · D the deck · G the page · N Present · W download · X print · E edit · L the look · K the Brief · I issued
7
- * P the POST allow-list · F floors · S issue · A archive
3
+ /* premium-report-read-test.js — a report cycle read in the Viewer card (initiative premium-report-read, planning/prd/premium-report-read-prd.md
4
+ * R1 to R11; re-pointed for premium-agreed-design, area viewer: ReportPanel.dc.html). A real server on a scratch git repository with two cycles of
5
+ * one report (one issued); /premium-viewer.html?open=report&path=... opens the cycle in the czViewer card, and the real page presses the real routes:
6
+ * O opening · B the bar · C the cycles · D the deck · G the page · K the Brief · N Present · W download · X print · E edit · I issued
7
+ * P the writes · F floors · S issue · A archive
8
+ * premium-uncovered-features (workstream reports) draws the parts the Agreed mockup left out: Report | Brief (RpBrief), the cycle menu in groups,
9
+ * the lock line and the ask card (RpStates), Document as paper pages (RpDoc), Live page (RpLive), Present and the phone (RpPhone):
10
+ * L the live page · Y Start the next cycle
8
11
  * Set READ_SHOTS=<dir> to save screenshots at 1280 and 390 wide. */
9
12
  const fs = require('fs');
10
13
  const os = require('os');
@@ -50,33 +53,6 @@ fs.writeFileSync(path.join(dir, pNew), DOC); fs.writeFileSync(path.join(dir, pOl
50
53
  const git = (...a) => execFileSync('git', a, { cwd: dir, stdio: 'ignore' });
51
54
  git('init', '-q'); git('-c', 'user.name=t', '-c', 'user.email=t@t', 'add', '-A'); git('-c', 'user.name=t', '-c', 'user.email=t@t', 'commit', '-q', '-m', 'records');
52
55
  const iss = issues.appendFromCli(dir, [{ ev: 'issued', cadence: CAD, slot: '2026-10-05', path: pOld, sha: issues.blobSha(fs.readFileSync(path.join(dir, pOld))) }], { actor: { by: 'pm:wawan', via: 'cli' } });
53
- /* The stub plays the report-design run: a turn writes a two-slide deck (a third slide on a later turn); a cycle render copies the reference. */
54
- fs.writeFileSync(path.join(fakeBin, 'claude'), `#!/usr/bin/env node
55
- const fs = require('fs');
56
- let input = ''; process.stdin.on('data', (d) => { input += d; }); process.stdin.on('end', () => {
57
- const line = (k) => { const m = new RegExp('^- ' + k + ': (.*)$', 'm').exec(input); return m ? m[1].trim() : null; };
58
- const mode = line('Mode'); const out = line('Output path');
59
- const done = (o) => { process.stdout.write(JSON.stringify({ type: 'result', subtype: 'success', is_error: false, result: typeof o === 'string' ? o : JSON.stringify(o), num_turns: 2, duration_ms: 500, permission_denials: [] })); process.exit(0); };
60
- if (!mode || !out) return done('Done.');
61
- const sec = (id, title, body) => '<section class="pmos-slide" data-slide-id="' + id + '" data-kind="text" data-title="' + title + '">' + body + '</section>';
62
- if (mode === 'turn') {
63
- const prev = line('Previous version');
64
- const more = prev && prev.startsWith('/');
65
- const html = '<style>.pmos-slide{width:1280px;height:720px}.pmos-slide h1{font-size:64px;margin:80px}</style><script>window.parent.hacked = 1</script>'
66
- + sec('title', 'Partner review', '<h1 onclick="steal()">Partner review</h1>') + sec('headline', 'Headline', '<h2>Partner activation is 33%</h2>') + (more ? sec('needs', 'Needs your call', '<h2>Extend the pilot?</h2>') : '');
67
- const took = [...input.matchAll(/^ {2}- (s-[0-9a-f]{8}) \\(NEW\\) "([^"]*)"/gm)].map((m) => ({ id: m[1], took: 'The dark title band from ' + m[2], readable: true }));
68
- fs.writeFileSync(out, html);
69
- setTimeout(() => done({ answer: more ? 'Added a slide for what needs your call.' : 'Made a dark title band.', took, rules: { same: ['The slide order'], changes: ['The numbers'], learned: [] } }), 400);
70
- } else {
71
- fs.writeFileSync(out, fs.readFileSync(line('Reference version'), 'utf8'));
72
- done({ answer: 'Rendered the cycle.' });
73
- }
74
- });
75
- `, { mode: 0o755 });
76
- const PNG = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==', 'base64');
77
- fs.writeFileSync(path.join(base, 'q3-deck.png'), PNG);
78
- fs.writeFileSync(path.join(base, 'brand.png'), PNG);
79
-
80
56
  (async () => {
81
57
  ok('setup: the older cycle is issued', iss && iss.ok === true, JSON.stringify(iss));
82
58
  const exe = findBrowser();
@@ -90,197 +66,176 @@ fs.writeFileSync(path.join(base, 'brand.png'), PNG);
90
66
 
91
67
  const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 }, acceptDownloads: true }), p = await ctx.newPage(), errs = [], posts = [];
92
68
  p.on('pageerror', (e) => errs.push(String(e)));
93
- p.on('request', (r) => { const u = new URL(r.url()).pathname; if (r.method() === 'POST' && u !== '/api/doc-health/check' && u !== '/api/briefing-premium/seen') posts.push(u); }); // the document page's health check is a read sent as a POST; it writes nothing. An opened popup's seen record (popup context slice 11) is not a press either.
69
+ p.on('request', (r) => { const u = new URL(r.url()).pathname; if (r.method() === 'POST' && u !== '/api/doc-health/check') posts.push(u); }); // the document health check is a read sent as a POST; it writes nothing
94
70
  const shot = async (n) => { if (process.env.READ_SHOTS) await p.screenshot({ path: path.join(process.env.READ_SHOTS, n + '.png') }); };
95
- const tap = (sel) => p.$eval(sel, (b) => b.click());
96
- const lastA = () => p.evaluate(() => { const a = [...document.querySelectorAll('#dBody .stream .turn.a .tt')]; return a.length ? a[a.length - 1].textContent : ''; });
97
- const counter = () => p.evaluate(() => (document.querySelector('#rdN') || {}).textContent || '');
98
- const bigTitle = () => p.evaluate(() => { const h = document.querySelector('#rdSlide h3'); return h ? h.textContent : (document.querySelector('#rdSlide iframe') ? 'frame' : ''); });
99
- const say = async (t) => { await p.fill('#rdIn', t); await p.press('#rdIn', 'Enter'); };
100
- await p.goto(BASE + '/premium-insights.html?tab=library'); // Library holds the reports (premium-agreed-design G2)
101
- await until(() => p.evaluate(() => !!document.querySelector('#listSeg [data-f="rep"]')));
102
- await (async (pg, sel) => { if (await pg.locator('#listSeg').isHidden()) await pg.click('#listF'); await pg.click(sel); })(p, '#listSeg [data-f="rep"]'); // the one list (insights-one-list L5): the Reports filter holds the report files
103
- await until(() => p.evaluate(() => document.querySelectorAll('#listRows [data-rpt]').length === 1));
104
- const ROW = `#listRows [data-rpt="${CAD}"]`;
105
- ok('C0 one row for the report, with its cycles counted (PM 2026-10-22: no duplicate of the same report)', /1 draft/.test(await p.textContent(ROW)) && /1 issued/.test(await p.textContent(ROW)), await p.textContent(ROW));
106
- const toCycle = async (rel) => { await p.click('#dSub [data-rr="cycm"]'); await p.click(`#dSub [data-rr="cyc|${rel}"]`); };
107
-
108
- /* O: the report row opens its latest cycle in the reader on the page */
109
- await tap(ROW);
110
- await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#rdSlide')));
111
- ok('O1 a document row opens the reader on the page, not the console', p.url().includes('/premium-insights.html') && await p.evaluate(() => document.querySelector('#dlg').classList.contains('rdrd')), p.url());
112
- ok('O2 the dialog names the report, its date and its state', await p.textContent('#dTitle') === CAD && /2026-10-12|12 Oct/.test(await p.textContent('#dSub')) && /draft/.test(await p.textContent('#dEye')), await p.textContent('#dEye'));
113
- await p.evaluate(() => document.fonts.ready); await until(() => p.evaluate(() => !!document.querySelector('#oMain .rdbar [data-rr="sched"]'))); // the schedule chip lands after the template read; measure the finished row
114
- const bar = await p.evaluate(() => { const L = [...document.querySelectorAll('#oMain .rdbar > *')].filter((x) => x.offsetWidth && x.offsetHeight), c = L.map((x) => { const r = x.getBoundingClientRect(); return r.top + r.height / 2; }); return { spread: Math.round(Math.max(...c) - Math.min(...c)), words: [...document.querySelectorAll('#oMain .rdbar .rdib')].filter((b) => b.textContent.trim() || !b.getAttribute('aria-label') || !b.title).length }; }); // one row: every item's centre within a few px (the empty spacer is left out)
71
+ const V = '#czViewer ';
72
+ const tap = (sel) => p.$eval(V + sel, (b) => b.click());
73
+ const has = (sel) => p.$(V + sel).then((x) => !!x);
74
+ const counter = () => p.evaluate(() => (document.querySelector('#czViewer .vz-snav [aria-live]') || {}).textContent || '');
75
+ const bigTitle = () => p.evaluate(() => { const h = document.querySelector('#czViewer .vz-slide h4'); return h ? h.textContent : (document.querySelector('#czViewer .vz-slide iframe') ? 'frame' : ''); });
76
+ const chipT = () => p.evaluate(() => (document.querySelector('#czViewer [data-r="cycm"]') || {}).textContent || '');
77
+ const tools = () => p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-tb > button, #czViewer .vz-tb .vz-sg button')].filter((b) => b.getClientRects().length).map((b) => b.dataset.r).join());
78
+ const ready = () => until(() => p.evaluate(() => !!document.querySelector('#czViewer .vz-rp0 .vz-slide, #czViewer .vz-rp0 .vz-page')));
79
+ const openAt = async (rel) => { await p.goto(BASE + '/premium-viewer.html?open=report&path=' + encodeURIComponent(rel)); return ready(); };
80
+
81
+ /* O: the cycle opens in the Viewer card */
82
+ ok('O1 /premium-viewer.html?open=report opens the cycle in the Viewer card', await openAt(pNew));
83
+ ok('O2 the card has no conversation, no tabs and no old reader', await p.evaluate(() => !document.querySelector('#dlg, .stream, #vTabs, #rdSlide, #rdIn')));
84
+ ok('O3 the header names the report, and the cycle chip says Draft and its date', await p.evaluate(() => document.querySelector('#czViewer .cz-vw-kind').textContent === 'Report' && document.querySelector('#czViewer .cz-vw-title').textContent === 'Partner review, 12 Oct') && /Draft · Oct 12/.test(await chipT()), await chipT());
85
+ await until(() => has('[data-r="sched"]'));
86
+ ok('B1 the tabs are Report and Brief (RpBrief), Report open', await p.evaluate(() => [...document.querySelectorAll('#czViewer .rp-tabs [role="tab"]')].map((b) => b.dataset.r + ':' + b.getAttribute('aria-selected')).join()) === 'tab|report:true,tab|brief:false');
87
+ ok('B1 the chips are the cycle and the schedule', await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-rpc > button')].map((b) => b.dataset.r).join()) === 'cycm,sched');
88
+ ok('B1 one toolbar: Slides | Document | Live page, Edit, Present, Share, Download, Issue and More', await tools() === 'view|deck,view|doc,view|live,edit,present,share,dlm,issue,more', await tools());
89
+ const bar = await p.evaluate(() => { const L = [...document.querySelectorAll('#czViewer .vz-tb > *')].filter((x) => x.offsetWidth && x.offsetHeight && !x.classList.contains('vz-sp')), c = L.map((x) => { const r = x.getBoundingClientRect(); return r.top + r.height / 2; }); return { spread: Math.round(Math.max(...c) - Math.min(...c)), unnamed: [...document.querySelectorAll('#czViewer .vz-tb .vz-ib')].filter((b) => !b.getAttribute('aria-label') || !b.title).length }; });
90
+ ok('B1 the bar is one row, and each icon button is named by its label and tooltip', bar.spread <= 6 && bar.unnamed === 0, JSON.stringify(bar));
115
91
  await shot('reader-bar-1280');
116
- ok('O3 the bar is one row of icon buttons, each named by its label and tooltip', bar.spread <= 6 && bar.words === 0, JSON.stringify(bar));
117
- ok('O4 no source line, no design row and no Add a sample in the report pane', await p.evaluate(() => !document.querySelector('#rdSrc') && !document.querySelector('.rdz') && !document.querySelector('#oMain [data-rr="pick"]')));
118
- /* C: the cycle chip under the name lists this report's cycles, grouped */
119
- await p.click('#dSub [data-rr="cycm"]');
120
- const cm = await p.evaluate(() => ({ chip: document.querySelector('#dSub [data-rr="cycm"]').textContent, groups: [...document.querySelectorAll('#dSub .rdcm .label')].map((x) => x.textContent), items: document.querySelectorAll('#dSub .rdcm [data-rr^="cyc|"]').length }));
121
- ok('C1 the cycle chip says the date and 2 cycles; its menu groups them Draft and Issued', /12 Oct · 2 cycles/.test(cm.chip) && cm.groups.join() === 'Draft,Issued' && cm.items === 2, JSON.stringify(cm));
122
- await p.click('#dSub [data-rr="cycm"]');
92
+
93
+ /* C: the cycle chip lists this report's cycles */
94
+ await tap('[data-r="cycm"]');
95
+ const cm = await p.evaluate(() => [...document.querySelectorAll('#czViewer [data-r^="cyc|"]')].map((b) => b.textContent));
96
+ const cg = await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-pop-cyc .vz-lab')].map((b) => b.textContent).join());
97
+ ok('C1 the cycle menu groups the cycles under Draft and Issued (RpStates), with no placeholder', cm.join('|') === 'Oct 12draft|Oct 5issued' && cg === 'Draft,Issued' && !(await has('[data-cz-placeholder]')), JSON.stringify(cm) + ' ' + cg);
98
+ await tap('[data-r="cycm"]');
123
99
 
124
100
  /* D: the deck */
125
- ok('D1 the deck has a title slide and one slide per section', await counter() === '1 / 5' && await bigTitle() === 'Partner review, 12 Oct', await counter());
126
- const strip = await p.evaluate(() => [...document.querySelectorAll('.rdt button span')].map((s) => s.textContent));
127
- ok('D2 the strip lists the slides in the document\'s order', strip.join() === 'Partner review, 12 Oct,Headline,Initiatives,Needs your call,Sources', strip.join());
128
- await tap('#oMain [data-rr="next"]');
129
- ok('D3 Next moves to the headline, with its words as written', await counter() === '2 / 5' && await p.evaluate(() => document.querySelector('#rdSlide').textContent.includes('Partner activation is 33%, short of its line.') && document.querySelector('#rdSlide b').textContent === '33%'));
130
- await p.focus('#rdSlide'); await p.keyboard.press('ArrowRight');
131
- ok('D4 the arrow keys move, and a list stays a list', await counter() === '3 / 5' && await p.evaluate(() => document.querySelectorAll('#rdSlide li').length === 2));
132
- await tap('#oMain [data-rr="go|4"]');
133
- ok('D5 the strip goes to a slide', await counter() === '5 / 5' && await bigTitle() === 'Sources' && await p.evaluate(() => document.querySelector('[data-rr="next"]').disabled));
101
+ ok('D1 the deck has a title slide and one slide per section', await counter() === '1 of 5' && await bigTitle() === 'Partner review, 12 Oct', await counter());
102
+ ok('D1 the title slide carries the first section\'s bold figure as its headline figure (ReportPanel.dc.html), and the thumbnail does not', await p.evaluate(() => { const f = document.querySelector('#czViewer .vz-rp0 .vz-slide .vz-tfig b'); return !!f && f.textContent === '33%' && !document.querySelector('#czViewer .vz-th .vz-tfig'); }), await p.evaluate(() => (document.querySelector('#czViewer .vz-rp0 .vz-slide') || {}).innerHTML));
103
+ const strip = await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-th')].map((b) => b.getAttribute('aria-label')));
104
+ ok('D2 the thumbnails list the slides in the document\'s order', strip.join() === 'Slide 1: Title,Slide 2: Headline,Slide 3: Initiatives,Slide 4: Needs your call,Slide 5: Sources', strip.join());
105
+ await tap('[data-r="next"]');
106
+ ok('D3 Next moves to the headline, with its words as written', await counter() === '2 of 5' && await p.evaluate(() => document.querySelector('#czViewer .vz-slide').textContent.includes('Partner activation is 33%, short of its line.') && document.querySelector('#czViewer .vz-slide b').textContent === '33%'));
107
+ await p.focus(V + '.vz-slide'); await p.keyboard.press('ArrowRight');
108
+ ok('D4 the arrow keys move, and a list stays a list', await until(async () => await counter() === '3 of 5') && await p.evaluate(() => document.querySelectorAll('#czViewer .vz-slide li').length === 2));
109
+ await tap('[data-r="go|4"]');
110
+ ok('D5 a thumbnail goes to its slide', await counter() === '5 of 5' && await bigTitle() === 'Sources' && await p.evaluate(() => document.querySelector('#czViewer [data-r="next"]').disabled));
134
111
  await shot('reader-deck-1280');
135
112
 
136
- /* G: the page */
137
- await tap('#oMain [data-rr="view|doc"]');
138
- const heads = await p.evaluate(() => [...document.querySelectorAll('.rdpg h3')].map((h) => h.textContent));
139
- ok('G1 Document shows the headings as written', heads.join() === 'Headline,Initiatives,Needs your call,Sources' && await p.evaluate(() => document.querySelector('.rdpg h2').textContent) === 'Partner review, 12 Oct', heads.join());
140
- await tap('#oMain [data-rr="view|deck"]');
113
+ /* G: the document, as paper (RpDoc) */
114
+ await tap('[data-r="view|doc"]');
115
+ const heads = await p.evaluate(() => [...document.querySelectorAll('#czViewer .rp-pg h2')].map((h) => h.textContent));
116
+ ok('G1 Document is paper: the title, the headline as In one minute, numbered sections as written', heads.join() === '1 · Initiatives,2 · Needs your call' && await p.evaluate(() => document.querySelector('#czViewer .rp-pg h1').textContent === 'Partner review, 12 Oct' && /33%/.test(document.querySelector('#czViewer .rp-minute').textContent)), heads.join());
117
+ ok('G2 the sources are the footnote line, the bar says Page 1 of 1 and Draft, and offers Download as PDF or Word', await p.evaluate(() => /krm-a/.test(document.querySelector('#czViewer .rp-fn').textContent) && /Page 1 of 1/.test(document.querySelector('#czViewer [data-rp-page]').textContent) && document.querySelector('#czViewer .rp-paperbar .rp-pill').textContent === 'Draft' && !!document.querySelector('#czViewer [data-r="dlm"]')));
118
+ await shot('reader-doc-1280');
119
+ await tap('[data-r="dlm"]');
120
+ ok('G3 Download offers PDF and Word, Word from report-export', await p.evaluate(() => { const a = document.querySelector('#czViewer .vz-pop-dl [data-r="dl|docx"]'); return !!document.querySelector('#czViewer .vz-pop-dl [data-r="pdf"]') && a && /fmt=docx/.test(a.getAttribute('href')); }));
121
+ await tap('[data-r="dlm"]');
122
+
123
+ /* L: the live page (RpLive): the numbers Insights reads */
124
+ await tap('[data-r="view|live"]');
125
+ await until(() => has('.rp-live .rp-kps, .rp-live .rp-empty'));
126
+ const lv = await p.evaluate(() => ({ tiles: [...document.querySelectorAll('#czViewer .rp-kp > span:first-child')].map((x) => x.textContent), first: (document.querySelector('#czViewer .rp-kp b') || {}).textContent, pts: document.querySelectorAll('#czViewer .rp-pt').length }));
127
+ ok('L1 Live page: the goal tile with its latest reading, then Goals on track, Shipped and At risk', lv.tiles.join() === 'Partner activation,Goals on track,Shipped,At risk' && lv.first === '33%', JSON.stringify(lv));
128
+ await tap('[data-r="lv|range|q"]');
129
+ ok('L2 the range Q draws the three readings, and a point names its value', await p.evaluate(() => document.querySelectorAll('#czViewer .rp-pt').length === 3) && await p.evaluate(() => /33%/.test(document.querySelectorAll('#czViewer .rp-pt')[2].getAttribute('aria-label'))));
130
+ await tap('[data-r="lv|pt|2"]');
131
+ ok('L3 pressing a point opens its popover with Open in Insights', await p.evaluate(() => /1 Oct · 33%/.test((document.querySelector('#czViewer .rp-pop') || {}).textContent || '')));
132
+ await shot('reader-live-1280');
133
+ await tap('[data-r="view|deck"]');
134
+
135
+ /* B2 the schedule; K the Brief */
136
+ await tap('[data-r="sched"]');
137
+ ok('B2 a report with no template says Not scheduled; its popover offers the cadences, the weekdays and the time, and says a template is saved', /Not scheduled/.test(await p.textContent(V + '[data-r="sched"]')) && await p.evaluate(() => document.querySelectorAll('#czViewer [data-r^="scad|"]').length === 4 && document.querySelectorAll('#czViewer [data-r^="sday|"]').length === 5 && !!document.querySelector('#czViewer [data-r="stime"]')) && /saves its sections and look as a template/.test(await p.textContent(V + '.vz-pop')));
138
+ await tap('[data-r="pop|"]');
139
+ await tap('[data-r="tab|brief"]');
140
+ await until(() => has('.rp-brief'));
141
+ const bf = await p.evaluate(() => ({ dt: [...document.querySelectorAll('#czViewer .rp-kv dt')].map((x) => x.textContent).join(), chips: [...document.querySelectorAll('#czViewer .rp-kv .rp-chip')].map((x) => x.textContent).join(), lbl: [...document.querySelectorAll('#czViewer .rp-brief .rp-lbl')].map((x) => x.textContent).join(), text: document.querySelector('#czViewer .rp-brief').textContent, tb: !!document.querySelector('#czViewer .vz-tb') }));
142
+ ok('K1 Brief (RpBrief): At a glance For, Read by, Goes out, Built from (the sources the report names), Please confirm, Why it looks like this', bf.dt === 'For,Read by,Goes out,Built from' && bf.chips === 'KR metric record krm-a' && bf.lbl === 'At a glance,Please confirm,Why it looks like this' && !bf.tb, JSON.stringify(bf));
143
+ ok('K2 every check passed, so nothing waits; no look is saved, so it says the standard look; no placeholder', /Nothing to confirm/.test(bf.text) && /standard PMOS look/.test(bf.text) && !(await has('[data-cz-placeholder]')));
144
+ await shot('reader-brief-1280');
145
+ await tap('[data-r="tab|report"]');
141
146
 
142
147
  /* N: Present */
143
- await tap('#oMain [data-rr="go|0"]');
144
- ok('B1 one bar: Slides | Page, Brief, the schedule, Edit, Present, Share, Issue and More', await p.evaluate(() => [...document.querySelectorAll('#oMain .rdbar button')].map((b) => b.dataset.rr).join()) === 'view|deck,view|doc,brief,sched,edit,present,share,issue,mo', await p.evaluate(() => [...document.querySelectorAll('#oMain .rdbar button')].map((b) => b.dataset.rr).join()));
145
- await tap('#oMain [data-rr="sched"]');
146
- ok('B2 a report with no template says so in its schedule menu, and offers a chat to set one up', /None/.test(await p.textContent('#oMain [data-rr="sched"]')) && /no template/.test(await p.textContent('#oMain .rdsm')) && !!await p.$('#oMain .rdsm a[href*="premium-chat.html"]'));
147
- await tap('#oMain [data-rr="sched"]');
148
- await tap('#oMain [data-rr="present"]');
149
- await until(() => p.$('#rdPres'));
150
- ok('N1 Present shows the current slide over the whole page', await p.evaluate(() => { const r = document.querySelector('#rdPres').getBoundingClientRect(); return r.width >= innerWidth - 1 && r.height >= innerHeight - 1 && !!document.querySelector('#rdPres .rds.title'); }));
148
+ await tap('[data-r="go|0"]');
149
+ await tap('[data-r="present"]');
150
+ await until(() => p.$('#vzPres'));
151
+ ok('N1 Present shows the current slide over the whole page, its numbered strip, Stop presenting and the key hint', await p.evaluate(() => { const e = document.querySelector('#vzPres'), r = e.getBoundingClientRect(); return r.width >= innerWidth - 1 && r.height >= innerHeight - 1 && !!e.querySelector('.vz-title') && e.querySelectorAll('.rp-tb').length === 5 && !!e.querySelector('[data-r="end"]') && /B to blank/.test(e.textContent) && !e.querySelector('[data-cz-placeholder]'); }));
152
+ await shot('reader-present-1280');
151
153
  await p.keyboard.press('ArrowRight');
152
- ok('N2 the arrow keys move while presenting', await p.evaluate(() => document.querySelector('#rdPres .rdpn span').textContent) === '2 / 5');
153
- await p.keyboard.press('Escape'); await sleep(200);
154
- ok('N3 Escape stops presenting and the reader stays open on that slide', !await p.$('#rdPres') && await p.evaluate(() => document.querySelector('#dlg').classList.contains('on')) && await counter() === '2 / 5');
154
+ ok('N2 the arrow keys move while presenting', await until(() => p.evaluate(() => /^Slide 2 of 5$/.test(document.querySelector('#vzPres .rp-prh [aria-live]').textContent))));
155
+ await p.keyboard.press('b');
156
+ ok('N2 B blanks the screen, and B again shows the slide', await until(() => p.evaluate(() => !!document.querySelector('#vzPres .rp-blank'))) && (await p.keyboard.press('b'), await until(() => p.evaluate(() => !document.querySelector('#vzPres .rp-blank')))));
157
+ await p.keyboard.press('Escape');
158
+ ok('N3 Escape stops presenting and the card stays open on that slide', await until(() => p.evaluate(() => !document.querySelector('#vzPres'))) && await counter() === '2 of 5');
155
159
 
156
160
  /* W: download */
157
- await tap('#oMain [data-rr="mo"]');
158
- const items = await p.evaluate(() => [...document.querySelectorAll('.rpm [role="menuitem"]')].map((a) => a.textContent.split('(')[0].trim() + '|' + (a.getAttribute('href') || '')));
159
- ok('W0 More names the file first', await p.evaluate((f) => document.querySelector('.rdmo .rdfile').textContent === f, pNew.split('/').pop()));
160
- ok('W1 More offers PowerPoint, Word, Excel, CSV and Markdown through report-export, then Print and Discard', items.length === 7 && /Print/.test(items[5]) && /Discard/.test(items[6]) && items.slice(0, 4).every((x, i) => x.includes('/api/report-export?') && x.includes('fmt=' + ['pptx', 'docx', 'xlsx', 'csv'][i]) && x.includes('path=' + encodeURIComponent(pNew))), items.join(' / '));
161
- const [dl] = await Promise.all([p.waitForEvent('download'), p.click('.rpm [data-rr="dl|pptx"]')]);
161
+ await tap('[data-r="more"]');
162
+ const items = await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-fmts .vz-fmt')].map((a) => a.textContent + '|' + (a.getAttribute('href') || '')));
163
+ ok('W1 More offers PPTX, DOCX, PDF, XLSX, CSV and MD; the Office files and CSV come from report-export', items.map((x) => x.split('|')[0]).join() === 'PPTX,DOCX,PDF,XLSX,CSV,MD' && [0, 1, 3, 4].every((i) => items[i].includes('/api/report-export?') && items[i].includes('fmt=' + ['pptx', 'docx', '', 'xlsx', 'csv'][i]) && items[i].includes('path=' + encodeURIComponent(pNew))), items.join(' / '));
164
+ ok('W1 then Print, Versions with 2 cycles and Discard this draft', await p.evaluate(() => !!document.querySelector('#czViewer .vz-pop [data-r="print"]') && /Versions\s*2 cycles/.test(document.querySelector('#czViewer .vz-pop [data-r="cycm"]').textContent) && /Discard this draft/.test(document.querySelector('#czViewer .vz-pop [data-r="discard"]').textContent)));
165
+ const [dl] = await Promise.all([p.waitForEvent('download'), p.click(V + '[data-r="dl|pptx"]')]);
162
166
  const pptx = fs.readFileSync(await dl.path());
163
- ok('W2 PowerPoint downloads a .pptx of the document', /\.pptx$/.test(dl.suggestedFilename()) && pptx.slice(0, 2).toString() === 'PK', dl.suggestedFilename());
164
- await tap('#oMain [data-rr="mo"]');
165
- const [md] = await Promise.all([p.waitForEvent('download'), p.click('.rpm [data-rr="md"]')]);
166
- ok('W3 Markdown downloads the file as written', fs.readFileSync(await md.path(), 'utf8') === DOC && /\.md$/.test(md.suggestedFilename()), md.suggestedFilename());
167
+ ok('W2 PPTX downloads a .pptx of the document', /\.pptx$/.test(dl.suggestedFilename()) && pptx.slice(0, 2).toString() === 'PK', dl.suggestedFilename());
168
+ await until(() => p.evaluate(() => !document.querySelector('#czViewer .vz-pop')));
169
+ await tap('[data-r="more"]');
170
+ const [md] = await Promise.all([p.waitForEvent('download'), p.click(V + '[data-r="md"]')]);
171
+ ok('W3 MD downloads the file as written', fs.readFileSync(await md.path(), 'utf8') === DOC && /\.md$/.test(md.suggestedFilename()), md.suggestedFilename());
167
172
 
168
173
  /* X: print */
169
174
  await p.evaluate(() => { window.__pr = null; window.open = () => ({ document: { open() {}, write(h) { window.__pr = h; }, close() {} }, focus() {}, print() { window.__printed = true; } }); });
170
- await tap('#oMain [data-rr="mo"]'); await tap('#oMain [data-rr="print"]'); await sleep(450);
171
- const pr = await p.evaluate(() => ({ h: window.__pr || '', printed: !!window.__printed }));
172
- ok('X1 Print opens the print page with one slide to a page', pr.printed && /pmos-print-deck/.test(pr.h) && (pr.h.match(/class="pmos-slide"/g) || []).length === 5 && pr.h.includes('premium-report-print.css'), pr.h.slice(0, 300));
173
-
174
- /* E: Edit edits in place (PM 2026-10-22): on Page the page editor, inside the dialog, with no viewer tab; Cancel brings the report back */
175
- await tap('#oMain [data-rr="view|doc"]');
176
- await tap('#oMain [data-rr="edit"]');
177
- const VP = '#rdEd .vwdoc';
178
- await until(() => p.evaluate((v) => !!document.querySelector(v + ' .cf.editing'), VP));
179
- ok('E1 Edit on Page opens the page editor in the dialog, in Edit, with Edit and Markdown only', await p.evaluate((v) => document.querySelectorAll(v + ' .vwseg').length === 2 && /Partner review, 12 Oct/.test(document.querySelector(v + ' .cft').textContent) && !document.querySelector(v + ' .vwbtn[data-vwx]') && !document.querySelector(v + ' [data-vd="askt"]'), VP));
180
- ok('E2 no viewer tab is opened, and the bar keeps only Slides | Page', await p.evaluate(() => !String(window.__premiumViewer.vwState().on || '').startsWith('doc:') && [...document.querySelectorAll('#oMain .rdbar button')].map((b) => b.dataset.rr).join() === 'view|deck,view|doc'));
181
- await p.click(VP + ' [data-vd="cancel"]');
182
- await until(() => p.evaluate(() => !document.querySelector('#rdEd') && !!document.querySelector('#oMain [data-rr="edit"]')));
183
- ok('E3 Cancel brings the report back', await p.evaluate(() => !!document.querySelector('#oMain .rdpg') && !document.querySelector('#rdEd')));
184
- await tap('#oMain [data-rr="view|deck"]');
185
-
186
- /* L: the look (PM 2026-10-22: no This cycle / D1 / D2 row; a new look waits on one line, Use it or Keep current; samples sit above the chat box) */
187
- ok('L1 with no design yet, there is no look line and no sample chip', await p.evaluate(() => !document.querySelector('#oMain .rdlook') && document.querySelector('#rdSmp').hidden));
188
- await p.setInputFiles('#rdFile', path.join(base, 'q3-deck.png'));
189
- await until(() => p.evaluate(() => /q3-deck\.png/.test(document.querySelector('#rdSmp').textContent)));
190
- ok('L2 the clip adds a sample, shown as a chip above the chat box', /Follows/.test(await p.textContent('#rdSmp')) && !await p.evaluate(() => document.querySelector('#rdSmp').hidden) && /Added "q3-deck.png"/.test(await lastA()), await lastA());
191
- await say('A dark title band, like the sample');
192
- ok('L3 a turn says PMOS is working', /PMOS is working on it/.test(await lastA()));
193
- await until(() => p.evaluate(() => /shown in the report/.test([...document.querySelectorAll('#dBody .stream .turn.a .tt')].pop().textContent)), 30000);
194
- ok('L4 the job\'s answer shows, and the new look waits on one line with Use it and Keep current', /Made a dark title band\. It is shown in the report/.test(await lastA()) && /New look ready/.test(await p.textContent('#oMain .rdlook')) && !!await p.$('#oMain [data-rr="lookuse"]') && !!await p.$('#oMain [data-rr="lookno"]'), await lastA());
195
- const fr = await p.evaluate(() => [...document.querySelectorAll('#oMain iframe')].map((f) => ({ sb: f.getAttribute('sandbox'), doc: f.getAttribute('srcdoc') || '' })));
196
- ok('L5 the new look shows in frames with an empty sandbox, and its script and handlers were dropped', fr.length >= 1 && fr.every((f) => f.sb === '' && !/<script|onclick|steal/.test(f.doc)) && await p.evaluate(() => !window.hacked), JSON.stringify(fr.map((f) => f.sb)));
197
- ok('L6 the deck of the new look has its two slides', await counter() === '1 / 2');
198
- await say('Add a slide for what needs your call');
199
- await until(() => p.evaluate(() => /Added a slide/.test([...document.querySelectorAll('#dBody .stream .turn.a .tt')].pop().textContent)), 30000);
200
- ok('L7 a second turn builds on it, and the line names the latest request', await counter() === '1 / 3' && /Add a slide for what needs your call/.test(await p.textContent('#oMain .rdlook')), await lastA());
201
- const nPosts = posts.length;
202
- await tap('#oMain [data-rr="lookno"]');
203
- await until(() => p.evaluate(() => !document.querySelector('#oMain .rdlook')));
204
- ok('L8 Keep current, with no look saved yet, puts the line away, shows the words again and posts nothing', await counter() === '1 / 5' && posts.length === nPosts && /Kept the current look/.test(await lastA()), await lastA());
205
-
206
- /* K: the Brief, in its own viewer tab */
207
- await tap('#oMain [data-rr="brief"]');
208
- await until(() => p.evaluate(() => !!document.querySelector('[data-vw="brief:partner-review"] .rbs')));
209
- const BR = '[data-vw="brief:partner-review"]';
210
- const bk = await p.evaluate((B) => ({ tab: window.__premiumViewer.vwState().on, heads: [...document.querySelectorAll(B + ' .rbs h4')].map((h) => h.firstChild.textContent), conf: (document.querySelector(B + ' .rbto') || {}).textContent || '', glance: document.querySelector(B + ' #rb-glance').textContent }), BR);
211
- ok('K1 Brief opens in its own viewer tab, not beside the report', bk.tab === 'brief:partner-review', JSON.stringify(bk));
212
- ok('K2 a report with no template says so: no schedule, and a question to confirm', /None: it has no template/.test(bk.glance) && /1 to confirm/.test(bk.conf) && /no template/.test(await p.textContent(BR + ' #rb-open')), JSON.stringify(bk));
213
- ok('K3 Why it looks like this lists the sample and the earlier looks, each with Go back to it', /q3-deck\.png/.test(await p.textContent(BR + ' #rb-design')) && await p.evaluate((B) => document.querySelectorAll(B + ' [data-rb^="back|"]').length === 2, BR));
214
- await p.click(BR + ' [data-rb="back|1"]');
215
- await until(() => p.evaluate(() => !!document.querySelector('#oMain .rdlook')));
216
- ok('K4 Go back to it shows that earlier look in the report with the Use it line', /A dark title band, like the sample/.test(await p.textContent('#oMain .rdlook')) && await counter() === '1 / 2' && posts.filter((x) => x === '/api/report-design/revert').length === 1, await p.textContent('#oMain .rdlook'));
217
- await tap('#oMain [data-rr="lookuse"]');
218
- await until(() => p.evaluate(() => /This look is now the design/.test([...document.querySelectorAll('#dBody .stream .turn.a .tt')].pop().textContent)), 15000);
219
- ok('L9 Use it saves the look as the design and puts the line away', !await p.$('#oMain .rdlook') && posts.filter((x) => x === '/api/report-design/accept').length === 1, await lastA());
220
- await until(() => bigTitle().then((t) => t === 'frame'), 30000);
221
- ok('L10 this cycle, redrawn, shows in the saved design in sandboxed frames', await bigTitle() === 'frame' && await p.evaluate(() => [...document.querySelectorAll('#oMain iframe')].every((f) => f.getAttribute('sandbox') === '')));
222
- await shot('reader-look-1280');
223
- await p.setInputFiles('#rdFile', path.join(base, 'brand.png'));
224
- await until(() => p.evaluate(() => /brand\.png/.test(document.querySelector('#rdSmp').textContent)));
225
- ok('L11 each sample chip has its own remove button, named for the sample', await p.evaluate(() => [...document.querySelectorAll('#rdSmp [data-rr^="unsample|"]')].map((b) => b.getAttribute('aria-label')).join()) === 'Remove the sample q3-deck.png,Remove the sample brand.png');
226
- await p.click('#rdSmp [aria-label="Remove the sample q3-deck.png"]');
227
- await until(() => p.evaluate(() => !/q3-deck\.png/.test(document.querySelector('#rdSmp').textContent)));
228
- ok('L12 removing a sample drops its chip, keeps the other, and says the next version stops following it', /brand\.png/.test(await p.textContent('#rdSmp')) && /Removed "q3-deck.png"\. The next version and each new cycle no longer follow it/.test(await lastA()), await lastA());
229
- await tap(BR + ' [data-rb="fix|Why it looks like this"]');
230
- const fixT = await p.evaluate(() => document.querySelector('#rdIn').value);
231
- ok('K5 Correct puts the section in the chat box', fixT === 'Correct "Why it looks like this": ', fixT);
232
- await p.fill('#rdIn', 'Correct "Why it looks like this": the title band is navy'); await p.press('#rdIn', 'Enter');
233
- await until(() => p.evaluate(() => /no template yet/.test([...document.querySelectorAll('#dBody .stream .turn.a .tt')].pop().textContent)), 10000);
234
- ok('K6 a correction of a report with no template says how to set one up, and posts nothing', /no template yet/.test(await lastA()) && posts[posts.length - 1] === '/api/report-design/unsample', await lastA());
235
- await p.click('#dClose'); await sleep(200);
175
+ await tap('[data-r="more"]'); await tap('[data-r="print"]');
176
+ const pr = await until(() => p.evaluate(() => (window.__printed ? { h: window.__pr || '' } : null)));
177
+ ok('X1 Print opens the print page with one slide to a page', pr && /pmos-print-deck/.test(pr.h) && (pr.h.match(/class="pmos-slide"/g) || []).length === 5 && pr.h.includes('premium-report-print.css'), pr ? pr.h.slice(0, 300) : 'not printed');
178
+
179
+ /* E: Edit edits in place: on Page the page editor, inside the card; Cancel brings the report back */
180
+ await tap('[data-r="view|doc"]');
181
+ await tap('[data-r="edit"]');
182
+ ok('E1 Edit on Page mounts the page editor in the card, marked Waiting for design', await until(() => p.evaluate(() => { const h = document.querySelector('#czViewer [data-vz-ed]'); return h && h.dataset.mounted && h.children.length > 0 && !!document.querySelector('#czViewer [data-cz-placeholder="Page editor"]'); }), 15000));
183
+ ok('E2 while editing the cycle chip says Editing the Oct 12 draft, and the bar keeps Slides | Page and Cancel', /Editing the Oct 12 draft/.test(await chipT()) && await tools() === 'view|deck,view|doc,edcancel', await tools());
184
+ await tap('[data-r="edcancel"]');
185
+ ok('E3 Cancel brings the report back', await until(() => p.evaluate(() => !!document.querySelector('#czViewer .rp-pg') && !document.querySelector('#czViewer [data-vz-ed]'))));
186
+ await tap('[data-r="view|deck"]');
236
187
 
237
188
  /* I: an issued cycle is frozen; the cycle chip opens it */
238
- await tap(ROW);
239
- await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#rdSlide')));
240
- await toCycle(pOld);
241
- await until(() => p.evaluate(() => /issued/.test(document.querySelector('#dEye').textContent) && !!document.querySelector('#rdSlide')));
242
- ok('I1 the cycle chip reads the issued cycle: no turn, no Edit, no Issue, and it says it is frozen', !await p.$('#rdF') && !await p.$('#oMain .rdlook') && !await p.$('#oMain [data-rr="edit"]') && !await p.$('#oMain [data-rr="issue"]') && /issued, so it is frozen/.test(await p.textContent('#dBody .stream')) && /5 Oct/.test(await p.textContent('#dSub')));
243
- ok('I2 an issued cycle still reads as a deck', await counter() === '1 / 3');
244
- await p.click('#dClose'); await sleep(200);
189
+ await tap('[data-r="cycm"]');
190
+ await tap(`[data-r="cyc|${pOld}"]`);
191
+ await until(async () => /Issued · Oct 5/.test(await chipT()) && !!(await p.$(V + '.vz-slide')));
192
+ ok('I1 the cycle menu opens the issued cycle: no Edit and no Issue, and the lock line with Start the next cycle (RpStates)', !(await has('[data-r="edit"]')) && !(await has('[data-r="issue"]')) && /Issued, so it stays as sent/.test(await p.evaluate(() => (document.querySelector('#czViewer .rp-lock') || {}).textContent || '')) && await has('.rp-lock [data-r="nextcyc"]'), await chipT());
193
+ ok('I2 an issued cycle still reads as a deck', await counter() === '1 of 3', await counter());
245
194
 
246
195
  /* P: the writes */
247
- const allowed = new Set(['/api/report-design/describe', '/api/report-design/sample', '/api/report-design/turn', '/api/report-design/accept', '/api/report-design/revert', '/api/report-design/unsample', '/api/report-structure/turn']);
248
- ok('P1 before Issue, the only POSTs are the report-design describe, sample, unsample, turn, accept and revert routes and the structure turn of a correction', posts.length > 0 && posts.every((x) => allowed.has(x)), posts.join());
249
- ok('P2 the first turn described the look first, and each later press posted once', posts.join() === ['sample', 'describe', 'turn', 'turn', 'revert', 'accept', 'sample', 'unsample'].map((x) => '/api/report-design/' + x).join(), posts.join());
250
- ok('P3 the document file is unchanged', fs.readFileSync(path.join(dir, pNew), 'utf8') === DOC);
196
+ ok('P1 reading, presenting, downloading, printing and editing without saving post nothing', posts.length === 0, posts.join());
197
+ ok('P2 the document file is unchanged', fs.readFileSync(path.join(dir, pNew), 'utf8') === DOC);
251
198
 
252
199
  /* F: floors */
253
- await tap(ROW);
254
- await until(() => p.evaluate(() => !!document.querySelector('#rdSlide')));
255
- const small = await p.evaluate(() => [...document.querySelectorAll('#oMain button, #oMain a')].filter((b) => b.offsetParent && !b.closest('.rdt')).map((b) => { return { t: (b.textContent || b.getAttribute('aria-label') || '').trim().slice(0, 30), h: b.offsetHeight }; }).filter((x) => x.h < 44 && x.t !== 'Open in the console'));
256
- ok('F1 every control of the reader is at least 44 px tall', small.length === 0, JSON.stringify(small));
257
- await p.setViewportSize({ width: 390, height: 844 }); await sleep(400);
258
- ok('F2 no sideways scroll at 390 px', await p.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1 && document.querySelector('#oMain').scrollWidth <= document.querySelector('#oMain').clientWidth + 1));
200
+ await openAt(pNew);
201
+ await p.setViewportSize({ width: 390, height: 844 });
202
+ await until(() => p.evaluate(() => !document.querySelectorAll('#czViewer .vz-tb .vz-dko')[0].getClientRects().length));
203
+ const fl = await p.evaluate(() => ({ over: document.documentElement.scrollWidth - innerWidth, desk: [...document.querySelectorAll('#czViewer .vz-tb .vz-dko')].filter((b) => b.getClientRects().length).length, shown: [...document.querySelectorAll('#czViewer .vz-tb > button, #czViewer .vz-tb .vz-sg button')].filter((b) => b.getClientRects().length).map((b) => b.dataset.r).join() }));
204
+ ok('F1 at 390 px: no sideways scroll; the bar keeps Slides | Page, Issue and More', fl.over <= 0 && fl.desk === 0 && fl.shown === 'view|deck,view|doc,issue,more', JSON.stringify(fl));
205
+ ok('F1 at 390 px (RpPhone): Report | Brief, "Slide 1 of 5 · swipe for the next", no thumbnails, and a full-width Present', await p.evaluate(() => { const v = (s) => { const e = document.querySelector('#czViewer ' + s); return !!e && e.getClientRects().length > 0; }; const pr = document.querySelector('#czViewer .rp-present'); return v('.rp-tabs') && /Slide 1 of 5 · swipe for the next/.test(document.querySelector('#czViewer .rp-swipe').textContent) && v('.rp-swipe') && !v('.vz-thumbs') && pr && pr.getBoundingClientRect().width > 300; }));
206
+ await tap('[data-r="more"]');
207
+ ok('F2 at 390 px More also holds Edit, Present and Share', await p.evaluate(() => ['edit', 'present', 'share'].every((k) => { const b = document.querySelector('#czViewer .vz-pop .vz-pho [data-r="' + k + '"]'); return b && b.getClientRects().length; })));
208
+ await tap('[data-r="more"]');
259
209
  await shot('reader-deck-390');
260
- ok('F4 the read-only ask of the dialog is hidden; the reader\'s own form is the one it has', await p.evaluate(() => getComputedStyle(document.querySelector('#askF')).display === 'none' && getComputedStyle(document.querySelector('#rdF')).display !== 'none'));
261
- /* S: Issue, in the reader (premium-rows-stay-premium): a press says what it does, then issues on the real route; nothing sends you to the console */
262
- await p.setViewportSize({ width: 1280, height: 900 }); await sleep(300);
263
- ok('S1 the reader links nowhere in the console', await p.evaluate(() => !document.querySelector('#oMain a[href*="console.html"]')));
210
+ await p.setViewportSize({ width: 1280, height: 900 });
211
+
212
+ /* S: Issue: a press says what it checks and does, then issues on the real route */
264
213
  const before = posts.length;
265
- await p.click('#oMain [data-rr="issue"]');
266
- ok('S2 Issue first says what it does and posts nothing', await until(() => p.evaluate(() => /Nothing is sent to anyone/.test((document.querySelector('[data-issue-bar="confirm"]') || {}).textContent || ''))) && posts.length === before);
214
+ await tap('[data-r="issue"]');
215
+ ok('S1 Issue first shows the three checks and says nothing is sent, and posts nothing', await until(() => p.evaluate(() => { const c = document.querySelector('#czViewer .vz-conf'); return c && c.querySelectorAll('li').length === 3 && !/Checking the sources/.test(c.textContent) && /Nothing is sent/.test(c.textContent); }), 10000) && posts.length === before, await p.evaluate(() => (document.querySelector('#czViewer .vz-conf') || {}).textContent));
267
216
  await shot('reader-issue-confirm-1280');
268
- const small2 = await p.evaluate(() => [...document.querySelectorAll('[data-issue-bar] button')].filter((b) => b.offsetHeight < 44).length);
269
- ok('S3 the confirm buttons are at least 44 px tall', small2 === 0);
270
- await p.click('#oMain [data-rr="issueok"]');
271
- ok('S4 Issue it issues the cycle on the report route and the reader says it is frozen', await until(() => p.evaluate(() => /issued/.test(document.querySelector('#dEye').textContent) && !document.querySelector('#oMain [data-rr="issue"]') && /Issued/.test(document.querySelector('#oMain .rdst').textContent)), 15000)
272
- && posts.slice(before).join() === '/api/report/issue', posts.slice(before).join());
217
+ await tap('[data-r="issueok"]');
218
+ ok('S2 Issue it issues the cycle on the report route and the chip says Issued', await until(async () => /Issued · Oct 12/.test(await chipT()) && !(await has('[data-r="issue"]')), 15000) && posts.slice(before).join() === '/api/report/issue', posts.slice(before).join() + ' ' + await p.evaluate(() => document.querySelector('#czViewer .vz-rpb').textContent.slice(0, 300)));
219
+ ok('S3 the issue is recorded in the issues ledger', issues.isIssued(issues.readIssues(dir), CAD, '2026-10-12'));
273
220
  await shot('reader-issued-1280');
274
- ok('S5 the issue is recorded in the issues ledger', issues.isIssued(issues.readIssues(dir), CAD, '2026-10-12'));
275
- /* A: an issued cycle archives from ⋯, after one confirm, and comes back */
221
+
222
+ /* A: an issued cycle archives from More, after one confirm, and comes back */
276
223
  const b2 = posts.length;
277
- await tap('#oMain [data-rr="mo"]'); await tap('#oMain [data-rr="archive"]');
278
- ok('A1 Archive first asks, and posts nothing', await until(() => p.$('[data-ask-bar="archive"]')) && posts.length === b2);
279
- await tap('#oMain [data-rr="askok"]');
280
- ok('A2 Archive it posts the archive route and the chip says Archived', await until(() => p.evaluate(() => /Archived/.test(document.querySelector('#oMain .rdst').textContent)), 8000) && posts.slice(b2).join() === '/api/report-documents/archive', posts.slice(b2).join());
281
- ok('A2b Insights hides the archived cycle: the row counts 1 issued and says nothing of archived (PM 2026-10-22)', await until(() => p.evaluate((r) => { const t = document.querySelector(r).textContent; return /1 issued/.test(t) && !/archived/i.test(t); }, ROW), 8000), await p.textContent(ROW));
282
- await tap('#oMain [data-rr="mo"]'); await tap('#oMain [data-rr="unarchive"]');
283
- ok('A3 Bring back undoes it', await until(() => p.evaluate(() => !/Archived/.test(document.querySelector('#oMain .rdst').textContent)), 8000));
224
+ await tap('[data-r="more"]'); await tap('[data-r="archive"]');
225
+ ok('A1 Archive first asks in the card at the foot (RpStates), and posts nothing', await until(() => p.evaluate(() => /^Archive Oct 12\?/.test((document.querySelector('#czViewer .rp-ask[role="alertdialog"]') || {}).textContent || ''))) && posts.length === b2);
226
+ await shot('reader-archive-ask-1280');
227
+ await tap('[data-r="askok"]');
228
+ ok('A2 Archive posts the archive route and the chip says Archived', await until(async () => /Archived · Oct 12/.test(await chipT()), 8000) && posts.slice(b2).join() === '/api/report-documents/archive', posts.slice(b2).join());
229
+ await tap('[data-r="cycm"]');
230
+ ok('A3 the cycle menu lists it under Archived with Bring back', await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-pop-cyc .vz-lab')].map((b) => b.textContent).join() === 'Issued,Archived' && !!document.querySelector('#czViewer .vz-pop-cyc [data-r^="unarch|"]')));
231
+ await tap('[data-r^="unarch|"]');
232
+ ok('A3 Bring back undoes it', await until(async () => /Issued · Oct 12/.test(await chipT()), 8000));
233
+
234
+ /* Y: Start the next cycle drafts a new cycle of the same report and opens it */
235
+ const b3 = posts.length;
236
+ await tap('[data-r="nextcyc"]');
237
+ /* the scratch repository holds no initiative records, so the drafter refuses: the panel says why and stays on the issued cycle */
238
+ ok('Y1 Start the next cycle posts the report route once; when the drafter refuses, the panel says why', await until(() => p.evaluate(() => /The next cycle was not started: .*initiative records/.test((document.querySelector('#czViewer .vz-msg') || {}).textContent || '')), 15000) && posts.slice(b3).join() === '/api/report/draft' && /Issued · Oct 12/.test(await chipT()), posts.slice(b3).join() + ' ' + await chipT() + ' ' + await p.evaluate(() => (document.querySelector('#czViewer .vz-msg') || {}).textContent || ''));
284
239
  ok('F3 no page error', errs.length === 0, errs.join(' | '));
285
240
  return finish();
286
241
  })().catch((e) => { console.error(e); finish(1); });
@@ -97,20 +97,17 @@ const SHOTS = process.env.PMOS_SHOTS || '';
97
97
  return r.fulfill({ status: 200, contentType: f.kind === 'markdown' ? 'text/markdown' : 'text/plain', headers: { 'X-Doc-Kind': f.kind }, body: f.text });
98
98
  });
99
99
  await page.route('**/api/doc/export*', (r) => r.fulfill({ status: 200, contentType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', headers: { 'Content-Disposition': 'attachment; filename="2026-10-19.docx"' }, body: 'PK' }));
100
- await page.goto(BASE + '/premium.html?theme=' + theme);
101
- await until(() => page.evaluate(() => !!document.querySelector('#dlg')), 15000);
102
- await page.evaluate(async () => {
103
- const S = await import('/pm/premium-shell.js');
104
- S.openDlg({ eye: 'Your item', title: 'Leadership update', say: 'The report is an HTML file in the repo.', noteKey: null, pane: '<article class="paper doc"><p>Item record</p></article>', label: 'Item record' });
105
- });
100
+ // premium-agreed-design: a chat is Home's own (?about= names the conversation) and a file it names opens in the Viewer card
101
+ await page.goto(BASE + '/premium.html?about=work:download-test&theme=' + theme);
102
+ await until(() => page.evaluate(() => !!document.querySelector('#hmLog') && !!document.querySelector('#hmFoot textarea')), 15000);
106
103
  return { ctx, page, errors, asked };
107
104
  };
108
105
  const press = (page, file) => page.evaluate((f) => {
109
106
  const b = document.createElement('button'); b.type = 'button'; b.className = 'fpath'; b.dataset.file = f; b.textContent = f;
110
- document.querySelector('#dBody .stream').append(b); b.click();
107
+ document.querySelector('#hmLog').append(b); b.click();
111
108
  }, file);
112
- const ICON = '#dOut .obody.vw:not([hidden]) [data-fdl]';
113
- const menu = (page) => page.evaluate(() => [...document.querySelectorAll('#dOut .obody.vw:not([hidden]) .vwdlm [data-fmt]')].map((b) => b.dataset.fmt + ':' + b.querySelector('span').textContent).join());
109
+ const ICON = '#czViewer:not([hidden]) .obody.vw [data-fdl]';
110
+ const menu = (page) => page.evaluate(() => [...document.querySelectorAll('#czViewer:not([hidden]) .obody.vw .vwdlm [data-fmt]')].map((b) => b.dataset.fmt + ':' + b.querySelector('span').textContent).join());
114
111
 
115
112
  {
116
113
  const { page, errors, asked, ctx } = await open();
@@ -122,43 +119,43 @@ const SHOTS = process.env.PMOS_SHOTS || '';
122
119
  const m1 = await until(() => menu(page), 3000);
123
120
  ok('W4 the icon opens a menu: HTML, then PDF', m1 === 'orig:HTML,pdf:PDF', m1);
124
121
  ok('W4 the menu takes focus on its first choice', await page.evaluate(() => document.activeElement && document.activeElement.dataset.fmt === 'orig'));
125
- const [dl] = await Promise.all([page.waitForEvent('download', { timeout: 5000 }).catch(() => null), page.click('#dOut .vwdlm [data-fmt="orig"]')]);
122
+ const [dl] = await Promise.all([page.waitForEvent('download', { timeout: 5000 }).catch(() => null), page.click('#czViewer .vwdlm [data-fmt="orig"]')]);
126
123
  const body = dl ? fs.readFileSync(await dl.path(), 'utf8') : '';
127
124
  ok('W4 HTML saves the file\'s own text under its own name', dl && dl.suggestedFilename() === '2026-10-19-leadership.html' && body === FILES[HTMLF].text, dl ? dl.suggestedFilename() + ' ' + body.slice(0, 60) : 'no download');
128
- ok('W4 the menu closes after a choice', !(await page.$('#dOut .vwdlm')));
125
+ ok('W4 the menu closes after a choice', !(await page.$('#czViewer .vwdlm')));
129
126
  await page.click(ICON);
130
127
  await until(() => menu(page), 3000);
131
- await page.click('#dOut .vwdlm [data-fmt="pdf"]');
128
+ await page.click('#czViewer .vwdlm [data-fmt="pdf"]');
132
129
  const pf = await until(() => page.evaluate(() => { const f = document.querySelector('iframe.vwprint'); return f ? { sb: f.getAttribute('sandbox'), src: f.srcdoc } : null; }), 3000);
133
130
  ok('W4 PDF prints in a frame sandboxed to scripts and modals, never same-origin', pf && pf.sb === 'allow-scripts allow-modals' && /print\(\)/.test(pf.src) && /Leadership update/.test(pf.src) && /default-src 'none'/.test(pf.src), JSON.stringify(pf && { sb: pf.sb }));
134
131
  await page.click(ICON);
135
132
  await until(() => menu(page), 3000);
136
133
  await page.keyboard.press('Escape');
137
- const esc = await page.evaluate((s) => ({ gone: !document.querySelector('#dOut .vwdlm'), focus: document.activeElement === document.querySelector(s), dlg: !!document.querySelector('#dlg[open], #dlg.on, #dlg:not([hidden])') }), ICON);
138
- ok('W4 Escape closes the menu and gives the icon focus back, the dialog stays', esc.gone && esc.focus && esc.dlg, JSON.stringify(esc));
134
+ const esc = await page.evaluate((s) => ({ gone: !document.querySelector('#czViewer .vwdlm'), focus: document.activeElement === document.querySelector(s), dlg: !!document.querySelector('#czViewer:not([hidden]) .obody.vw') }), ICON); // the Viewer card stays open
135
+ ok('W4 Escape closes the menu and gives the icon focus back, the Viewer stays', esc.gone && esc.focus && esc.dlg, JSON.stringify(esc));
139
136
  await page.click(ICON);
140
137
  await until(() => menu(page), 3000);
141
- await page.click('#dOut .obody.vw:not([hidden]) .cft');
142
- ok('W4 a press elsewhere closes the menu', !!(await until(() => page.evaluate(() => !document.querySelector('#dOut .vwdlm')), 2000)));
138
+ await page.click('#czViewer:not([hidden]) .obody.vw .cft');
139
+ ok('W4 a press elsewhere closes the menu', !!(await until(() => page.evaluate(() => !document.querySelector('#czViewer .vwdlm')), 2000)));
143
140
 
144
141
  await press(page, MDF);
145
- await until(() => page.evaluate(() => { const p = document.querySelector('#dOut .obody.vw:not([hidden]) .cfb'); return p && p.querySelector('strong'); }), 6000);
142
+ await until(() => page.evaluate(() => { const p = document.querySelector('#czViewer:not([hidden]) .obody.vw .cfb'); return p && p.querySelector('strong'); }), 6000);
146
143
  await page.click(ICON);
147
144
  const m2 = await until(() => menu(page), 3000);
148
145
  ok('W5 a markdown file\'s menu is Markdown, Word .docx, PDF', m2 === 'orig:Markdown,docx:Word .docx,pdf:PDF', m2);
149
- const [dw] = await Promise.all([page.waitForEvent('download', { timeout: 5000 }).catch(() => null), page.click('#dOut .vwdlm [data-fmt="docx"]')]);
146
+ const [dw] = await Promise.all([page.waitForEvent('download', { timeout: 5000 }).catch(() => null), page.click('#czViewer .vwdlm [data-fmt="docx"]')]);
150
147
  if (dw) asked.push(dw.url());
151
148
  const q = asked[0] ? new URL(asked[0], BASE).searchParams : null;
152
149
  ok('W5 Word asks the export route for that file and saves <name>.docx', dw && dw.suggestedFilename() === '2026-10-19.docx' && q && q.get('ws') === 'w0' && q.get('path') === MDF && q.get('fmt') === 'docx', (dw ? dw.suggestedFilename() : 'no download') + ' ' + asked.join());
153
150
  await page.click(ICON);
154
151
  await until(() => menu(page), 3000);
155
- const [dm] = await Promise.all([page.waitForEvent('download', { timeout: 5000 }).catch(() => null), page.click('#dOut .vwdlm [data-fmt="orig"]')]);
152
+ const [dm] = await Promise.all([page.waitForEvent('download', { timeout: 5000 }).catch(() => null), page.click('#czViewer .vwdlm [data-fmt="orig"]')]);
156
153
  ok('W5 Markdown saves the note\'s own text', dm && dm.suggestedFilename() === '2026-10-19.md' && fs.readFileSync(await dm.path(), 'utf8') === FILES[MDF].text, dm ? dm.suggestedFilename() : 'no download');
157
154
 
158
155
  await press(page, JSF);
159
- await until(() => page.evaluate(() => { const p = document.querySelector('#dOut .obody.vw:not([hidden]) .cb'); return p && p.dataset.lang === 'js'; }), 6000);
156
+ await until(() => page.evaluate(() => { const p = document.querySelector('#czViewer:not([hidden]) .obody.vw .cb'); return p && p.dataset.lang === 'js'; }), 6000);
160
157
  const [dj] = await Promise.all([page.waitForEvent('download', { timeout: 5000 }).catch(() => null), page.click(ICON)]);
161
- ok('W6 a .js file saves at once, with no menu', dj && dj.suggestedFilename() === 'a.js' && !(await page.$('#dOut .vwdlm')) && !(await page.$eval(ICON, (b) => b.hasAttribute('aria-haspopup'))), dj ? dj.suggestedFilename() : 'no download');
158
+ ok('W6 a .js file saves at once, with no menu', dj && dj.suggestedFilename() === 'a.js' && !(await page.$('#czViewer .vwdlm')) && !(await page.$eval(ICON, (b) => b.hasAttribute('aria-haspopup'))), dj ? dj.suggestedFilename() : 'no download');
162
159
  ok('W4 no page errors', errors.length === 0, errors.join(' | '));
163
160
  await ctx.close();
164
161
  }
@@ -170,7 +167,7 @@ const SHOTS = process.env.PMOS_SHOTS || '';
170
167
  await sleep(300);
171
168
  await page.click(ICON);
172
169
  await until(() => menu(page), 3000);
173
- const geo = await page.evaluate((s) => { const b = document.querySelector(s).getBoundingClientRect(), m = document.querySelector('#dOut .vwdlm').getBoundingClientRect(); return { bw: Math.round(b.width), bh: Math.round(b.height), mr: Math.round(m.right), ml: Math.round(m.left), mw: Math.round(m.width), vw: innerWidth, sx: document.documentElement.scrollWidth - innerWidth }; }, ICON);
170
+ const geo = await page.evaluate((s) => { const b = document.querySelector(s).getBoundingClientRect(), m = document.querySelector('#czViewer .vwdlm').getBoundingClientRect(); return { bw: Math.round(b.width), bh: Math.round(b.height), mr: Math.round(m.right), ml: Math.round(m.left), mw: Math.round(m.width), vw: innerWidth, sx: document.documentElement.scrollWidth - innerWidth }; }, ICON);
174
171
  ok(`W7 at ${w} ${theme} the icon is a ${w < 700 ? 44 : 36} px target and the menu fits on screen`, geo.bw >= (w < 700 ? 44 : 36) && geo.bh >= (w < 700 ? 44 : 36) && geo.ml >= 0 && geo.mr <= geo.vw && geo.mw >= 160 && geo.sx <= 0, JSON.stringify(geo));
175
172
  if (SHOTS) { fs.mkdirSync(SHOTS, { recursive: true }); await sleep(200); await page.screenshot({ path: path.join(SHOTS, `menu-${w}-${theme}.png`) }); }
176
173
  await ctx.close();