create-pmos 0.397.0 → 0.399.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +105 -52
- package/workspace/briefing-premium-board-test.js +284 -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 +85 -196
- package/workspace/briefing-premium-doc-edit-test.js +99 -83
- package/workspace/briefing-premium-initiative-test.js +175 -290
- package/workspace/briefing-premium-insights-test.js +414 -219
- package/workspace/briefing-premium-metrics-test.js +55 -97
- package/workspace/briefing-premium-products-test.js +44 -28
- package/workspace/briefing-premium-sources-test.js +70 -49
- package/workspace/briefing-premium-test.js +155 -648
- package/workspace/briefing-premium-work-test.js +88 -283
- package/workspace/changelog.json +24 -0
- package/workspace/ev-everywhere-test.js +210 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +187 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +68 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-grill.js +63 -0
- package/workspace/lib/board-premium.js +121 -24
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/initiative-layout.js +77 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +64 -15
- package/workspace/lib/insights-records.js +115 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/meeting-points.js +52 -0
- package/workspace/lib/news-for-you.js +88 -0
- package/workspace/lib/notes-series.js +29 -6
- package/workspace/lib/report-confirm.js +48 -0
- package/workspace/lib/route-modules.js +12 -0
- package/workspace/lib/routes-board-docs.js +46 -0
- package/workspace/lib/routes-board-grill.js +90 -0
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-home-review.js +108 -0
- package/workspace/lib/routes-initiative-layout.js +57 -0
- package/workspace/lib/routes-insights-premium.js +16 -4
- package/workspace/lib/routes-insights-records.js +133 -0
- package/workspace/lib/routes-meeting-points.js +37 -0
- package/workspace/lib/routes-news.js +57 -0
- package/workspace/lib/routes-notes.js +3 -1
- package/workspace/lib/routes-report-confirm.js +31 -0
- package/workspace/lib/routes-search.js +38 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/search-index.js +176 -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 +128 -82
- package/workspace/premium-briefing-depth-test.js +104 -90
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +37 -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 +46 -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 +52 -43
- package/workspace/premium-html-viewer-test.js +14 -17
- package/workspace/premium-phone-card-test.js +10 -3
- package/workspace/premium-phone-room-test.js +41 -35
- package/workspace/premium-report-read-test.js +152 -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 +97 -128
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +17 -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 +115 -187
- package/workspace/premium-vw-notes-test.js +88 -109
- package/workspace/premium-vw-rec-test.js +71 -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 +383 -0
- package/workspace/public/pm/bd-asks.js +261 -0
- package/workspace/public/pm/bd-pop.js +59 -0
- package/workspace/public/pm/bd-span.js +222 -82
- package/workspace/public/pm/bd-stages.js +25 -11
- package/workspace/public/pm/bd-views.js +169 -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 +798 -230
- package/workspace/public/pm/cozy-ev.css +228 -0
- package/workspace/public/pm/cozy-evmodel.js +106 -0
- package/workspace/public/pm/cozy-evui.js +47 -0
- 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 +437 -170
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +104 -29
- package/workspace/public/pm/cozy-news.js +140 -0
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-search.js +203 -0
- package/workspace/public/pm/cozy-settings.js +198 -0
- package/workspace/public/pm/cozy-sources.js +89 -0
- package/workspace/public/pm/cozy-today.css +217 -0
- package/workspace/public/pm/cozy-viewer.css +3 -3
- package/workspace/public/pm/cozy-viewer.js +145 -0
- package/workspace/public/pm/cozy-vw-mtg.css +350 -0
- package/workspace/public/pm/cozy-vw-rp.css +152 -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 +1179 -0
- package/workspace/public/pm/home-around.js +413 -0
- package/workspace/public/pm/home-chat.js +512 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-dictate.js +54 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-ini-model.js +190 -0
- package/workspace/public/pm/home-ini.css +171 -0
- package/workspace/public/pm/home-ini.js +456 -0
- package/workspace/public/pm/home-list.js +276 -0
- package/workspace/public/pm/home-more.js +132 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-review.js +104 -0
- package/workspace/public/pm/home-task.js +67 -0
- package/workspace/public/pm/home-today.js +144 -0
- package/workspace/public/pm/home-work.js +547 -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 +548 -395
- package/workspace/public/pm/premium-chart-tab.js +109 -62
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +23 -21
- package/workspace/public/pm/premium-insights.js +1102 -581
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-mtg-present.js +138 -0
- package/workspace/public/pm/premium-mtg-replay.js +142 -0
- 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 +669 -476
- package/workspace/public/pm/premium-report-tab.js +116 -67
- package/workspace/public/pm/premium-shell.js +76 -123
- package/workspace/public/pm/premium-viewer.js +22 -1
- package/workspace/public/pm/premium-vw-cal.js +277 -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 +958 -0
- package/workspace/public/pm/premium-vw-notes.js +116 -68
- 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/rp-parts.js +269 -0
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +29 -70
- package/workspace/public/premium-initiative.html +8 -48
- package/workspace/public/premium-insights.html +26 -64
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium.html +18 -107
- package/workspace/r/m1.png +0 -0
- package/workspace/r/m2.png +0 -0
- package/workspace/r/m3.png +0 -0
- package/workspace/r/nl.png +0 -0
- 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/initiative-layout.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
- package/workspace/test-lists/premium-uncovered-reports.json +9 -0
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/test-lists/uf-everywhere.json +15 -0
- package/workspace/test-lists/uf-home.json +9 -0
- package/workspace/test-lists/uncovered-board.json +9 -0
- package/workspace/public/pm/premium-work.js +0 -729
- package/workspace/public/pm/premium.js +0 -1146
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
/* premium-chat-notes-test.js — Notes for a premium chat conversation (initiative premium-chat-attach, N1-N7
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
/* premium-chat-notes-test.js — Notes for a premium chat conversation (initiative premium-chat-attach, N1-N7; re-pointed by premium-agreed-design
|
|
4
|
+
* to Home's chat: /premium-chat.html opens Home with the chat ?about names. Notes is not in the Agreed design, so it stays usable from the
|
|
5
|
+
* composer's + menu (Notes, #hmNotes) and opens in the cozy Viewer with a "Waiting for design" marker; there is no + menu and no tab strip).
|
|
6
|
+
* Serves the real Home from the real server; notes save through the real /api/chat-file/notes in a scratch state folder.
|
|
7
|
+
* N1 the Notes button opens the notepad in the Viewer, the old Scratchpad text is the first note · N2 typed Markdown is saved as a .md file
|
|
6
8
|
* N3 a checkbox ticks · N4 New note and the list · N5 the buttons are icons with names · N6 Add selection · N7 Share with Claude puts the note on
|
|
7
9
|
* the message · N8 the bubble's note chip opens Notes · N9 Delete asks first · N10 phone, both themes */
|
|
8
10
|
const fs = require('fs');
|
|
@@ -10,8 +12,6 @@ const path = require('path');
|
|
|
10
12
|
const { spawn } = require('child_process');
|
|
11
13
|
const { findBrowser } = require('./lib/find-browser');
|
|
12
14
|
const T = require('./test-run').configure({ name: 'premium-chat-notes' });
|
|
13
|
-
const WP = require('./lib/my-work-premium.js');
|
|
14
|
-
const F = require('./fixtures/my-work-premium-facts.js');
|
|
15
15
|
const lib = require('./lib/chat-files.js');
|
|
16
16
|
|
|
17
17
|
const BASE = T.BASE;
|
|
@@ -42,33 +42,30 @@ const notes = (key = KEY) => lib.listNotes({ runtimeDir: T.STATE_DIR, key }).not
|
|
|
42
42
|
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
43
43
|
await T.waitForServer(BASE);
|
|
44
44
|
browser = await chromium.launch({ executablePath: exe });
|
|
45
|
-
const model = WP.build({ v: F.view(), now: F.NOW });
|
|
46
45
|
|
|
47
46
|
const open = async ({ w = 1280, h = 900, scheme = 'light' } = {}) => {
|
|
48
|
-
const ctx = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: scheme });
|
|
47
|
+
const ctx = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: scheme, hasTouch: w < 1000 });
|
|
49
48
|
const page = await ctx.newPage();
|
|
50
|
-
const errors = [], asks = [];
|
|
49
|
+
const errors = [], asks = [], st = { session: null, messages: [] };
|
|
51
50
|
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
52
|
-
await page.route('**/api/
|
|
53
|
-
await page.route('**/api/
|
|
54
|
-
await page.goto(BASE + '/premium-
|
|
55
|
-
await page.waitForFunction(() => document.querySelector('#
|
|
56
|
-
return { page, ctx, errors, asks };
|
|
51
|
+
await page.route('**/api/briefing-premium/**', (r) => { const rq = r.request(); if (rq.method() !== 'GET') asks.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false, ...(st.session ? { session: st.session } : {}) }) }); });
|
|
52
|
+
await page.route('**/api/sessions/conversation**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'user', messages: st.messages } }));
|
|
53
|
+
await page.goto(BASE + '/premium-chat.html?about=' + encodeURIComponent(KEY), { waitUntil: 'domcontentloaded' });
|
|
54
|
+
await page.waitForFunction(() => !!document.querySelector('#hmNotes'), null, { timeout: 15000 });
|
|
55
|
+
return { page, ctx, errors, asks, st };
|
|
57
56
|
};
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const openNotes = async (page) => { await page.click('#askPlus'); await page.click('[data-plus="pad"]'); return until(async () => page.isVisible('#ntEd')); };
|
|
57
|
+
// Notes is an item of the box's + menu (Agreed design: the toolbar is "+ / @ chip"; Notes is marked Waiting for design)
|
|
58
|
+
const openNotes = async (page) => { await page.click('#hmAdd'); await page.click('#hmNotes'); return until(async () => page.isVisible('#ntEd')); };
|
|
61
59
|
const typeIn = async (page, s) => { await page.click('#ntEd'); await page.keyboard.type(s); };
|
|
62
60
|
|
|
63
61
|
// the old Scratchpad of this conversation, as the pad left it
|
|
64
62
|
await fetch(BASE + '/api/scratchpad', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ key: KEY, text: 'call Dana\nask about Q4' }) });
|
|
65
63
|
|
|
66
|
-
let { page, ctx, errors, asks } = await open();
|
|
67
|
-
await dlg(page, KEY);
|
|
64
|
+
let { page, ctx, errors, asks, st } = await open();
|
|
68
65
|
/* N1 */
|
|
69
|
-
ok('N1 the
|
|
66
|
+
ok('N1 the composer has a Notes button, not a Scratchpad', /Notes/.test(await page.getAttribute('#hmNotes', 'aria-label')) && !/Scratchpad/.test(await page.textContent('#hmFoot')));
|
|
70
67
|
ok('N1 the Scratchpad strip and its chip are gone', (await page.$('#sPad')) === null && (await page.$('#sPadT')) === null);
|
|
71
|
-
ok('N1 Notes opens in the
|
|
68
|
+
ok('N1 Notes opens in the Viewer, titled Notes, marked Waiting for design', !!(await openNotes(page)) && (await page.textContent('#czVwTitle')).trim() === 'Notes' && !!(await until(async () => page.isVisible('#czViewer .hx-wait'))));
|
|
72
69
|
ok('N1 the old Scratchpad text is the first note, line by line', !!(await until(async () => notes().length === 1)) && notes()[0].text === 'call Dana\n\nask about Q4' && /call Dana[\s\S]*ask about Q4/.test(await page.textContent('#ntEd')));
|
|
73
70
|
ok('N1 the pad is emptied once its text is a note', !!(await until(async () => { const r = await (await fetch(BASE + '/api/scratchpad?key=' + encodeURIComponent(KEY))).json(); return r.text === ''; })));
|
|
74
71
|
ok('N1 the note title shows in the head', (await page.textContent('#ntSw')).trim() === 'call Dana');
|
|
@@ -99,15 +96,15 @@ const notes = (key = KEY) => lib.listNotes({ runtimeDir: T.STATE_DIR, key }).not
|
|
|
99
96
|
/* N6 */
|
|
100
97
|
await page.evaluate(() => { const p = [...document.querySelectorAll('#ntEd p')].find((x) => /ask about/.test(x.textContent)); const r = document.createRange(); r.selectNodeContents(p); getSelection().removeAllRanges(); getSelection().addRange(r); });
|
|
101
98
|
await page.click('[data-nt="sel"]');
|
|
102
|
-
ok('N6 Add selection puts only the selected words in the message box', (await page.inputValue('#
|
|
99
|
+
ok('N6 Add selection puts only the selected words in the message box', (await page.inputValue('#hmIn')) === 'ask about Q4', JSON.stringify(await page.inputValue('#hmIn')));
|
|
103
100
|
ok('N6 nothing was sent', asks.length === 0);
|
|
104
101
|
/* N7 */
|
|
105
|
-
await page.fill('#
|
|
102
|
+
await page.fill('#hmIn', 'Plan the deck from my note');
|
|
106
103
|
await page.click('#ntSw'); await page.click('#ntM [data-ntgo]:nth-child(1)');
|
|
107
104
|
await page.click('[data-nt="share"]');
|
|
108
|
-
ok('N7 Share with Claude puts the note on the message as a chip', !!(await until(async () => page.evaluate(() => { const c = document.querySelector('#
|
|
105
|
+
ok('N7 Share with Claude puts the note on the message as a chip', !!(await until(async () => page.evaluate(() => { const c = document.querySelector('#hmFiles .hm-att'); return c && /Q4 review prep/.test(c.textContent) && /Note/.test(c.textContent); }))));
|
|
109
106
|
await shot(page, 'shared-1280-light');
|
|
110
|
-
await page.click('#
|
|
107
|
+
await page.click('#hmForm [type=submit]');
|
|
111
108
|
const ask = await until(async () => asks.find((a) => a.path.endsWith('/ask')));
|
|
112
109
|
const q4 = notes().find((x) => x.title === 'Q4 review prep');
|
|
113
110
|
ok('N7 send names the note as notes/<id>.md', !!ask && ask.body.text === 'Plan the deck from my note' && JSON.stringify(ask.body.files) === JSON.stringify(['notes/' + q4.id + '.md']), JSON.stringify(ask && ask.body));
|
|
@@ -115,31 +112,29 @@ const notes = (key = KEY) => lib.listNotes({ runtimeDir: T.STATE_DIR, key }).not
|
|
|
115
112
|
ok('N7 the name resolves to the note file Claude reads', paths.ok && paths.paths[0] === q4.path);
|
|
116
113
|
ok('N7 the note stays after the send', notes().length === 2);
|
|
117
114
|
/* N8 */
|
|
118
|
-
|
|
119
|
-
await
|
|
115
|
+
st.messages = [{ role: 'user', text: lib.withFiles('Plan the deck from my note', paths.paths), at: '2026-10-21T08:00:00Z' }]; st.session = 's-notes';
|
|
116
|
+
await until(async () => page.isVisible('#hmLog .hm-u .atc[data-att]'));
|
|
120
117
|
await page.click('#ntSw'); await page.click('#ntM [data-ntgo]:nth-child(2)');
|
|
121
|
-
await page.click('#
|
|
118
|
+
await page.click('#hmLog .hm-u .atc[data-att]');
|
|
122
119
|
ok('N8 the note chip in the PM\'s bubble opens that note', !!(await until(async () => (await page.textContent('#ntSw')).trim() === 'Q4 review prep')));
|
|
123
120
|
/* N9 */
|
|
124
121
|
await page.click('#ntSw'); await page.click('#ntM [data-ntdel]');
|
|
125
122
|
ok('N9 Delete asks first', await page.isVisible('.vcf'));
|
|
126
123
|
await page.click('.vcf button:has-text("Delete")');
|
|
127
124
|
ok('N9 Delete removes the note and shows the other', !!(await until(async () => notes().length === 1 && /call Dana/.test(await page.textContent('#ntEd')))));
|
|
128
|
-
await close(page);
|
|
129
125
|
ok('N1-N9 no page errors', errors.length === 0, errors.join(' | '));
|
|
130
126
|
await ctx.close();
|
|
131
127
|
|
|
132
128
|
/* N10 phone, both themes */
|
|
133
129
|
for (const scheme of ['light', 'dark']) {
|
|
134
130
|
({ page, ctx, errors } = await open({ w: 390, h: 844, scheme }));
|
|
135
|
-
await
|
|
136
|
-
ok(`N10 ${scheme}: Notes opens the viewer tab on a phone`, !!(await openNotes(page)));
|
|
131
|
+
ok(`N10 ${scheme}: Notes opens the Viewer over the chat on a phone`, !!(await openNotes(page)));
|
|
137
132
|
await shot(page, 'notes-390-' + scheme);
|
|
138
133
|
ok(`N10 ${scheme}: the notepad fits the width`, await page.evaluate(() => { const w = innerWidth; return ['#ntEd', '.ntf', '.nth'].every((s) => { const r = document.querySelector(s).getBoundingClientRect(); return r.width > 0 && r.left >= 0 && r.right <= w + 1; }); }));
|
|
139
134
|
await until(async () => page.evaluate(() => !document.getAnimations().some((a) => a.playState === 'running'))); // the popup's entrance scales it: measure once it has settled
|
|
140
135
|
{ const ic = await page.evaluate(() => [...document.querySelectorAll('.ntic')].map((b) => (b.dataset.nt || b.id || b.className) + ':' + Math.round(b.getBoundingClientRect().height))); ok(`N10 ${scheme}: the icon buttons are 44px targets`, ic.length > 0 && ic.every((x) => +x.split(':').pop() >= 44), ic.join()); }
|
|
141
136
|
await page.click('[data-nt="share"]');
|
|
142
|
-
ok(`N10 ${scheme}: Share with Claude goes back to the conversation with the chip`, !!(await until(async () => page.isVisible('#
|
|
137
|
+
ok(`N10 ${scheme}: Share with Claude goes back to the conversation with the chip`, !!(await until(async () => (await page.isVisible('#hmFiles .hm-att')) && (await page.$('#czViewer:not([hidden])')) === null)));
|
|
143
138
|
ok(`N10 ${scheme}: no page errors`, errors.length === 0, errors.join(' | '));
|
|
144
139
|
await ctx.close();
|
|
145
140
|
}
|
|
@@ -37,12 +37,18 @@ 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 show At a glance as the Brief draws it (premium-uncovered-features, canvas RpBrief). A confirm asks in the
|
|
43
|
+
* card ([data-rt="askyes"]). */
|
|
40
44
|
const look = () => {
|
|
41
|
-
const
|
|
42
|
-
return { shut:
|
|
43
|
-
json: /pmos-report|"kind"/.test((document.querySelector('#
|
|
44
|
-
tabs: [
|
|
45
|
-
secs: pane ? pane.
|
|
45
|
+
const vw = document.querySelector('#czViewer:not([hidden])'), pane = vw ? vw.querySelector('.vz[data-vw^="report:"]') : null;
|
|
46
|
+
return { shut: !pane, layer: false, chip: (document.querySelector('#hmLog [data-report-open]') || {}).textContent || null,
|
|
47
|
+
json: /pmos-report|"kind"/.test((document.querySelector('#hmLog') || {}).textContent || ''), user: [...document.querySelectorAll('#hmLog .hm-u .hm-bub')].map((u) => u.textContent.trim()),
|
|
48
|
+
tabs: pane ? [(vw.querySelector('.cz-vw-kind') || {}).textContent || ''] : [], pane: pane ? pane.textContent.replace(/\s+/g, ' ').trim() : null,
|
|
49
|
+
secs: pane ? (pane.querySelector('.vz-dkt') ? pane.querySelectorAll('.vz-dkt button').length - 1 : pane.querySelectorAll('.vz-secs li').length) : 0,
|
|
50
|
+
slide: pane && pane.querySelector('.vz-dkn > span') ? pane.querySelector('.vz-dkn > span').textContent : null,
|
|
51
|
+
sched: pane && pane.querySelector('[data-rt="sched"] b') ? pane.querySelector('[data-rt="sched"] b').textContent : null,
|
|
46
52
|
wide: document.documentElement.scrollWidth > innerWidth + 1 };
|
|
47
53
|
};
|
|
48
54
|
|
|
@@ -62,10 +68,8 @@ const look = () => {
|
|
|
62
68
|
const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
|
|
63
69
|
await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-rep', goal: null } }));
|
|
64
70
|
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
|
-
|
|
67
|
-
if (width < 1000) { await until(() => p.evaluate(() => !!document.querySelector('#hChat'))); if (!(await p.evaluate(() => document.querySelector('#dlg').classList.contains('on')))) await p.click('#hChat'); }
|
|
68
|
-
await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream #thr')));
|
|
71
|
+
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
|
|
72
|
+
await until(() => p.evaluate(() => !!document.querySelector('#hmLog [data-report-open]')));
|
|
69
73
|
await sleep(500);
|
|
70
74
|
return { p, ctx, errs, st };
|
|
71
75
|
};
|
|
@@ -74,32 +78,47 @@ const look = () => {
|
|
|
74
78
|
const s0 = await p.evaluate(look);
|
|
75
79
|
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));
|
|
76
80
|
ok('R1 opening the chat opens no tab by itself', s0.tabs.length === 0, JSON.stringify(s0));
|
|
77
|
-
await p.click('#
|
|
81
|
+
await p.click('#hmLog [data-report-open]');
|
|
78
82
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane ? v : null; }) || await p.evaluate(look);
|
|
79
|
-
ok('R3 the
|
|
80
|
-
&& s1.secs === 7 && s1.sched === 'Off · runs once' && /Set it up/.test(s1.pane || ''), JSON.stringify(s1));
|
|
83
|
+
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 || '') && /Read byGrowth leads/.test(s1.pane || '') && /FormatGoogle Slides/.test(s1.pane || '') && !/Waiting for design/.test(s1.pane || '')
|
|
84
|
+
&& 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));
|
|
85
|
+
await p.click('#czViewer [data-rt="sl|1"]');
|
|
86
|
+
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')));
|
|
81
87
|
if (shots) await p.screenshot({ path: `${shots}/new-1280-light.png` });
|
|
82
|
-
await p.click('#
|
|
83
|
-
await p.click('#
|
|
88
|
+
await p.click('#czViewer [data-rt="sched"]');
|
|
89
|
+
await p.click('#czViewer [data-rt="pick|2"]');
|
|
84
90
|
const s2 = await until(async () => { const v = await p.evaluate(look); return v.sched && /Weekly/.test(v.sched) ? v : null; }) || await p.evaluate(look);
|
|
85
91
|
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));
|
|
86
|
-
await p.click('#
|
|
87
|
-
await p.click('#
|
|
88
|
-
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);
|
|
92
|
+
await p.click('#czViewer [data-rt="sched"]'); await p.click('#czViewer [data-rt="pick|0"]');
|
|
93
|
+
await p.click('#czViewer [data-rt="setup"]');
|
|
94
|
+
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);
|
|
89
95
|
const L = ledger(), setup = L.find((l) => l.ev === 'setup');
|
|
90
|
-
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.
|
|
96
|
+
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)]));
|
|
91
97
|
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));
|
|
92
98
|
if (shots) await p.screenshot({ path: `${shots}/template-1280-light.png` });
|
|
93
|
-
await p.click('#
|
|
99
|
+
await p.click('#czViewer [data-rt="sched"]'); await p.click('#czViewer [data-rt="pick|3"]');
|
|
94
100
|
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);
|
|
95
101
|
const changed = RS.fold(ledger()).setups.get(setup && setup.id);
|
|
96
102
|
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]));
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
/* R8 the look conversation's card (canvas RpDesign): D1 is the saved look, D2 a new one; Design previews D2 beside the current look */
|
|
104
|
+
const RDS = require('./lib/report-design.js');
|
|
105
|
+
const look1 = '<style>.pmos-slide{background:#fff}</style><section class="pmos-slide" data-title="Headline"><h2>Light, long</h2></section>';
|
|
106
|
+
const look2 = '<style>.pmos-slide{background:#14213D;color:#F3F5F9}</style><section class="pmos-slide" data-title="Headline"><h2>Dark, short</h2></section>';
|
|
107
|
+
const v1 = RDS.writeVersion(F.team, setup.id, look1, { turn: 'Light, long' }), v2 = RDS.writeVersion(F.team, setup.id, look2, { turn: 'Like the Sept leadership deck' });
|
|
108
|
+
RDS.append(F.team, setup.id, { ev: 'accept', n: 1, rules: { same: ['Dark slides'], changes: [], learned: [] } });
|
|
109
|
+
await p.click('#czViewer [data-rt="view|design"]');
|
|
110
|
+
const d1 = await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer .vz[data-vw^="report:"]'); return v && /Previewing new look/.test(v.textContent) ? { t: v.textContent, pair: v.querySelectorAll('.rp-pair .rp-thumb').length, use: !!v.querySelector('[data-rt="d-accept"]'), keep: !!v.querySelector('[data-rt="d-keep"]') } : null; }), 10000);
|
|
111
|
+
ok('R8 Design is the look conversation (RpDesign): Previewing new look, Current beside New look, Use it and Keep current', v1.ok && v2.ok && d1 && d1.pair === 2 && d1.use && d1.keep && /New look/.test(d1.t) && /Current/.test(d1.t), JSON.stringify(d1));
|
|
112
|
+
if (shots) await p.screenshot({ path: `${shots}/design-1280-light.png` });
|
|
113
|
+
await p.click('#czViewer [data-rt="d-accept"]');
|
|
114
|
+
ok('R8 Use it saves the new look; the card says the next cycle follows it', await until(() => p.evaluate(() => /Using the new look \(D2\)/.test((document.querySelector('#czViewer .vz[data-vw^="report:"]') || {}).textContent || '') && /Saved look/.test(document.querySelector('#czViewer .vz[data-vw^="report:"]').textContent)), 10000) && (RDS.fold(RDS.readEvents(F.team, setup.id)).saved || {}).version === 2, await p.evaluate(() => ((document.querySelector('#czViewer .vz[data-vw^="report:"]') || {}).textContent || '').slice(0, 600)));
|
|
115
|
+
await p.click('#czViewer [data-rt="view|structure"]');
|
|
116
|
+
await p.click('#czViewer [data-rt^="discard|"]');
|
|
117
|
+
await p.click('#czViewer [data-rt="askyes"]');
|
|
99
118
|
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);
|
|
100
119
|
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));
|
|
101
|
-
await p.click('#
|
|
102
|
-
await p.click('#
|
|
120
|
+
await p.click('#czViewer [data-rt="remove"]');
|
|
121
|
+
await p.click('#czViewer [data-rt="askyes"]');
|
|
103
122
|
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);
|
|
104
123
|
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));
|
|
105
124
|
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' } }) }];
|
|
@@ -111,10 +130,9 @@ const look = () => {
|
|
|
111
130
|
for (const scheme of ['light', 'dark']) {
|
|
112
131
|
const { p, ctx, errs } = await open(390, scheme, [ASK, ANSWER]);
|
|
113
132
|
if (shots) await p.screenshot({ path: `${shots}/chip-390-${scheme}.png` });
|
|
114
|
-
await p.click('#
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
const shown = () => p.evaluate(() => getComputedStyle(document.querySelector('#dOut')).display !== 'none' && document.querySelector('#dGrid').dataset.tab !== 'chat');
|
|
133
|
+
await p.click('#hmLog [data-report-open]');
|
|
134
|
+
// premium-agreed-design: on a phone the chat is the page, and the Viewer card covers the whole screen with the Report in it
|
|
135
|
+
const shown = () => p.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); return !!v && v.getBoundingClientRect().width >= innerWidth - 1; });
|
|
118
136
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && await shown() ? v : null; }) || await p.evaluate(look);
|
|
119
137
|
s1.detail = await shown();
|
|
120
138
|
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));
|
|
@@ -124,7 +142,7 @@ const look = () => {
|
|
|
124
142
|
}
|
|
125
143
|
if (shots) {
|
|
126
144
|
const { p, ctx } = await open(1280, 'dark', [ASK, ANSWER]);
|
|
127
|
-
await p.click('#
|
|
145
|
+
await p.click('#hmLog [data-report-open]'); await sleep(500);
|
|
128
146
|
await p.screenshot({ path: `${shots}/new-1280-dark.png` });
|
|
129
147
|
await ctx.close();
|
|
130
148
|
}
|
|
@@ -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,31 +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); // premium-agreed-design
|
|
47
|
-
|
|
48
|
-
await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream')));
|
|
49
|
-
// the Chat page draws a conversation once it has a key: give it one, as a press on a list row does
|
|
50
|
-
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')));
|
|
51
51
|
return { p, ctx, errs };
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
{ const { p, ctx, errs } = await open({ session: 'sess-7' });
|
|
55
55
|
const i = await until(async () => { const v = await p.evaluate(icon); return v && v.shown ? v : null; }) || await p.evaluate(icon);
|
|
56
|
-
ok('O1 a running session shows the terminal
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
ok('O1 pressing it opens the console
|
|
62
|
-
|
|
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]));
|
|
63
63
|
if (shots) await p.screenshot({ path: `${shots}/term-1280-light.png` });
|
|
64
64
|
ok('O1 no error on the page', !errs.length, errs.join(' | '));
|
|
65
65
|
await ctx.close();
|
|
66
66
|
}
|
|
67
67
|
{ const { p, ctx } = await open({ session: null, resume: CMD }, 390, 'dark');
|
|
68
68
|
const i = await until(async () => { const v = await p.evaluate(icon); return v && v.shown ? v : null; }) || await p.evaluate(icon);
|
|
69
|
-
ok('O2 an ended chat
|
|
70
|
-
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);
|
|
71
71
|
const clip = await until(() => p.evaluate(() => navigator.clipboard.readText()));
|
|
72
72
|
const t = await p.evaluate(() => document.querySelector('#toast').textContent);
|
|
73
73
|
ok('O2 pressing it copies cd to the folder and claude --resume, and says so', clip === CMD && /Copied/.test(t), clip + ' | ' + t);
|
|
@@ -1,15 +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
|
-
* Since premium-agreed-design
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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
|
|
10
12
|
* V4 in a full-screen dialog on another page, a folded viewer unfolds when something opens in it
|
|
11
|
-
* V5 at 390
|
|
12
|
-
* 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
|
|
13
15
|
* Set CHAT_VIEWER_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
|
|
14
16
|
const { findBrowser } = require('./lib/find-browser');
|
|
15
17
|
require('./test-run').configure({ name: 'premium-chat-viewer' });
|
|
@@ -30,19 +32,16 @@ const finish = async (code) => {
|
|
|
30
32
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
31
33
|
|
|
32
34
|
const MD = '# Sign-up drop\n\nThe **sign-up** rate fell from 41% to 38%.\n';
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
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>');
|
|
36
|
-
};
|
|
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' }];
|
|
37
37
|
/* the page's own state */
|
|
38
38
|
const look = () => {
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
return { list:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
railOff: getComputedStyle(document.querySelector('.rail')).opacity === '0', wide: document.documentElement.scrollWidth > innerWidth + 1 };
|
|
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 };
|
|
46
45
|
};
|
|
47
46
|
|
|
48
47
|
(async () => {
|
|
@@ -59,72 +58,74 @@ const look = () => {
|
|
|
59
58
|
const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
|
|
60
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 } }); });
|
|
61
60
|
await p.route('**/api/doc?**', (r) => r.fulfill({ contentType: 'text/plain', headers: { 'X-Doc-Kind': 'markdown' }, body: MD }));
|
|
62
|
-
await p.
|
|
63
|
-
|
|
64
|
-
await
|
|
65
|
-
await p.evaluate(
|
|
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);
|
|
66
66
|
return { p, ctx, errs };
|
|
67
67
|
};
|
|
68
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"]');
|
|
69
70
|
|
|
70
71
|
{ const { p, ctx, errs } = await open(1280);
|
|
71
72
|
const s0 = await p.evaluate(look);
|
|
72
|
-
ok('V1 at 1280 /premium-chat.html opens Home with the
|
|
73
|
-
await p.click('.fpath >> nth=0');
|
|
74
|
-
const s1 = await until(async () => { const v = await p.evaluate(look); return !v.shut && v.
|
|
75
|
-
ok('V1 a file press opens the
|
|
76
|
-
ok('V2 the
|
|
77
|
-
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);
|
|
78
79
|
const s2 = await until(async () => { const v = await p.evaluate(look); return v.shut ? v : null; }) || await p.evaluate(look);
|
|
79
|
-
ok('V1 closing the
|
|
80
|
-
await p.click('.fpath >> nth=0'); await p.click('.fpath >> nth=1'); await sleep(300);
|
|
81
|
-
await p.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
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');
|
|
85
88
|
const s4 = await until(async () => { const v = await p.evaluate(look); return !v.shut ? v : null; }) || await p.evaluate(look);
|
|
86
|
-
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));
|
|
87
90
|
if (shots) await p.screenshot({ path: `${shots}/chat-viewer-1280-light.png` });
|
|
88
91
|
await many(p); await sleep(400);
|
|
89
92
|
const s5 = await p.evaluate(look);
|
|
90
|
-
ok('V6
|
|
91
|
-
await p.click('#vTabs .vmore'); await sleep(200);
|
|
92
|
-
const items = await p.evaluate(() => [...document.querySelectorAll('#vMore [data-vw]')].map((b) => b.dataset.vw));
|
|
93
|
-
await p.click('#vMore [data-vw] >> nth=0'); await sleep(200);
|
|
94
|
-
const on = await p.evaluate(() => (document.querySelector('#vTabs .vtab[aria-selected="true"]') || {}).dataset.vw);
|
|
95
|
-
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));
|
|
96
94
|
ok('F1 no page error and no sideways scroll', !errs.length && !s5.wide, errs.join(' | '));
|
|
97
95
|
await ctx.close(); }
|
|
98
96
|
|
|
99
97
|
for (const scheme of ['light', 'dark']) {
|
|
100
98
|
const { p, ctx, errs } = await open(390, scheme);
|
|
101
99
|
const s0 = await p.evaluate(look);
|
|
102
|
-
ok(`V5 (${scheme}) at 390 the chat
|
|
103
|
-
await p.click('.fpath >> nth=0');
|
|
104
|
-
const s1 = await until(async () => { const v = await p.evaluate(look); return v.
|
|
105
|
-
ok(`V5 (${scheme}) a file press
|
|
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));
|
|
106
104
|
if (shots) await p.screenshot({ path: `${shots}/chat-viewer-390-${scheme}.png` });
|
|
107
|
-
await p
|
|
108
|
-
const s2 = await until(async () => { const v = await p.evaluate(look); return v.
|
|
109
|
-
ok(`V5 (${scheme}) the
|
|
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);
|
|
110
110
|
await p.keyboard.press('Escape');
|
|
111
|
-
const s3 = await until(async () => { const v = await p.evaluate(look); return
|
|
112
|
-
ok(`V5 (${scheme}) Escape closes the
|
|
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));
|
|
113
113
|
ok(`F1 (${scheme}) no page error and no sideways scroll at 390`, !errs.length && !s3.wide, errs.join(' | '));
|
|
114
114
|
await ctx.close();
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
{ const ctx = await browser.newContext({ viewport: { width: 1280, height: 800 } }); const p = await ctx.newPage();
|
|
118
118
|
await p.addInitScript(() => { try { localStorage.setItem('pmos.srl.view', 'min'); } catch { /* none */ } });
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
await p.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
await
|
|
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' }));
|
|
125
126
|
await sleep(200);
|
|
126
|
-
const after = await p.evaluate(
|
|
127
|
-
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));
|
|
128
129
|
await ctx.close(); }
|
|
129
130
|
|
|
130
131
|
return finish();
|