create-pmos 0.396.0 → 0.398.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- 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/scripts/nine-stages.js +49 -20
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +103 -74
- package/workspace/briefing-premium-board-test.js +316 -154
- package/workspace/briefing-premium-calendar-2-test.js +135 -195
- package/workspace/briefing-premium-calendar-3-test.js +143 -413
- package/workspace/briefing-premium-calendar-test.js +86 -185
- package/workspace/briefing-premium-doc-edit-test.js +95 -83
- package/workspace/briefing-premium-initiative-test.js +166 -294
- package/workspace/briefing-premium-insights-test.js +351 -214
- package/workspace/briefing-premium-metrics-test.js +53 -118
- package/workspace/briefing-premium-products-test.js +40 -27
- package/workspace/briefing-premium-sources-test.js +91 -52
- package/workspace/briefing-premium-test.js +150 -633
- package/workspace/briefing-premium-work-test.js +88 -269
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/board-premium-facts.js +2 -1
- package/workspace/fixtures/board-premium-jira.js +28 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/initiative-premium-facts.js +2 -1
- package/workspace/fixtures/initiatives-api/list.json +30 -42
- package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
- package/workspace/fixtures/initiatives-api/sheet.json +10 -14
- package/workspace/fixtures/insights-premium-facts.js +11 -2
- 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 +2 -0
- package/workspace/guide/lifecycle.md +51 -0
- package/workspace/home-shot.js +38 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-premium.js +160 -3
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/engine/boards.js +15 -14
- package/workspace/lib/engine/nine-stages.js +49 -20
- package/workspace/lib/engine/signals/detectors.js +13 -11
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +126 -1
- 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-premium.js +3 -2
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-initiatives.js +1 -1
- package/workspace/lib/routes-insights-premium.js +19 -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/vendor/scripts/nine-stages.js +49 -20
- 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-agreed-viewer-shots.js +76 -0
- package/workspace/premium-board-actions-test.js +85 -73
- 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 -36
- package/workspace/premium-chat-context-test.js +22 -19
- package/workspace/premium-chat-goal-view-test.js +28 -26
- package/workspace/premium-chat-notes-test.js +29 -33
- package/workspace/premium-chat-report-tab-test.js +35 -25
- package/workspace/premium-chat-term-test.js +16 -14
- package/workspace/premium-chat-viewer-test.js +60 -53
- package/workspace/premium-core-doc-issue-test.js +50 -41
- package/workspace/premium-html-viewer-test.js +17 -18
- package/workspace/premium-phone-card-test.js +8 -2
- package/workspace/premium-phone-room-test.js +42 -31
- 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 -31
- package/workspace/premium-vw-cal-test.js +82 -123
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +12 -11
- package/workspace/premium-vw-item-test.js +50 -48
- package/workspace/premium-vw-jira-test.js +55 -26
- package/workspace/premium-vw-meet-test.js +118 -187
- package/workspace/premium-vw-notes-test.js +85 -107
- package/workspace/premium-vw-rec-test.js +72 -193
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +63 -51
- package/workspace/public/pm/bd-acts.js +305 -0
- package/workspace/public/pm/bd-span.js +224 -0
- package/workspace/public/pm/bd-stages.js +47 -0
- 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 +640 -0
- package/workspace/public/pm/cozy-home.css +580 -0
- package/workspace/public/pm/cozy-home.js +172 -0
- package/workspace/public/pm/cozy-initiative.css +138 -0
- package/workspace/public/pm/cozy-insights.css +421 -0
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +65 -0
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-viewer.css +143 -0
- package/workspace/public/pm/cozy-viewer.js +144 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +254 -0
- 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/lifecycle-lens-model.js +45 -27
- package/workspace/public/pm/lifecycle-lens.js +22 -11
- 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 +544 -253
- package/workspace/public/pm/premium-brief.js +1 -1
- package/workspace/public/pm/premium-chart-tab.js +110 -62
- package/workspace/public/pm/premium-chat.js +17 -10
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +25 -21
- package/workspace/public/pm/premium-initiative-head.js +138 -0
- package/workspace/public/pm/premium-initiative.js +28 -4
- package/workspace/public/pm/premium-insights.js +950 -440
- 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 +107 -124
- package/workspace/public/pm/premium-viewer.js +27 -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-jira-model.js +22 -5
- package/workspace/public/pm/premium-vw-jira.css +11 -0
- package/workspace/public/pm/premium-vw-jira.js +11 -4
- 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 -215
- 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 +57 -64
- package/workspace/public/premium-chat.html +7 -33
- package/workspace/public/premium-initiative.html +8 -41
- package/workspace/public/premium-insights.html +63 -62
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium-work.html +6 -72
- package/workspace/public/premium.html +21 -66
- package/workspace/public/vendor/nunito-var.woff2 +0 -0
- package/workspace/server.js +25 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/premium-agreed-viewer.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/third-party/README.md +1 -0
- package/workspace/public/pm/premium-work.js +0 -719
- package/workspace/public/pm/premium.js +0 -1133
|
@@ -37,12 +37,17 @@ const PROP = { kind: 'report', proposal: { name: 'Social login weekly', purpose:
|
|
|
37
37
|
const ASK = { role: 'user', text: '[PMOS report] rule\n\nThe PM says: make this a report for the growth leads' };
|
|
38
38
|
const ANSWER = { role: 'assistant', text: 'Signups from the lightbox rose to 1,240. I drafted a report from this chat.\n\n' + block(PROP) };
|
|
39
39
|
|
|
40
|
+
/* premium-agreed-design: Home's chat is #hmLog; a report opens in the Viewer card (#czViewer), which covers the chat page on a phone. A new
|
|
41
|
+
* report is the design's slide deck (Main.dc.html viewer "deck"): one slide, Slide n of N, the thumbnails (the title slide, then the seven sections);
|
|
42
|
+
* its setup and a set-up template are the cozy parts marked Waiting for design. A confirm asks in the card ([data-rt="askyes"]). */
|
|
40
43
|
const look = () => {
|
|
41
|
-
const
|
|
42
|
-
return { shut:
|
|
43
|
-
json: /pmos-report|"kind"/.test((document.querySelector('#
|
|
44
|
-
tabs: [
|
|
45
|
-
secs: pane ? pane.
|
|
44
|
+
const vw = document.querySelector('#czViewer:not([hidden])'), pane = vw ? vw.querySelector('.vz[data-vw^="report:"]') : null;
|
|
45
|
+
return { shut: !pane, layer: false, chip: (document.querySelector('#hmLog [data-report-open]') || {}).textContent || null,
|
|
46
|
+
json: /pmos-report|"kind"/.test((document.querySelector('#hmLog') || {}).textContent || ''), user: [...document.querySelectorAll('#hmLog .hm-u .hm-bub')].map((u) => u.textContent.trim()),
|
|
47
|
+
tabs: pane ? [(vw.querySelector('.cz-vw-kind') || {}).textContent || ''] : [], pane: pane ? pane.textContent.replace(/\s+/g, ' ').trim() : null,
|
|
48
|
+
secs: pane ? (pane.querySelector('.vz-dkt') ? pane.querySelectorAll('.vz-dkt button').length - 1 : pane.querySelectorAll('.vz-secs li').length) : 0,
|
|
49
|
+
slide: pane && pane.querySelector('.vz-dkn > span') ? pane.querySelector('.vz-dkn > span').textContent : null,
|
|
50
|
+
sched: pane && pane.querySelector('[data-rt="sched"] b') ? pane.querySelector('[data-rt="sched"] b').textContent : null,
|
|
46
51
|
wide: document.documentElement.scrollWidth > innerWidth + 1 };
|
|
47
52
|
};
|
|
48
53
|
|
|
@@ -62,8 +67,8 @@ const look = () => {
|
|
|
62
67
|
const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
|
|
63
68
|
await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-rep', goal: null } }));
|
|
64
69
|
await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages: st.messages } }));
|
|
65
|
-
await p.goto(chat);
|
|
66
|
-
await until(() => p.evaluate(() =>
|
|
70
|
+
await p.goto(chat + '&about=work:report-test'); // premium-agreed-design: /premium-chat.html opens Home with the chat ?about names; on a phone the chat is the page
|
|
71
|
+
await until(() => p.evaluate(() => !!document.querySelector('#hmLog [data-report-open]')));
|
|
67
72
|
await sleep(500);
|
|
68
73
|
return { p, ctx, errs, st };
|
|
69
74
|
};
|
|
@@ -72,32 +77,34 @@ const look = () => {
|
|
|
72
77
|
const s0 = await p.evaluate(look);
|
|
73
78
|
ok('R1 the block is a chip under Claude\'s words, never JSON; the PM\'s turn shows as typed', /Social login weekly/.test(s0.chip || '') && /New report/.test(s0.chip || '') && !s0.json && s0.user.includes('make this a report for the growth leads'), JSON.stringify(s0));
|
|
74
79
|
ok('R1 opening the chat opens no tab by itself', s0.tabs.length === 0, JSON.stringify(s0));
|
|
75
|
-
await p.click('#
|
|
80
|
+
await p.click('#hmLog [data-report-open]');
|
|
76
81
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane ? v : null; }) || await p.evaluate(look);
|
|
77
|
-
ok('R3 the
|
|
78
|
-
&& s1.secs === 7 && s1.sched === 'Off · runs once' && /Set it up/.test(s1.pane || ''), JSON.stringify(s1));
|
|
82
|
+
ok('R3 the new report is the design\'s slide deck: name, audience, format, a title slide and seven section slides, Schedule Off', /Slide deck/.test(s1.tabs.join(' ')) && /Social login weekly/.test(s1.pane || '') && /For Growth leads · Google Slides/.test(s1.pane || '')
|
|
83
|
+
&& s1.secs === 7 && s1.slide === 'Slide 1 of 8' && s1.sched === 'Off · runs once' && /Set it up/.test(s1.pane || '') && !(await p.$('#czViewer .rt, #czViewer .obody, #dlg:not([hidden])')), JSON.stringify(s1));
|
|
84
|
+
await p.click('#czViewer [data-rt="sl|1"]');
|
|
85
|
+
ok('R3 next shows the second slide, a section of the report', /Slide 2 of 8/.test((await p.evaluate(look)).slide || '') && /Headline/.test(await p.textContent('#czViewer .vz-dks')));
|
|
79
86
|
if (shots) await p.screenshot({ path: `${shots}/new-1280-light.png` });
|
|
80
|
-
await p.click('#
|
|
81
|
-
await p.click('#
|
|
87
|
+
await p.click('#czViewer [data-rt="sched"]');
|
|
88
|
+
await p.click('#czViewer [data-rt="pick|2"]');
|
|
82
89
|
const s2 = await until(async () => { const v = await p.evaluate(look); return v.sched && /Weekly/.test(v.sched) ? v : null; }) || await p.evaluate(look);
|
|
83
90
|
ok('R3 a pick changes the chip only: nothing is written', /Weekly, Mondays at 09:00/.test(s2.sched || '') && !ledger().some((l) => l.ev === 'setup'), JSON.stringify(s2));
|
|
84
|
-
await p.click('#
|
|
85
|
-
await p.click('#
|
|
86
|
-
const s3 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Report template/.test(v.pane) ? v : null; }, 15000) || await p.evaluate(look);
|
|
91
|
+
await p.click('#czViewer [data-rt="sched"]'); await p.click('#czViewer [data-rt="pick|0"]');
|
|
92
|
+
await p.click('#czViewer [data-rt="setup"]');
|
|
93
|
+
const s3 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Report template/.test(v.tabs.join()) && /Draft/.test(v.pane) ? v : null; }, 15000) || await p.evaluate(look);
|
|
87
94
|
const L = ledger(), setup = L.find((l) => l.ev === 'setup');
|
|
88
|
-
ok('R4 Set it up records the report and pauses it (Schedule Off: it runs once); the tab shows the template', !!setup && L.some((l) => l.ev === 'pause' && l.id === setup.id) && s3.sched === 'Off · runs once' && /Report template/.test(s3.
|
|
95
|
+
ok('R4 Set it up records the report and pauses it (Schedule Off: it runs once); the tab shows the template', !!setup && L.some((l) => l.ev === 'pause' && l.id === setup.id) && s3.sched === 'Off · runs once' && /Report template/.test(s3.tabs.join()), JSON.stringify([s3, L.map((l) => l.ev)]));
|
|
89
96
|
ok('R4 its first draft is written and listed as a draft with Discard', /Draft/.test(s3.pane || '') && /Discard/.test(s3.pane || ''), JSON.stringify(s3));
|
|
90
97
|
if (shots) await p.screenshot({ path: `${shots}/template-1280-light.png` });
|
|
91
|
-
await p.click('#
|
|
98
|
+
await p.click('#czViewer [data-rt="sched"]'); await p.click('#czViewer [data-rt="pick|3"]');
|
|
92
99
|
const s4 = await until(async () => { const v = await p.evaluate(look); return v.sched && /Every two weeks/.test(v.sched) ? v : null; }) || await p.evaluate(look);
|
|
93
100
|
const changed = RS.fold(ledger()).setups.get(setup && setup.id);
|
|
94
101
|
ok('R5 the Schedule chip changes a template through the route and resumes it', !!changed && changed.status === 'active' && changed.schedule.cadence === 'bi-weekly' && /Every two weeks/.test(s4.sched || ''), JSON.stringify([s4.sched, changed]));
|
|
95
|
-
await p.click('#
|
|
96
|
-
await p.click('#
|
|
102
|
+
await p.click('#czViewer [data-rt^="discard|"]');
|
|
103
|
+
await p.click('#czViewer [data-rt="askyes"]');
|
|
97
104
|
const s5 = await until(async () => { const v = await p.evaluate(look); return v.pane && /The draft is discarded/.test(v.pane) ? v : null; }) || await p.evaluate(look);
|
|
98
105
|
ok('R6 Discard asks once, then the draft is deleted and logged', /The draft is discarded/.test(s5.pane || '') && ledger().some((l) => l.ev === 'doc-discard'), (s5.pane || '').slice(-300));
|
|
99
|
-
await p.click('#
|
|
100
|
-
await p.click('#
|
|
106
|
+
await p.click('#czViewer [data-rt="remove"]');
|
|
107
|
+
await p.click('#czViewer [data-rt="askyes"]');
|
|
101
108
|
const s6 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Template deleted/.test(v.pane) ? v : null; }) || await p.evaluate(look);
|
|
102
109
|
ok('R6 Delete template asks once, then the template is gone and the tab says its reports stay', /Template deleted/.test(s6.pane || '') && ledger().some((l) => l.ev === 'remove'), JSON.stringify(s6));
|
|
103
110
|
st.messages = [ASK, ANSWER, { role: 'user', text: '[PMOS report] rule\n\nThe PM says: one for the board too' }, { role: 'assistant', text: 'Here.\n\n' + block({ kind: 'report', proposal: { ...PROP.proposal, name: 'Board summary' } }) }];
|
|
@@ -109,16 +116,19 @@ const look = () => {
|
|
|
109
116
|
for (const scheme of ['light', 'dark']) {
|
|
110
117
|
const { p, ctx, errs } = await open(390, scheme, [ASK, ANSWER]);
|
|
111
118
|
if (shots) await p.screenshot({ path: `${shots}/chip-390-${scheme}.png` });
|
|
112
|
-
await p.click('#
|
|
113
|
-
|
|
114
|
-
|
|
119
|
+
await p.click('#hmLog [data-report-open]');
|
|
120
|
+
// premium-agreed-design: on a phone the chat is the page, and the Viewer card covers the whole screen with the Report in it
|
|
121
|
+
const shown = () => p.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); return !!v && v.getBoundingClientRect().width >= innerWidth - 1; });
|
|
122
|
+
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && await shown() ? v : null; }) || await p.evaluate(look);
|
|
123
|
+
s1.detail = await shown();
|
|
124
|
+
ok(`R7 (${scheme}) at 390 the chip covers the page with the Report tab`, s1.detail && /Social login weekly/.test(s1.pane || '') && s1.secs === 7, JSON.stringify(s1));
|
|
115
125
|
if (shots) await p.screenshot({ path: `${shots}/new-390-${scheme}.png` });
|
|
116
126
|
ok(`F1 (${scheme}) no page error and no sideways scroll at 390`, !errs.length && !s1.wide, errs.join(' | '));
|
|
117
127
|
await ctx.close();
|
|
118
128
|
}
|
|
119
129
|
if (shots) {
|
|
120
130
|
const { p, ctx } = await open(1280, 'dark', [ASK, ANSWER]);
|
|
121
|
-
await p.click('#
|
|
131
|
+
await p.click('#hmLog [data-report-open]'); await sleep(500);
|
|
122
132
|
await p.screenshot({ path: `${shots}/new-1280-dark.png` });
|
|
123
133
|
await ctx.close();
|
|
124
134
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
/* premium-chat-term-test.js — the chat header's Open in terminal icon (chat-open-in-terminal, Wawan 2026-10-22).
|
|
4
4
|
* A real server on a scratch repository (c3-scan-fixture.js); the thread and the session list are routed.
|
|
5
|
-
* O1 a running session: the icon shows and opens
|
|
5
|
+
* O1 a running session: the icon shows and opens that session's terminal, read only, in the Viewer (premium-agreed-design: Home's chat has no
|
|
6
|
+
* header, so the icon sits in the box's toolbar; nothing links to the console)
|
|
6
7
|
* O2 an ended chat: the icon copies the line that resumes it
|
|
7
8
|
* O3 no session: no icon
|
|
8
9
|
* O4 /console.html?term=<id> opens that session's sheet on the terminal, also at phone width
|
|
@@ -26,7 +27,9 @@ const finish = async (code) => {
|
|
|
26
27
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
27
28
|
|
|
28
29
|
const CMD = "cd '/Users/pm/pmos' && claude --resume 685a486b-d916-4002-9629-5e0fa33eaa9b";
|
|
29
|
-
|
|
30
|
+
// the terminal is an item of the box's + menu (Agreed design: the toolbar is "+ / @ chip"; marked Waiting for design): it is there when the menu lists it
|
|
31
|
+
const icon = () => { const b = document.querySelector('#hmTerm'); return { shown: !!b && !!b.closest('.hm-addm'), label: b ? b.getAttribute('aria-label') : null, inBox: !!(b && b.closest('#hmFoot')) }; };
|
|
32
|
+
const pressTerm = async (p) => { await p.click('#hmAdd'); await p.click('#hmTerm'); };
|
|
30
33
|
|
|
31
34
|
(async () => {
|
|
32
35
|
const exe = findBrowser();
|
|
@@ -43,29 +46,28 @@ const icon = () => { const b = document.querySelector('#dTerm'); return b ? { sh
|
|
|
43
46
|
const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
|
|
44
47
|
await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], working: false, history: null, goal: null, ...thread } }));
|
|
45
48
|
await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', messages: [{ role: 'assistant', text: 'Working on the sheet.', at: null }], turn: null } }));
|
|
46
|
-
await p.goto(chat
|
|
47
|
-
|
|
48
|
-
await p.evaluate(async () => { const m = await import('/pm/premium-shell.js'); m.S.key = 'work:term-test'; await m.loadThread('work:term-test'); });
|
|
49
|
+
await p.goto(chat + '&about=work:term-test'); // premium-agreed-design: /premium-chat.html opens Home; ?about names the conversation, as a list row does
|
|
50
|
+
await until(() => p.evaluate(() => !!document.querySelector('#hmFoot textarea')));
|
|
49
51
|
return { p, ctx, errs };
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
{ const { p, ctx, errs } = await open({ session: 'sess-7' });
|
|
53
55
|
const i = await until(async () => { const v = await p.evaluate(icon); return v && v.shown ? v : null; }) || await p.evaluate(icon);
|
|
54
|
-
ok('O1 a running session shows the terminal
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
ok('O1 pressing it opens the console
|
|
60
|
-
|
|
56
|
+
ok('O1 a running session shows the terminal in the box\'s + menu', i && i.shown && i.label === 'Watch its terminal' && i.inBox, JSON.stringify(i));
|
|
57
|
+
let read = null; await p.route('**/api/sessions/transcript?**', (r) => { read = new URL(r.request().url()).searchParams.get('id'); r.fulfill({ json: { ok: true, id: 'sess-7', text: 'claude> working on the sheet' } }); });
|
|
58
|
+
let pops = 0; ctx.on('page', () => { pops++; });
|
|
59
|
+
await pressTerm(p);
|
|
60
|
+
const v = await until(() => p.evaluate(() => { const w = document.querySelector('#czViewer:not([hidden])'); return w && /working on the sheet/.test(w.textContent) ? (w.querySelector('.cz-vw-kind') || {}).textContent : null; }));
|
|
61
|
+
ok('O1 pressing it shows that same session\'s terminal, read only, in the Viewer; no tab opens and nothing links to the console', v === 'Terminal · read only' && read === 'sess-7' && pops === 0
|
|
62
|
+
&& !(await p.evaluate(() => [...document.querySelectorAll('a[href]')].some((a) => /console/.test(a.getAttribute('href'))))), JSON.stringify([v, read, pops]));
|
|
61
63
|
if (shots) await p.screenshot({ path: `${shots}/term-1280-light.png` });
|
|
62
64
|
ok('O1 no error on the page', !errs.length, errs.join(' | '));
|
|
63
65
|
await ctx.close();
|
|
64
66
|
}
|
|
65
67
|
{ const { p, ctx } = await open({ session: null, resume: CMD }, 390, 'dark');
|
|
66
68
|
const i = await until(async () => { const v = await p.evaluate(icon); return v && v.shown ? v : null; }) || await p.evaluate(icon);
|
|
67
|
-
ok('O2 an ended chat
|
|
68
|
-
await p
|
|
69
|
+
ok('O2 an ended chat lists the item to copy its terminal line in the + menu', i && i.shown && i.label === 'Copy the terminal command', JSON.stringify(i));
|
|
70
|
+
await pressTerm(p);
|
|
69
71
|
const clip = await until(() => p.evaluate(() => navigator.clipboard.readText()));
|
|
70
72
|
const t = await p.evaluate(() => document.querySelector('#toast').textContent);
|
|
71
73
|
ok('O2 pressing it copies cd to the folder and claude --resume, and says so', clip === CMD && /Copied/.test(t), clip + ' | ' + t);
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
/* premium-chat-viewer-test.js — the Chat page's viewer opens when something opens in it (initiative premium-chat-viewer, slice 1).
|
|
4
|
-
* A real server on a scratch repository (c3-scan-fixture.js); the file reads
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* A real server on a scratch repository (c3-scan-fixture.js); the file reads and the conversation are routed.
|
|
5
|
+
* Since premium-agreed-design /premium-chat.html opens Home: the list, the chat, and the Viewer — one cozy card (#czViewer) that shows one
|
|
6
|
+
* item at a time, so the old tab strip, its "+N" fold and the head's Viewer pill are gone; the chat's "Open the Viewer" button (#hmReopen)
|
|
7
|
+
* brings back what was closed. On a phone the chat is the page and the Viewer covers it.
|
|
8
|
+
* V1 at 1280 Home opens with no Viewer and a wide chat; a file press opens the Viewer beside a chat of at least 360 px (cozy-home.css)
|
|
9
|
+
* while the list stays in view; closing it gives the chat its width again
|
|
10
|
+
* V2 the Viewer shows the file only, with its name as the title
|
|
11
|
+
* V3 a closed Viewer leaves the chat's "Open the Viewer" button, which opens the last item again
|
|
7
12
|
* V4 in a full-screen dialog on another page, a folded viewer unfolds when something opens in it
|
|
8
|
-
* V5 at 390
|
|
9
|
-
* V6
|
|
13
|
+
* V5 at 390 a file press covers the chat with the Viewer at full width; closing it returns to the conversation; Escape closes it too
|
|
14
|
+
* V6 a new item replaces the one shown: one card, no tab strip
|
|
10
15
|
* Set CHAT_VIEWER_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
|
|
11
16
|
const { findBrowser } = require('./lib/find-browser');
|
|
12
17
|
require('./test-run').configure({ name: 'premium-chat-viewer' });
|
|
@@ -27,18 +32,16 @@ const finish = async (code) => {
|
|
|
27
32
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
28
33
|
|
|
29
34
|
const MD = '# Sign-up drop\n\nThe **sign-up** rate fell from 41% to 38%.\n';
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
s.insertAdjacentHTML('beforeend', '<div class="turn a"><div class="tc"><div class="md"><p>I wrote it up in <button type="button" class="fpath" data-file="planning/research/signup-drop.md">planning/research/signup-drop.md</button> and read <button type="button" class="fpath" data-file="planning/prd/signup-fix.md">planning/prd/signup-fix.md</button>.</p></div></div></div>');
|
|
33
|
-
};
|
|
35
|
+
const ANSWER = [{ role: 'user', text: 'Why did sign-ups drop?', at: '2026-10-21T08:00:00Z' },
|
|
36
|
+
{ role: 'assistant', text: 'I wrote it up in `planning/research/signup-drop.md` and read `planning/prd/signup-fix.md`.', at: '2026-10-21T08:00:20Z' }];
|
|
34
37
|
/* the page's own state */
|
|
35
38
|
const look = () => {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
railOff:
|
|
39
|
+
const w = (s) => { const e = document.querySelector(s); return e ? Math.round(e.getBoundingClientRect().width) : 0; };
|
|
40
|
+
const vw = document.querySelector('#czViewer:not([hidden])'), list = document.querySelector('#hmList'), lr = list ? list.getBoundingClientRect() : null;
|
|
41
|
+
const reopen = document.querySelector('#hmReopen');
|
|
42
|
+
return { list: !!lr && lr.width > 200 && getComputedStyle(list).display !== 'none', shut: !vw, conv: w('#hmChat'), out: vw ? Math.round(vw.getBoundingClientRect().width) : 0,
|
|
43
|
+
title: vw ? ((vw.querySelector('#czVwTitle') || {}).textContent || '').trim() : null, strip: !!document.querySelector('#vTabs .vtab, #vwPill'),
|
|
44
|
+
reopen: !!reopen && !reopen.hidden, railOff: !document.querySelector('nav.rail'), wide: document.documentElement.scrollWidth > innerWidth + 1 };
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
(async () => {
|
|
@@ -55,70 +58,74 @@ const look = () => {
|
|
|
55
58
|
const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
|
|
56
59
|
await p.route('**/api/doc/locate**', (r) => { const rel = r.request().url().includes('prd') ? 'planning/prd/signup-fix.md' : 'planning/research/signup-drop.md'; r.fulfill({ json: { ok: true, ws: F.ws, rel, name: rel.split('/').pop(), abs: '/x/' + rel, mtime: 1, size: MD.length } }); });
|
|
57
60
|
await p.route('**/api/doc?**', (r) => r.fulfill({ contentType: 'text/plain', headers: { 'X-Doc-Kind': 'markdown' }, body: MD }));
|
|
58
|
-
await p.
|
|
59
|
-
await p.
|
|
61
|
+
await p.route('**/api/briefing-premium/thread**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-vw' } }));
|
|
62
|
+
await p.route('**/api/sessions/conversation**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'user', messages: ANSWER } }));
|
|
63
|
+
await p.goto(chat + '&about=work:viewer-test');
|
|
64
|
+
await until(() => p.evaluate(() => /\/premium\.html$/.test(location.pathname) && document.querySelectorAll('#hmLog .fpath').length >= 2), 12000);
|
|
65
|
+
await sleep(300);
|
|
60
66
|
return { p, ctx, errs };
|
|
61
67
|
};
|
|
62
68
|
const many = (p) => p.evaluate(async () => { const v = await import('/pm/premium-viewer.js'); for (const n of ['funnel-export.csv', 'support-tickets.md', 'pricing-notes.md', 'a-longer-quarterly-plan.md']) v.vwOpen({ id: 'x:' + n, title: n, html: '<article class="paper doc"><p>' + n + '</p></article>' }); });
|
|
69
|
+
const closeVw = (p) => p.click('#czViewer [data-cz-vw="close"]');
|
|
63
70
|
|
|
64
71
|
{ const { p, ctx, errs } = await open(1280);
|
|
65
72
|
const s0 = await p.evaluate(look);
|
|
66
|
-
ok('V1 at 1280
|
|
67
|
-
await p.click('.fpath >> nth=0');
|
|
68
|
-
const s1 = await until(async () => { const v = await p.evaluate(look); return !v.shut && v.
|
|
69
|
-
ok('V1 a file press opens the
|
|
70
|
-
ok('V2 the
|
|
71
|
-
await p
|
|
73
|
+
ok('V1 at 1280 /premium-chat.html opens Home with the list, no Viewer and the conversation wide', s0.list && s0.shut && s0.out === 0 && s0.conv > 700 && s0.railOff, JSON.stringify(s0));
|
|
74
|
+
await p.click('#hmLog .fpath >> nth=0');
|
|
75
|
+
const s1 = await until(async () => { const v = await p.evaluate(look); return !v.shut && v.title ? v : null; }) || await p.evaluate(look);
|
|
76
|
+
ok('V1 a file press opens the Viewer beside a conversation of at least 360 px, and Home\'s list stays in view beside them', !s1.shut && s1.out > 300 && s1.conv >= 360 && s1.list, JSON.stringify(s1));
|
|
77
|
+
ok('V2 the Viewer shows only the file, with its name as the title, and no tab strip', /signup-drop\.md/.test(s1.title) && !s1.strip, JSON.stringify(s1));
|
|
78
|
+
await closeVw(p);
|
|
72
79
|
const s2 = await until(async () => { const v = await p.evaluate(look); return v.shut ? v : null; }) || await p.evaluate(look);
|
|
73
|
-
ok('V1 closing the
|
|
74
|
-
await p.click('.fpath >> nth=0'); await p.click('.fpath >> nth=1'); await sleep(300);
|
|
75
|
-
await p.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
await p.
|
|
80
|
+
ok('V1 closing the Viewer gives the conversation its width and the list stays', s2.shut && s2.out === 0 && s2.conv > 700 && s2.list, JSON.stringify(s2));
|
|
81
|
+
await p.click('#hmLog .fpath >> nth=0'); await p.click('#hmLog .fpath >> nth=1'); await sleep(300);
|
|
82
|
+
const sb = await until(async () => { const v = await p.evaluate(look); return /signup-fix\.md/.test(v.title || '') ? v : null; }) || await p.evaluate(look);
|
|
83
|
+
ok('V6 a second file replaces the first in the one Viewer card', /signup-fix\.md/.test(sb.title || '') && !sb.strip && await p.evaluate(() => document.querySelectorAll('#czViewer').length === 1), JSON.stringify(sb));
|
|
84
|
+
await closeVw(p);
|
|
85
|
+
const s3 = await until(async () => { const v = await p.evaluate(look); return v.shut && v.reopen ? v : null; }) || await p.evaluate(look);
|
|
86
|
+
ok('V3 the close leaves the chat\'s "Open the Viewer" button', s3.shut && s3.reopen, JSON.stringify(s3));
|
|
87
|
+
await p.click('#hmReopen');
|
|
79
88
|
const s4 = await until(async () => { const v = await p.evaluate(look); return !v.shut ? v : null; }) || await p.evaluate(look);
|
|
80
|
-
ok('V3 the
|
|
89
|
+
ok('V3 the button opens the last item again', !s4.shut && /signup-fix\.md/.test(s4.title || '') && !s4.reopen, JSON.stringify(s4));
|
|
81
90
|
if (shots) await p.screenshot({ path: `${shots}/chat-viewer-1280-light.png` });
|
|
82
91
|
await many(p); await sleep(400);
|
|
83
92
|
const s5 = await p.evaluate(look);
|
|
84
|
-
ok('V6
|
|
85
|
-
await p.click('#vTabs .vmore'); await sleep(200);
|
|
86
|
-
const items = await p.evaluate(() => [...document.querySelectorAll('#vMore [data-vw]')].map((b) => b.dataset.vw));
|
|
87
|
-
await p.click('#vMore [data-vw] >> nth=0'); await sleep(200);
|
|
88
|
-
const on = await p.evaluate(() => (document.querySelector('#vTabs .vtab[aria-selected="true"]') || {}).dataset.vw);
|
|
89
|
-
ok('V6 the +N menu lists the hidden tabs and opens one', items.length >= 1 && on === items[0], JSON.stringify({ items, on }));
|
|
93
|
+
ok('V6 many opens leave one card on the newest item and nothing to fold', s5.title === 'a-longer-quarterly-plan.md' && !s5.strip, JSON.stringify(s5));
|
|
90
94
|
ok('F1 no page error and no sideways scroll', !errs.length && !s5.wide, errs.join(' | '));
|
|
91
95
|
await ctx.close(); }
|
|
92
96
|
|
|
93
97
|
for (const scheme of ['light', 'dark']) {
|
|
94
98
|
const { p, ctx, errs } = await open(390, scheme);
|
|
95
99
|
const s0 = await p.evaluate(look);
|
|
96
|
-
ok(`V5 (${scheme}) at 390
|
|
97
|
-
await p.click('.fpath >> nth=0');
|
|
98
|
-
const s1 = await until(async () => { const v = await p.evaluate(look); return v.
|
|
99
|
-
ok(`V5 (${scheme}) a file press covers the
|
|
100
|
+
ok(`V5 (${scheme}) at 390 the chat is the page, with no Viewer yet`, s0.shut && s0.conv > 340 && !s0.list, JSON.stringify(s0));
|
|
101
|
+
await p.click('#hmLog .fpath >> nth=0');
|
|
102
|
+
const s1 = await until(async () => { const v = await p.evaluate(look); return !v.shut && /signup-drop\.md/.test(v.title || '') ? v : null; }) || await p.evaluate(look);
|
|
103
|
+
ok(`V5 (${scheme}) a file press covers the chat with the file at full width`, !s1.shut && s1.out >= 340 && /signup-drop\.md/.test(s1.title || ''), JSON.stringify(s1));
|
|
100
104
|
if (shots) await p.screenshot({ path: `${shots}/chat-viewer-390-${scheme}.png` });
|
|
101
|
-
await p
|
|
102
|
-
const s2 = await until(async () => { const v = await p.evaluate(look); return
|
|
103
|
-
ok(`V5 (${scheme})
|
|
104
|
-
await p.click('#
|
|
105
|
+
await closeVw(p);
|
|
106
|
+
const s2 = await until(async () => { const v = await p.evaluate(look); return v.shut ? v : null; }) || await p.evaluate(look);
|
|
107
|
+
ok(`V5 (${scheme}) closing the Viewer returns to the conversation`, s2.shut && s2.conv > 340 && await p.isVisible('#hmIn'), JSON.stringify(s2));
|
|
108
|
+
await p.click('#hmLog .fpath >> nth=1');
|
|
109
|
+
await until(async () => !(await p.evaluate(look)).shut);
|
|
105
110
|
await p.keyboard.press('Escape');
|
|
106
|
-
const s3 = await until(async () => { const v = await p.evaluate(look); return
|
|
107
|
-
ok(`V5 (${scheme}) Escape
|
|
111
|
+
const s3 = await until(async () => { const v = await p.evaluate(look); return v.shut ? v : null; }) || await p.evaluate(look);
|
|
112
|
+
ok(`V5 (${scheme}) Escape closes the Viewer`, s3.shut, JSON.stringify(s3));
|
|
108
113
|
ok(`F1 (${scheme}) no page error and no sideways scroll at 390`, !errs.length && !s3.wide, errs.join(' | '));
|
|
109
114
|
await ctx.close();
|
|
110
115
|
}
|
|
111
116
|
|
|
112
117
|
{ const ctx = await browser.newContext({ viewport: { width: 1280, height: 800 } }); const p = await ctx.newPage();
|
|
113
118
|
await p.addInitScript(() => { try { localStorage.setItem('pmos.srl.view', 'min'); } catch { /* none */ } });
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
await
|
|
117
|
-
const
|
|
118
|
-
await p.evaluate(
|
|
119
|
+
// re-pointed (insights fix): Insights has no old dialog now (Agreed design), so nothing can fold; what opens goes to the Viewer card.
|
|
120
|
+
// The intent stays: on another page, with a folded view remembered, something opened in the Viewer is shown, never left folded
|
|
121
|
+
await p.goto(`${F.BASE}/premium-insights.html?ws=${encodeURIComponent(F.ws)}`); await until(() => p.evaluate(() => !!window.czViewer));
|
|
122
|
+
const vl = () => { const v = document.querySelector('#czViewer'); const r = v && !v.hidden ? v.getBoundingClientRect() : null; return { dlg: !!document.querySelector('#dlg'), shown: !!r, w: r ? Math.round(r.width) : 0, h: r ? Math.round(r.height) : 0, min: !!(v && /vw-min/.test(v.className)), title: v ? (v.querySelector('.cz-vw-title') || {}).textContent : '', body: v ? v.querySelector('.cz-vw-body').textContent : '' }; };
|
|
123
|
+
await p.evaluate(() => window.czViewer.open({ kind: 'Report', title: 'a.md', html: '<p>a</p>', id: 'x:a' }));
|
|
124
|
+
await sleep(200);
|
|
125
|
+
await p.evaluate(() => window.czViewer.open({ kind: 'Report', title: 'b.md', html: '<p>b</p>', id: 'x:b' }));
|
|
119
126
|
await sleep(200);
|
|
120
|
-
const after = await p.evaluate(
|
|
121
|
-
ok('V4
|
|
127
|
+
const after = await p.evaluate(vl);
|
|
128
|
+
ok('V4 on another page, something opened in the Viewer is shown whole, never folded (no old dialog to fold)', !after.dlg && after.shown && !after.min && after.w >= 300 && after.h >= 300 && after.title === 'b.md' && after.body === 'b', JSON.stringify(after));
|
|
122
129
|
await ctx.close(); }
|
|
123
130
|
|
|
124
131
|
return finish();
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
/* premium-core-doc-issue-test.js — Issue it on a core document draft, on the premium Board and the premium initiative page (initiative premium-core-doc-issue;
|
|
4
4
|
* planning/prd/premium-core-doc-issue-prd.md I1 to I7). A real server on a scratch `team` repository, never the PMOS checkout. The drafts are written by the
|
|
5
5
|
* core-docs writer (lib/core-docs.js writeDraft), so the pages read what the agent's run would leave. The real pages press the real route:
|
|
6
|
-
* R reading (slot and path) · B the Board reader and Issue it · I the initiative
|
|
6
|
+
* R reading (slot and path) · B the Board reader and Issue it · I the initiative (a layout in Home since premium-agreed-design: its Overview, the draft
|
|
7
|
+
* reader in the Viewer), unsaved edits and a refusal · P the POST allow-list · F floors */
|
|
7
8
|
const fs = require('fs');
|
|
8
9
|
const path = require('path');
|
|
9
10
|
const { spawn } = require('child_process');
|
|
@@ -34,7 +35,7 @@ const finish = async (code) => {
|
|
|
34
35
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
35
36
|
|
|
36
37
|
const ledger = () => { const f = CD.ledgerFile(team); return fs.existsSync(f) ? fs.readFileSync(f, 'utf8').split('\n').filter(Boolean).map((x) => JSON.parse(x)) : []; };
|
|
37
|
-
const ALLOWED = /^\/api\/(?:core-docs\/issue|briefing-premium\/note|doc-health\/check)$/;
|
|
38
|
+
const ALLOWED = /^\/api\/(?:core-docs\/issue|briefing-premium\/note|briefing-premium\/seen|doc-health\/check)$/; // seen: Home records what it showed, not a press
|
|
38
39
|
const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers.\n';
|
|
39
40
|
|
|
40
41
|
(async () => {
|
|
@@ -81,65 +82,71 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
|
|
|
81
82
|
if (theme === 'dark') await page.evaluate(() => { document.documentElement.dataset.theme = 'dark'; });
|
|
82
83
|
return { ctx, page, errors, posts };
|
|
83
84
|
};
|
|
84
|
-
const dlgOn = async (p) => { const v = await until(() => p.evaluate(() => document.querySelector('#dlg
|
|
85
|
+
const dlgOn = async (p) => { const v = await until(() => p.evaluate(() => !!document.querySelector('#dlg.on'))); await sleep(800); return v; };
|
|
85
86
|
const toastIs = (p, re) => until(() => p.evaluate((s) => { const t = document.querySelector('#toast'); return t.classList.contains('on') && new RegExp(s).test(t.textContent) ? t.textContent : null; }, re.source));
|
|
86
87
|
const H = await T.pressHeaders(BASE);
|
|
87
88
|
const nonce = H['x-pmos-nonce'];
|
|
88
89
|
|
|
89
|
-
/* B the Board reader
|
|
90
|
+
/* B the Board reader (premium-agreed-design: the Documents tab is a plain list; a document with a file opens a plain reader in the side panel,
|
|
91
|
+
tagged "Waiting for design", with the Issue it bar) */
|
|
92
|
+
const bToast = (p, re) => until(() => p.evaluate((s) => { const t = document.querySelector('#bdToast'); return t && !t.hidden && new RegExp(s).test(t.textContent) ? t.textContent : null; }, re.source));
|
|
90
93
|
const P = await open('/premium-board.html'), p = P.page;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
await p.
|
|
94
|
-
ok('
|
|
95
|
-
|
|
96
|
-
ok('B2 the reader
|
|
94
|
+
await until(() => p.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 60000);
|
|
95
|
+
await p.click('#tabDocs');
|
|
96
|
+
ok('B1 a board document with a file is a button that opens the reader', await until(() => p.evaluate((k) => !!document.querySelector(`#docBody [data-act="cdoc"][data-key="${k}"]`), bkey), 60000));
|
|
97
|
+
ok('B1 a document with no file is not', await p.evaluate(() => [...document.querySelectorAll('#docBody .bd-lr')].every((r) => !!r.querySelector('[data-act="cdoc"]') === /\//.test(r.querySelector('.pth').textContent))));
|
|
98
|
+
await p.click(`#docBody [data-act="cdoc"][data-key="${bkey}"]`);
|
|
99
|
+
ok('B2 the reader shows the file\'s text and path, tagged, and the bar says nothing is sent', await until(() => p.evaluate((pt) => { const o = document.querySelector('#peek'); return !o.hidden && /Why this board exists/.test(o.textContent) && o.textContent.includes(pt) && !!o.querySelector('.bd-wtag') && !!o.querySelector('[data-issue-bar="draft"]') && /Nothing is sent/.test(o.querySelector('[data-issue-bar]').textContent) && !!o.querySelector('[data-act="issue"]'); }, d1.path)), await p.evaluate(() => document.querySelector('#peek').textContent));
|
|
100
|
+
ok('B2 no old dialog opens', await p.evaluate(() => !!!document.querySelector('#dlg.on')));
|
|
97
101
|
const n0 = ledger().filter((l) => l.ev === 'issue').length;
|
|
98
|
-
await p.click('[data-
|
|
99
|
-
ok('B3 Issue it says it sent nothing', !!(await
|
|
102
|
+
await p.click('#peek [data-act="issue"]');
|
|
103
|
+
ok('B3 Issue it says it sent nothing', !!(await bToast(p, /Issued\. Nothing was sent to anyone/)));
|
|
100
104
|
const sent = P.posts.filter((x) => x.path === '/api/core-docs/issue');
|
|
101
105
|
ok('B4 it posted the workspace, the scope, the key and the slot, and nothing else, with the launch nonce', sent.length === 1 && Object.keys(sent[0].body).sort().join() === 'key,scope,slot,ws' && sent[0].body.scope === bscope && sent[0].body.key === bkey && sent[0].body.slot === d1.slot && sent[0].body.ws === B.ws && sent[0].headers['x-pmos-nonce'] === nonce && !!nonce, JSON.stringify(sent));
|
|
102
106
|
const il = ledger().filter((l) => l.ev === 'issue');
|
|
103
107
|
ok('B5 the ledger has one new issue line for that draft, written by the PM', il.length === n0 + 1 && il[il.length - 1].slot === d1.slot && il[il.length - 1].scope === bscope && /pm/.test(String(il[il.length - 1].by)), JSON.stringify(il));
|
|
104
108
|
ok('B5 the file now says state: issued', /^state: issued$/m.test(fs.readFileSync(path.join(team, d1.path), 'utf8')));
|
|
105
|
-
ok('B6 the reader says it is issued, the Issue it press is gone, and the row reads Up to date', await until(() => p.evaluate(() => { const o = document.querySelector('#
|
|
109
|
+
ok('B6 the reader says it is issued, the Issue it press is gone, and the row reads Up to date', await until(() => p.evaluate(() => { const o = document.querySelector('#peek'); return !o.hidden && !!o.querySelector('[data-issue-bar="done"]') && !o.querySelector('[data-act="issue"]'); }), 30000) && await until(() => p.evaluate((k) => { const r = document.querySelector(`#docBody [data-doc-key="${k}"]`); return r && /Up to date/.test(r.textContent); }, bkey), 30000), await p.evaluate(() => document.querySelector('#peek').textContent + ' // ' + document.querySelector('#docBody').textContent));
|
|
106
110
|
await p.screenshot({ path: path.join(R.base, 'board-issued.png') });
|
|
107
111
|
await P.ctx.close();
|
|
108
112
|
|
|
109
|
-
/* I the initiative
|
|
113
|
+
/* I the initiative: a layout inside Home (premium-agreed-design). The Board's expand link lands there; the card's Overview lists the core documents,
|
|
114
|
+
and a draft opens a minimal reader in the Viewer (Waiting for design) with the Issue it bar, Read and Edit */
|
|
115
|
+
const ovOpen = async (p) => { await until(() => p.evaluate(() => !!document.querySelector('.hm-card [data-hm-ov]')), 60000); await p.click('.hm-card [data-hm-ov]'); };
|
|
110
116
|
const I = await open('/premium-initiative.html' + iq), ip = I.page;
|
|
111
|
-
await
|
|
112
|
-
await ip.
|
|
113
|
-
|
|
114
|
-
await ip.
|
|
115
|
-
|
|
116
|
-
await ip.
|
|
117
|
-
await ip.
|
|
118
|
-
await
|
|
119
|
-
const nI = I.posts.length;
|
|
120
|
-
await ip.click('[data-ds="issue"]');
|
|
121
|
-
ok('I2 Issue it with unsaved edits posts nothing and says to save or cancel first', await until(() => ip.evaluate(() => /unsaved changes.*Save or cancel/.test((document.querySelector('#dsErr') || {}).textContent || ''))) && I.posts.length === nI);
|
|
117
|
+
await ovOpen(ip);
|
|
118
|
+
await until(() => ip.evaluate((k) => !!document.querySelector(`#czViewer [data-ov-dread="${k}"]`), ikey), 60000);
|
|
119
|
+
await ip.click(`#czViewer [data-ov-dread="${ikey}"]`);
|
|
120
|
+
ok('I1 the reader of a draft has the Issue it bar above the text, tagged Waiting for design', await until(() => ip.evaluate(() => { const o = document.querySelector('#czViewer:not([hidden])'); const b = o && o.querySelector('[data-issue-bar="draft"]'); const t = o && o.querySelector('.dsbody'); return !!b && !!t && /Nothing is sent/.test(b.textContent) && /Why this board exists/.test(t.textContent) && !!o.querySelector('.hx-wait') && !!(b.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING); }), 30000));
|
|
121
|
+
ok('I1 no old dialog opens', await ip.evaluate(() => { const d = document.querySelector('#dlg'); return !d || !d.classList.contains('on'); }));
|
|
122
|
+
await ip.click('#czViewer [data-ds="edit"]');
|
|
123
|
+
await until(() => ip.evaluate(() => !!document.querySelector('#czViewer [data-ds-host] .cfb[contenteditable="true"]')), 30000);
|
|
124
|
+
await ip.click('#czViewer [data-ds-host] .cfb'); await ip.keyboard.press('Control+End'); await ip.keyboard.type(' Unsaved line.');
|
|
125
|
+
const nI = I.posts.filter((x) => x.path === '/api/core-docs/issue').length;
|
|
126
|
+
await ip.click('#czViewer [data-ds="issue"]');
|
|
127
|
+
ok('I2 Issue it with unsaved edits posts nothing and says to save or cancel first', await until(() => ip.evaluate(() => /unsaved changes.*Save or cancel/.test((document.querySelector('#czViewer #dsErr') || {}).textContent || ''))) && I.posts.filter((x) => x.path === '/api/core-docs/issue').length === nI);
|
|
122
128
|
ok('I2 the ledger has no issue line for that draft yet', !ledger().some((l) => l.ev === 'issue' && l.slot === d2.slot && l.scope === iscope));
|
|
123
|
-
await ip.click('#
|
|
124
|
-
await ip.
|
|
125
|
-
await until(() => ip.evaluate(() => !!document.querySelector('[data-ds="issue"]')));
|
|
129
|
+
await ip.click('#czViewer [data-vd="cancel"]');
|
|
130
|
+
await until(() => ip.evaluate(() => !!document.querySelector('#czViewer [data-ds="issue"]') && !!document.querySelector('#czViewer .dsbody')));
|
|
126
131
|
/* a refusal: someone else issues the same draft first (the console, a second tab) */
|
|
127
132
|
const raced = await fetch(BASE + '/api/core-docs/issue', { method: 'POST', headers: H, body: JSON.stringify({ ws: B.ws, scope: iscope, key: ikey, slot: d2.slot }) });
|
|
128
133
|
ok('I3 setup the draft is issued behind the page\'s back', raced.status === 200);
|
|
129
|
-
await ip.click('[data-ds="issue"]');
|
|
130
|
-
ok('I3 a refused press shows the server\'s words and the
|
|
134
|
+
await ip.click('#czViewer [data-ds="issue"]');
|
|
135
|
+
ok('I3 a refused press shows the server\'s words and the reader changes nothing else', await until(() => ip.evaluate(() => /already/.test((document.querySelector('#czViewer #dsErr') || {}).textContent || '') && !!document.querySelector('#czViewer [data-issue-bar="draft"]'))));
|
|
131
136
|
ok('I3 the refusal wrote no second issue line', ledger().filter((l) => l.ev === 'issue' && l.slot === d2.slot && l.scope === iscope).length === 1);
|
|
132
|
-
await ip.click('#dlg [data-act="close"], #dClose').catch(() => {});
|
|
133
137
|
await I.ctx.close();
|
|
134
138
|
|
|
135
139
|
/* I4 a fresh page: press Issue it on the third draft */
|
|
136
140
|
const J = await open('/premium-initiative.html' + iq), jp = J.page;
|
|
137
141
|
const k3 = d3.path.split('/').slice(-2)[0];
|
|
138
|
-
await
|
|
139
|
-
await jp.
|
|
140
|
-
await
|
|
141
|
-
await jp.
|
|
142
|
-
|
|
142
|
+
await ovOpen(jp);
|
|
143
|
+
await until(() => jp.evaluate((k) => !!document.querySelector(`#czViewer [data-ov-dread="${k}"]`), k3), 60000);
|
|
144
|
+
await jp.click(`#czViewer [data-ov-dread="${k3}"]`);
|
|
145
|
+
await until(() => jp.evaluate(() => !!document.querySelector('#czViewer [data-ds="issue"]')));
|
|
146
|
+
await jp.click('#czViewer [data-ds="issue"]');
|
|
147
|
+
const issued = !!(await toastIs(jp, /Issued\. Nothing was sent to anyone/)) && await until(() => jp.evaluate(() => !!document.querySelector('#czViewer [data-issue-bar="done"]') && !document.querySelector('#czViewer [data-ds="issue"]')));
|
|
148
|
+
await sleep(1500); await jp.click('.hm-card [data-hm-ov]');
|
|
149
|
+
ok('I4 Issue it works from the reader: the toast, the issued bar, and the Overview row reads Up to date', issued && await until(() => jp.evaluate((k) => /Up to date/.test((document.querySelector(`#czViewer [data-ov-doc="${k}"]`) || {}).textContent || ''), k3), 30000));
|
|
143
150
|
ok('I4 the file says state: issued and the ledger has its issue line', /^state: issued$/m.test(fs.readFileSync(path.join(team, d3.path), 'utf8')) && ledger().some((l) => l.ev === 'issue' && l.slot === d3.slot && l.scope === iscope));
|
|
144
151
|
await jp.screenshot({ path: path.join(R.base, 'ini-issued.png') });
|
|
145
152
|
|
|
@@ -161,11 +168,13 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
|
|
|
161
168
|
const k4 = d4.path.split('/').slice(-2)[0];
|
|
162
169
|
for (const [w, h, theme] of [[390, 844, 'light'], [390, 844, 'dark'], [1280, 900, 'dark']]) {
|
|
163
170
|
const S = await open('/premium-board.html', { w, h, theme });
|
|
164
|
-
await until(() => S.page.evaluate((
|
|
165
|
-
await S.page.click(
|
|
166
|
-
await until(() => S.page.evaluate(() => !!document.querySelector(
|
|
167
|
-
|
|
168
|
-
|
|
171
|
+
await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 60000);
|
|
172
|
+
await S.page.click(w <= 720 ? '#chDocs' : '#tabDocs');
|
|
173
|
+
await until(() => S.page.evaluate((k) => !!document.querySelector(`#docBody [data-act="cdoc"][data-key="${k}"]`), k4), 60000);
|
|
174
|
+
await S.page.click(`#docBody [data-act="cdoc"][data-key="${k4}"]`);
|
|
175
|
+
await until(() => S.page.evaluate(() => !!document.querySelector('#peek [data-act="issue"]')));
|
|
176
|
+
const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#peek [data-act="issue"]')].filter((b) => b.getBoundingClientRect().height < (innerWidth <= 720 ? 44 : 34)).map((b) => b.textContent) }));
|
|
177
|
+
ok(`F1 ${w} px ${theme}: no sideways scroll and the bar's button is 44 px on a phone`, !f.wide && !f.small.length, JSON.stringify(f));
|
|
169
178
|
await S.page.screenshot({ path: path.join(R.base, `bar-${w}-${theme}.png`) });
|
|
170
179
|
await S.ctx.close();
|
|
171
180
|
}
|