create-pmos 0.397.0 → 0.398.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +101 -52
  8. package/workspace/briefing-premium-board-test.js +252 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +86 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  13. package/workspace/briefing-premium-initiative-test.js +159 -296
  14. package/workspace/briefing-premium-insights-test.js +337 -219
  15. package/workspace/briefing-premium-metrics-test.js +53 -97
  16. package/workspace/briefing-premium-products-test.js +40 -27
  17. package/workspace/briefing-premium-sources-test.js +66 -48
  18. package/workspace/briefing-premium-test.js +150 -647
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +12 -0
  21. package/workspace/fixtures/board-premium-trail.js +32 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  23. package/workspace/guide/briefing-premium.md +3 -1
  24. package/workspace/guide/home.md +47 -0
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/lib/agent-roles.js +71 -0
  27. package/workspace/lib/board-premium.js +85 -19
  28. package/workspace/lib/board-trail.js +223 -0
  29. package/workspace/lib/home-work-item.js +58 -0
  30. package/workspace/lib/insights-goals.js +196 -0
  31. package/workspace/lib/insights-premium.js +62 -14
  32. package/workspace/lib/insights-records.js +101 -0
  33. package/workspace/lib/jira-tickets.js +1 -1
  34. package/workspace/lib/route-modules.js +4 -0
  35. package/workspace/lib/routes-board-trail.js +33 -0
  36. package/workspace/lib/routes-home-desk.js +176 -0
  37. package/workspace/lib/routes-insights-premium.js +12 -3
  38. package/workspace/lib/routes-insights-records.js +129 -0
  39. package/workspace/lib/routes-notes.js +1 -0
  40. package/workspace/lib/routes-viewer.js +108 -0
  41. package/workspace/lib/transcript-steps.js +123 -0
  42. package/workspace/lib/viewer-meeting.js +205 -0
  43. package/workspace/lib/viewer-report.js +89 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/premium-board-actions-test.js +85 -75
  47. package/workspace/premium-briefing-depth-test.js +66 -53
  48. package/workspace/premium-chat-attach-test.js +54 -63
  49. package/workspace/premium-chat-chart-tab-test.js +35 -37
  50. package/workspace/premium-chat-context-test.js +19 -18
  51. package/workspace/premium-chat-goal-view-test.js +23 -23
  52. package/workspace/premium-chat-notes-test.js +26 -31
  53. package/workspace/premium-chat-report-tab-test.js +32 -28
  54. package/workspace/premium-chat-term-test.js +16 -16
  55. package/workspace/premium-chat-viewer-test.js +60 -59
  56. package/workspace/premium-core-doc-issue-test.js +50 -43
  57. package/workspace/premium-html-viewer-test.js +14 -17
  58. package/workspace/premium-phone-card-test.js +7 -2
  59. package/workspace/premium-phone-room-test.js +41 -35
  60. package/workspace/premium-report-read-test.js +115 -197
  61. package/workspace/premium-viewer-download-test.js +19 -22
  62. package/workspace/premium-viewer-flicker-test.js +11 -16
  63. package/workspace/premium-viewer-share-test.js +6 -9
  64. package/workspace/premium-viewer-test.js +41 -60
  65. package/workspace/premium-vw-backlog-test.js +53 -33
  66. package/workspace/premium-vw-cal-test.js +82 -128
  67. package/workspace/premium-vw-copy-test.js +17 -33
  68. package/workspace/premium-vw-doc-test.js +11 -10
  69. package/workspace/premium-vw-item-test.js +50 -49
  70. package/workspace/premium-vw-jira-test.js +53 -27
  71. package/workspace/premium-vw-meet-test.js +118 -187
  72. package/workspace/premium-vw-notes-test.js +85 -108
  73. package/workspace/premium-vw-rec-test.js +72 -194
  74. package/workspace/premium-vw-slides-test.js +46 -50
  75. package/workspace/premium-welcome-test.js +3 -2
  76. package/workspace/premium-work-depth-test.js +61 -53
  77. package/workspace/public/pm/bd-acts.js +305 -0
  78. package/workspace/public/pm/bd-span.js +186 -82
  79. package/workspace/public/pm/bd-stages.js +25 -11
  80. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  81. package/workspace/public/pm/c3-md.js +3 -395
  82. package/workspace/public/pm/c3-phone-detail.js +1 -1
  83. package/workspace/public/pm/c3-phone-model.js +3 -68
  84. package/workspace/public/pm/chat-term.js +3 -3
  85. package/workspace/public/pm/cozy-board.css +497 -230
  86. package/workspace/public/pm/cozy-home.css +570 -142
  87. package/workspace/public/pm/cozy-home.js +5 -3
  88. package/workspace/public/pm/cozy-insights.css +296 -167
  89. package/workspace/public/pm/cozy-md.js +396 -0
  90. package/workspace/public/pm/cozy-nav.js +17 -6
  91. package/workspace/public/pm/cozy-placeholder.js +26 -0
  92. package/workspace/public/pm/cozy-viewer.css +3 -3
  93. package/workspace/public/pm/cozy-viewer.js +144 -0
  94. package/workspace/public/pm/cozy-vw.css +485 -0
  95. package/workspace/public/pm/cozy.css +83 -1
  96. package/workspace/public/pm/home-adddoc.js +48 -0
  97. package/workspace/public/pm/home-app.js +905 -0
  98. package/workspace/public/pm/home-around.js +515 -0
  99. package/workspace/public/pm/home-chat.js +459 -0
  100. package/workspace/public/pm/home-data.js +312 -0
  101. package/workspace/public/pm/home-draft.js +68 -0
  102. package/workspace/public/pm/home-more.js +249 -0
  103. package/workspace/public/pm/home-phone-card.js +109 -0
  104. package/workspace/public/pm/home-work.js +519 -0
  105. package/workspace/public/pm/phone-moment.js +69 -0
  106. package/workspace/public/pm/pm-work-view.js +1 -1
  107. package/workspace/public/pm/premium-attach.js +4 -0
  108. package/workspace/public/pm/premium-board.js +423 -394
  109. package/workspace/public/pm/premium-chart-tab.js +110 -62
  110. package/workspace/public/pm/premium-deck.js +3 -3
  111. package/workspace/public/pm/premium-first.js +25 -21
  112. package/workspace/public/pm/premium-insights.js +792 -568
  113. package/workspace/public/pm/premium-meeting.js +61 -549
  114. package/workspace/public/pm/premium-notes.js +1 -1
  115. package/workspace/public/pm/premium-report-frame.css +20 -0
  116. package/workspace/public/pm/premium-report-read.js +509 -480
  117. package/workspace/public/pm/premium-report-tab.js +87 -63
  118. package/workspace/public/pm/premium-shell.js +72 -119
  119. package/workspace/public/pm/premium-viewer.js +22 -1
  120. package/workspace/public/pm/premium-vw-cal.js +187 -48
  121. package/workspace/public/pm/premium-vw-doc.css +6 -0
  122. package/workspace/public/pm/premium-vw-doc.js +40 -2
  123. package/workspace/public/pm/premium-vw-file.js +2 -2
  124. package/workspace/public/pm/premium-vw-meet.js +6 -83
  125. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  126. package/workspace/public/pm/premium-vw-notes.js +56 -69
  127. package/workspace/public/pm/premium-vw-open.js +35 -0
  128. package/workspace/public/pm/premium-vw-page.js +16 -0
  129. package/workspace/public/pm/premium-vw-rec.js +11 -218
  130. package/workspace/public/pm/premium-vw-slides.css +5 -0
  131. package/workspace/public/pm/premium-vw-slides.js +44 -8
  132. package/workspace/public/pm/term-view.js +22 -0
  133. package/workspace/public/premium-board.html +28 -70
  134. package/workspace/public/premium-initiative.html +8 -48
  135. package/workspace/public/premium-insights.html +22 -60
  136. package/workspace/public/premium-viewer.html +20 -0
  137. package/workspace/public/premium.html +16 -107
  138. package/workspace/server.js +18 -3
  139. package/workspace/test-files.json +1 -0
  140. package/workspace/test-lists/home-libs.json +9 -0
  141. package/workspace/test-lists/premium-report-read.json +1 -1
  142. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  143. package/workspace/test-lists/premium-vw-notes.json +1 -1
  144. package/workspace/public/pm/premium-work.js +0 -729
  145. package/workspace/public/pm/premium.js +0 -1146
@@ -1,11 +1,12 @@
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
8
- * Set READ_SHOTS=<dir> to save screenshots at 1280 and 390 wide. */
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
+ * The look conversation (samples, design versions, Use it) has no design in the Agreed mockup: the panel has no conversation, and the Brief
9
+ * is a "Waiting for design" placeholder (K1). Set READ_SHOTS=<dir> to save screenshots at 1280 and 390 wide. */
9
10
  const fs = require('fs');
10
11
  const os = require('os');
11
12
  const path = require('path');
@@ -50,33 +51,6 @@ fs.writeFileSync(path.join(dir, pNew), DOC); fs.writeFileSync(path.join(dir, pOl
50
51
  const git = (...a) => execFileSync('git', a, { cwd: dir, stdio: 'ignore' });
51
52
  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
53
  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
54
  (async () => {
81
55
  ok('setup: the older cycle is issued', iss && iss.ok === true, JSON.stringify(iss));
82
56
  const exe = findBrowser();
@@ -90,197 +64,141 @@ fs.writeFileSync(path.join(base, 'brand.png'), PNG);
90
64
 
91
65
  const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 }, acceptDownloads: true }), p = await ctx.newPage(), errs = [], posts = [];
92
66
  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.
67
+ 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
68
  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)
69
+ const V = '#czViewer ';
70
+ const tap = (sel) => p.$eval(V + sel, (b) => b.click());
71
+ const has = (sel) => p.$(V + sel).then((x) => !!x);
72
+ const counter = () => p.evaluate(() => (document.querySelector('#czViewer .vz-snav [aria-live]') || {}).textContent || '');
73
+ const bigTitle = () => p.evaluate(() => { const h = document.querySelector('#czViewer .vz-slide h4'); return h ? h.textContent : (document.querySelector('#czViewer .vz-slide iframe') ? 'frame' : ''); });
74
+ const chipT = () => p.evaluate(() => (document.querySelector('#czViewer [data-r="cycm"]') || {}).textContent || '');
75
+ 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());
76
+ const ready = () => until(() => p.evaluate(() => !!document.querySelector('#czViewer .vz-rp0 .vz-slide, #czViewer .vz-rp0 .vz-page')));
77
+ const openAt = async (rel) => { await p.goto(BASE + '/premium-viewer.html?open=report&path=' + encodeURIComponent(rel)); return ready(); };
78
+
79
+ /* O: the cycle opens in the Viewer card */
80
+ ok('O1 /premium-viewer.html?open=report opens the cycle in the Viewer card', await openAt(pNew));
81
+ ok('O2 the card has no conversation, no tabs and no old reader', await p.evaluate(() => !document.querySelector('#dlg, .stream, #vTabs, #rdSlide, #rdIn')));
82
+ 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());
83
+ await until(() => has('[data-r="sched"]'));
84
+ ok('B1 the chips are the cycle, the schedule and Brief', await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-rpc > button')].map((b) => b.dataset.r).join()) === 'cycm,sched,brief');
85
+ ok('B1 one toolbar: Slides | Page, Edit, Present, Share, Issue and More', await tools() === 'view|deck,view|doc,edit,present,share,issue,more', await tools());
86
+ 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 }; });
87
+ 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
88
  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"]');
89
+
90
+ /* C: the cycle chip lists this report's cycles */
91
+ await tap('[data-r="cycm"]');
92
+ const cm = await p.evaluate(() => [...document.querySelectorAll('#czViewer [data-r^="cyc|"]')].map((b) => b.textContent));
93
+ ok('C1 the cycle menu lists the two cycles, newest first, with their state, marked Waiting for design', cm.join('|') === 'Oct 12Draft|Oct 5Issued' && await has('[data-cz-placeholder="Cycle menu"]'), JSON.stringify(cm));
94
+ await tap('[data-r="cycm"]');
123
95
 
124
96
  /* 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));
97
+ 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());
98
+ 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));
99
+ const strip = await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-th')].map((b) => b.getAttribute('aria-label')));
100
+ 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());
101
+ await tap('[data-r="next"]');
102
+ 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%'));
103
+ await p.focus(V + '.vz-slide'); await p.keyboard.press('ArrowRight');
104
+ 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));
105
+ await tap('[data-r="go|4"]');
106
+ 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
107
  await shot('reader-deck-1280');
135
108
 
136
109
  /* 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"]');
110
+ await tap('[data-r="view|doc"]');
111
+ const heads = await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-page h4')].map((h) => h.textContent));
112
+ ok('G1 Page shows the headings as written', heads.join() === 'Headline,Initiatives,Needs your call,Sources' && await p.evaluate(() => document.querySelector('#czViewer .vz-page h2').textContent) === 'Partner review, 12 Oct', heads.join());
113
+ await tap('[data-r="view|deck"]');
114
+
115
+ /* B2 the schedule; K the Brief */
116
+ await tap('[data-r="sched"]');
117
+ 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')));
118
+ await tap('[data-r="pop|"]');
119
+ await tap('[data-r="brief"]');
120
+ ok('K1 Brief shows the report brief, marked Waiting for design (the look conversation has no design yet)', await until(() => has('[data-cz-placeholder="Report brief"]')));
121
+ await tap('[data-r="brief"]');
141
122
 
142
123
  /* 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'); }));
124
+ await tap('[data-r="go|0"]');
125
+ await tap('[data-r="present"]');
126
+ await until(() => p.$('#vzPres'));
127
+ ok('N1 Present shows the current slide over the whole page, marked Waiting for design', 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.querySelector('[data-cz-placeholder="Present"]'); }));
151
128
  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');
129
+ ok('N2 the arrow keys move while presenting', await until(() => p.evaluate(() => /^2 of 5$/.test(document.querySelector('#vzPres .vz-snav span').textContent))));
130
+ await p.keyboard.press('Escape');
131
+ 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
132
 
156
133
  /* 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"]')]);
134
+ await tap('[data-r="more"]');
135
+ const items = await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-fmts .vz-fmt')].map((a) => a.textContent + '|' + (a.getAttribute('href') || '')));
136
+ 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(' / '));
137
+ 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)));
138
+ const [dl] = await Promise.all([p.waitForEvent('download'), p.click(V + '[data-r="dl|pptx"]')]);
162
139
  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());
140
+ ok('W2 PPTX downloads a .pptx of the document', /\.pptx$/.test(dl.suggestedFilename()) && pptx.slice(0, 2).toString() === 'PK', dl.suggestedFilename());
141
+ await until(() => p.evaluate(() => !document.querySelector('#czViewer .vz-pop')));
142
+ await tap('[data-r="more"]');
143
+ const [md] = await Promise.all([p.waitForEvent('download'), p.click(V + '[data-r="md"]')]);
144
+ ok('W3 MD downloads the file as written', fs.readFileSync(await md.path(), 'utf8') === DOC && /\.md$/.test(md.suggestedFilename()), md.suggestedFilename());
167
145
 
168
146
  /* X: print */
169
147
  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);
148
+ await tap('[data-r="more"]'); await tap('[data-r="print"]');
149
+ const pr = await until(() => p.evaluate(() => (window.__printed ? { h: window.__pr || '' } : null)));
150
+ 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');
151
+
152
+ /* E: Edit edits in place: on Page the page editor, inside the card; Cancel brings the report back */
153
+ await tap('[data-r="view|doc"]');
154
+ await tap('[data-r="edit"]');
155
+ 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));
156
+ 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());
157
+ await tap('[data-r="edcancel"]');
158
+ ok('E3 Cancel brings the report back', await until(() => p.evaluate(() => !!document.querySelector('#czViewer .vz-page') && !document.querySelector('#czViewer [data-vz-ed]'))));
159
+ await tap('[data-r="view|deck"]');
236
160
 
237
161
  /* 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);
162
+ await tap('[data-r="cycm"]');
163
+ await tap(`[data-r="cyc|${pOld}"]`);
164
+ await until(async () => /Issued · Oct 5/.test(await chipT()) && !!(await p.$(V + '.vz-slide')));
165
+ ok('I1 the cycle menu opens the issued cycle: no Edit and no Issue, marked Waiting for design', !(await has('[data-r="edit"]')) && !(await has('[data-r="issue"]')) && await has('[data-cz-placeholder="Issued state"]'), await chipT());
166
+ ok('I2 an issued cycle still reads as a deck', await counter() === '1 of 3', await counter());
245
167
 
246
168
  /* 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);
169
+ ok('P1 reading, presenting, downloading, printing and editing without saving post nothing', posts.length === 0, posts.join());
170
+ ok('P2 the document file is unchanged', fs.readFileSync(path.join(dir, pNew), 'utf8') === DOC);
251
171
 
252
172
  /* 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));
173
+ await openAt(pNew);
174
+ await p.setViewportSize({ width: 390, height: 844 });
175
+ await until(() => p.evaluate(() => !document.querySelectorAll('#czViewer .vz-tb .vz-dko')[0].getClientRects().length));
176
+ 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() }));
177
+ 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));
178
+ await tap('[data-r="more"]');
179
+ ok('F2 at 390 px More also holds Edit, Present, Share and Brief', await p.evaluate(() => ['edit', 'present', 'share', 'brief'].every((k) => { const b = document.querySelector('#czViewer .vz-pop .vz-pho [data-r="' + k + '"]'); return b && b.getClientRects().length; })));
180
+ await tap('[data-r="more"]');
259
181
  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"]')));
182
+ await p.setViewportSize({ width: 1280, height: 900 });
183
+
184
+ /* S: Issue: a press says what it checks and does, then issues on the real route */
264
185
  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);
186
+ await tap('[data-r="issue"]');
187
+ 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
188
  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());
189
+ await tap('[data-r="issueok"]');
190
+ 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)));
191
+ ok('S3 the issue is recorded in the issues ledger', issues.isIssued(issues.readIssues(dir), CAD, '2026-10-12'));
273
192
  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 */
193
+
194
+ /* A: an issued cycle archives from More, after one confirm, and comes back */
276
195
  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));
196
+ await tap('[data-r="more"]'); await tap('[data-r="archive"]');
197
+ ok('A1 Archive first asks, marked Waiting for design, and posts nothing', await until(() => has('[data-cz-placeholder="Archive confirm"]')) && posts.length === b2);
198
+ await tap('[data-r="askok"]');
199
+ 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());
200
+ await tap('[data-r="more"]'); await tap('[data-r="unarchive"]');
201
+ ok('A3 Bring back undoes it', await until(async () => /Issued · Oct 12/.test(await chipT()), 8000));
284
202
  ok('F3 no page error', errs.length === 0, errs.join(' | '));
285
203
  return finish();
286
204
  })().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();