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.
- package/package.json +13 -13
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +101 -52
- package/workspace/briefing-premium-board-test.js +252 -128
- package/workspace/briefing-premium-calendar-2-test.js +135 -198
- package/workspace/briefing-premium-calendar-3-test.js +143 -418
- package/workspace/briefing-premium-calendar-test.js +86 -196
- package/workspace/briefing-premium-doc-edit-test.js +95 -83
- package/workspace/briefing-premium-initiative-test.js +159 -296
- package/workspace/briefing-premium-insights-test.js +337 -219
- package/workspace/briefing-premium-metrics-test.js +53 -97
- package/workspace/briefing-premium-products-test.js +40 -27
- package/workspace/briefing-premium-sources-test.js +66 -48
- package/workspace/briefing-premium-test.js +150 -647
- package/workspace/briefing-premium-work-test.js +88 -283
- package/workspace/changelog.json +12 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +47 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-premium.js +85 -19
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +62 -14
- package/workspace/lib/insights-records.js +101 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-insights-premium.js +12 -3
- package/workspace/lib/routes-insights-records.js +129 -0
- package/workspace/lib/routes-notes.js +1 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/transcript-steps.js +123 -0
- package/workspace/lib/viewer-meeting.js +205 -0
- package/workspace/lib/viewer-report.js +89 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +85 -75
- package/workspace/premium-briefing-depth-test.js +66 -53
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +35 -37
- package/workspace/premium-chat-context-test.js +19 -18
- package/workspace/premium-chat-goal-view-test.js +23 -23
- package/workspace/premium-chat-notes-test.js +26 -31
- package/workspace/premium-chat-report-tab-test.js +32 -28
- package/workspace/premium-chat-term-test.js +16 -16
- package/workspace/premium-chat-viewer-test.js +60 -59
- package/workspace/premium-core-doc-issue-test.js +50 -43
- package/workspace/premium-html-viewer-test.js +14 -17
- package/workspace/premium-phone-card-test.js +7 -2
- package/workspace/premium-phone-room-test.js +41 -35
- package/workspace/premium-report-read-test.js +115 -197
- package/workspace/premium-viewer-download-test.js +19 -22
- package/workspace/premium-viewer-flicker-test.js +11 -16
- package/workspace/premium-viewer-share-test.js +6 -9
- package/workspace/premium-viewer-test.js +41 -60
- package/workspace/premium-vw-backlog-test.js +53 -33
- package/workspace/premium-vw-cal-test.js +82 -128
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +11 -10
- package/workspace/premium-vw-item-test.js +50 -49
- package/workspace/premium-vw-jira-test.js +53 -27
- package/workspace/premium-vw-meet-test.js +118 -187
- package/workspace/premium-vw-notes-test.js +85 -108
- package/workspace/premium-vw-rec-test.js +72 -194
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +61 -53
- package/workspace/public/pm/bd-acts.js +305 -0
- package/workspace/public/pm/bd-span.js +186 -82
- package/workspace/public/pm/bd-stages.js +25 -11
- package/workspace/public/pm/c3-doc-sheet.js +1 -1
- package/workspace/public/pm/c3-md.js +3 -395
- package/workspace/public/pm/c3-phone-detail.js +1 -1
- package/workspace/public/pm/c3-phone-model.js +3 -68
- package/workspace/public/pm/chat-term.js +3 -3
- package/workspace/public/pm/cozy-board.css +497 -230
- package/workspace/public/pm/cozy-home.css +570 -142
- package/workspace/public/pm/cozy-home.js +5 -3
- package/workspace/public/pm/cozy-insights.css +296 -167
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +17 -6
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-viewer.css +3 -3
- package/workspace/public/pm/cozy-viewer.js +144 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +83 -1
- package/workspace/public/pm/home-adddoc.js +48 -0
- package/workspace/public/pm/home-app.js +905 -0
- package/workspace/public/pm/home-around.js +515 -0
- package/workspace/public/pm/home-chat.js +459 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-more.js +249 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-work.js +519 -0
- package/workspace/public/pm/phone-moment.js +69 -0
- package/workspace/public/pm/pm-work-view.js +1 -1
- package/workspace/public/pm/premium-attach.js +4 -0
- package/workspace/public/pm/premium-board.js +423 -394
- package/workspace/public/pm/premium-chart-tab.js +110 -62
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +25 -21
- package/workspace/public/pm/premium-insights.js +792 -568
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-notes.js +1 -1
- package/workspace/public/pm/premium-report-frame.css +20 -0
- package/workspace/public/pm/premium-report-read.js +509 -480
- package/workspace/public/pm/premium-report-tab.js +87 -63
- package/workspace/public/pm/premium-shell.js +72 -119
- package/workspace/public/pm/premium-viewer.js +22 -1
- package/workspace/public/pm/premium-vw-cal.js +187 -48
- package/workspace/public/pm/premium-vw-doc.css +6 -0
- package/workspace/public/pm/premium-vw-doc.js +40 -2
- package/workspace/public/pm/premium-vw-file.js +2 -2
- package/workspace/public/pm/premium-vw-meet.js +6 -83
- package/workspace/public/pm/premium-vw-mtg.js +731 -0
- package/workspace/public/pm/premium-vw-notes.js +56 -69
- package/workspace/public/pm/premium-vw-open.js +35 -0
- package/workspace/public/pm/premium-vw-page.js +16 -0
- package/workspace/public/pm/premium-vw-rec.js +11 -218
- package/workspace/public/pm/premium-vw-slides.css +5 -0
- package/workspace/public/pm/premium-vw-slides.js +44 -8
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +28 -70
- package/workspace/public/premium-initiative.html +8 -48
- package/workspace/public/premium-insights.html +22 -60
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium.html +16 -107
- package/workspace/server.js +18 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/public/pm/premium-work.js +0 -729
- 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
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* O opening · C the cycles · D the deck · G the page · N Present · W download · X print · E edit ·
|
|
7
|
-
* P the
|
|
8
|
-
*
|
|
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'
|
|
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
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
await
|
|
110
|
-
|
|
111
|
-
ok('
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
await p.
|
|
120
|
-
|
|
121
|
-
|
|
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
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
await p.
|
|
131
|
-
|
|
132
|
-
await
|
|
133
|
-
|
|
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('
|
|
138
|
-
const heads = await p.evaluate(() => [...document.querySelectorAll('.
|
|
139
|
-
ok('G1
|
|
140
|
-
await tap('
|
|
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('
|
|
144
|
-
|
|
145
|
-
await
|
|
146
|
-
ok('
|
|
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('#
|
|
153
|
-
await p.keyboard.press('Escape');
|
|
154
|
-
ok('N3 Escape stops presenting and the
|
|
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('
|
|
158
|
-
const items = await p.evaluate(() => [...document.querySelectorAll('.
|
|
159
|
-
ok('
|
|
160
|
-
ok('W1
|
|
161
|
-
const [dl] = await Promise.all([p.waitForEvent('download'), p.click('
|
|
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
|
|
164
|
-
await
|
|
165
|
-
|
|
166
|
-
|
|
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('
|
|
171
|
-
const pr = await p.evaluate(() => ({ h: window.__pr || ''
|
|
172
|
-
ok('X1 Print opens the print page with one slide to a page', pr
|
|
173
|
-
|
|
174
|
-
/* E: Edit edits in place
|
|
175
|
-
await tap('
|
|
176
|
-
await tap('
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
ok('
|
|
181
|
-
await
|
|
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(
|
|
239
|
-
await
|
|
240
|
-
await
|
|
241
|
-
|
|
242
|
-
ok('
|
|
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
|
-
|
|
248
|
-
ok('
|
|
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
|
|
254
|
-
await
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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
|
|
266
|
-
ok('
|
|
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
|
-
|
|
269
|
-
ok('
|
|
270
|
-
|
|
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
|
-
|
|
275
|
-
/* A: an issued cycle archives from
|
|
193
|
+
|
|
194
|
+
/* A: an issued cycle archives from More, after one confirm, and comes back */
|
|
276
195
|
const b2 = posts.length;
|
|
277
|
-
await tap('
|
|
278
|
-
ok('A1 Archive first asks, and posts nothing', await until(() =>
|
|
279
|
-
await tap('
|
|
280
|
-
ok('A2 Archive
|
|
281
|
-
|
|
282
|
-
await
|
|
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
|
-
|
|
101
|
-
await
|
|
102
|
-
await page.evaluate(
|
|
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('#
|
|
107
|
+
document.querySelector('#hmLog').append(b); b.click();
|
|
111
108
|
}, file);
|
|
112
|
-
const ICON = '#
|
|
113
|
-
const menu = (page) => page.evaluate(() => [...document.querySelectorAll('#
|
|
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('#
|
|
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.$('#
|
|
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('#
|
|
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('#
|
|
138
|
-
ok('W4 Escape closes the menu and gives the icon focus back, the
|
|
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('#
|
|
142
|
-
ok('W4 a press elsewhere closes the menu', !!(await until(() => page.evaluate(() => !document.querySelector('#
|
|
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('#
|
|
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('#
|
|
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('#
|
|
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('#
|
|
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.$('#
|
|
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('#
|
|
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();
|