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,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
/* premium-chat-attach-test.js — files and photos on a premium chat message (initiative premium-chat-attach
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
/* premium-chat-attach-test.js — files and photos on a premium chat message (initiative premium-chat-attach; re-pointed by premium-agreed-design
|
|
4
|
+
* to Home's chat: /premium-chat.html opens Home with the chat ?about names, and the composer's + picks files directly — the old + menu is gone;
|
|
5
|
+
* / is typed in the box and Notes lives in More). Serves the real Home from the real server; files save through the real /api/chat-file in a
|
|
6
|
+
* scratch state folder.
|
|
7
|
+
* B1 the + in the composer · B2 a typed / shows the commands · B3 pick two files, chips, saved · B4 remove one · B5 paste and drop
|
|
8
|
+
* B6 send names the files · B7 the PM's bubble shows the files and a chip opens the photo in the Viewer · B8 no key, no + · B9 phone */
|
|
7
9
|
const fs = require('fs');
|
|
8
10
|
const path = require('path');
|
|
9
11
|
const { spawn } = require('child_process');
|
|
10
12
|
const { findBrowser } = require('./lib/find-browser');
|
|
11
13
|
const T = require('./test-run').configure({ name: 'premium-chat-attach' });
|
|
12
|
-
const WP = require('./lib/my-work-premium.js');
|
|
13
|
-
const F = require('./fixtures/my-work-premium-facts.js');
|
|
14
14
|
|
|
15
15
|
const BASE = T.BASE;
|
|
16
16
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
@@ -42,73 +42,66 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
|
|
|
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
|
-
const open = async ({ w = 1280, h = 900, scheme = 'light' } = {}) => {
|
|
48
|
-
const ctx = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: scheme });
|
|
46
|
+
const open = async ({ w = 1280, h = 900, scheme = 'light', url = '/premium-chat.html?about=' + encodeURIComponent(KEY) } = {}) => {
|
|
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
|
-
|
|
53
|
-
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 }) }); });
|
|
54
|
-
await page.
|
|
55
|
-
await page.
|
|
56
|
-
|
|
51
|
+
if (process.env.ATT_DEBUG) page.on('request', (rq) => { if (/chat-file/.test(rq.url())) console.log('REQ', rq.method(), rq.url()); });
|
|
52
|
+
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 } : {}) }) }); });
|
|
53
|
+
await page.route('**/api/sessions/conversation**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'user', messages: st.messages } }));
|
|
54
|
+
await page.route('**/api/sessions', (r) => r.fulfill({ json: { ok: true, sessions: [{ id: 's-term', name: 'A terminal session', origin: '', shown: 'quiet' }] } }));
|
|
55
|
+
await page.goto(BASE + url, { waitUntil: 'domcontentloaded' });
|
|
56
|
+
await page.waitForFunction(() => !!document.querySelector('#hmIn'), null, { timeout: 15000 });
|
|
57
|
+
return { page, ctx, errors, asks, st };
|
|
57
58
|
};
|
|
58
|
-
const
|
|
59
|
-
const close = (page) => page.evaluate(async () => { const m = await import('/pm/premium-shell.js'); m.closeDlg(); });
|
|
60
|
-
const chips = (page) => page.$$eval('#attRow .atc', (xs) => xs.map((x) => ({ name: x.querySelector('b').textContent, meta: (x.querySelector('em') || {}).textContent || '' })));
|
|
59
|
+
const chips = (page) => page.$$eval('#hmFiles .hm-att', (xs) => xs.map((x) => ({ name: x.querySelector('b').textContent, meta: (x.querySelector('em') || {}).textContent || '' })));
|
|
61
60
|
|
|
62
|
-
let { page, ctx, errors, asks } = await open();
|
|
63
|
-
await dlg(page, KEY);
|
|
61
|
+
let { page, ctx, errors, asks, st } = await open();
|
|
64
62
|
/* B1 */
|
|
65
|
-
|
|
66
|
-
ok('B1 the
|
|
67
|
-
|
|
68
|
-
ok('B1
|
|
69
|
-
ok('B1 the menu names Add files or photos, Slash commands and Notes', /Add files or photos[\s\S]*Slash commands[\s\S]*Notes/.test(await page.textContent('#plusM')));
|
|
70
|
-
await shot(page, 'menu-1280-light');
|
|
71
|
-
await page.keyboard.press('Escape');
|
|
72
|
-
ok('B1 Escape closes the menu and leaves the dialog open', await page.isHidden('#plusM') && await page.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
|
|
63
|
+
// the + opens the box's menu (Agreed design: "+ / @ chip"); its first item is Attach a file, which picks through #hmFile
|
|
64
|
+
ok('B1 the + is in the composer of a chat with a key, and its menu attaches a file', await page.isVisible('#hmAdd') && await page.evaluate(() => !!document.querySelector('#hmFoot .hm-addw input[type=file]#hmFile'))
|
|
65
|
+
&& await (async () => { await page.click('#hmAdd'); const v = await page.isVisible('#hmFoot [data-hm-file]'); await page.keyboard.press('Escape'); return v; })());
|
|
66
|
+
ok('B1 no chip row shows before a file is picked', (await page.$('#hmFiles')) === null);
|
|
73
67
|
/* B2 */
|
|
74
|
-
await page.
|
|
75
|
-
ok('B2
|
|
76
|
-
await page.
|
|
77
|
-
await page.
|
|
78
|
-
ok('B2 Notes opens the notepad in the viewer', !!(await until(async () => page.isVisible('#ntEd'))));
|
|
68
|
+
await page.fill('#hmIn', '/');
|
|
69
|
+
ok('B2 a typed / shows the commands', !!(await until(async () => page.isVisible('#hmSlash'))));
|
|
70
|
+
await page.keyboard.press('Escape');
|
|
71
|
+
await page.fill('#hmIn', '');
|
|
79
72
|
/* B3 */
|
|
80
|
-
await page.setInputFiles('#
|
|
73
|
+
await page.setInputFiles('#hmFile', [{ name: 'Screenshot 1.41.39 PM.png', mimeType: 'image/png', buffer: PNG }, { name: 'Q4 roadmap.pdf', mimeType: 'application/pdf', buffer: Buffer.from('%PDF-1.4 test') }]);
|
|
81
74
|
ok('B3 two picked files show as two chips with their sizes once saved', !!(await until(async () => { const c = await chips(page); return c.length === 2 && c.every((x) => /KB/.test(x.meta)); })), JSON.stringify(await chips(page)));
|
|
82
|
-
ok('B3 a photo chip shows the picture', await page.evaluate(() => { const i = document.querySelector('#
|
|
75
|
+
ok('B3 a photo chip shows the picture', await page.evaluate(() => { const i = document.querySelector('#hmFiles img.hm-ath'); return !!i && i.complete && i.naturalWidth === 2; }));
|
|
83
76
|
ok('B3 both files are saved in the state folder, never under the key', filesIn().length === 2 && filesIn().some((f) => /-Screenshot-1.41.39-PM\.png$/.test(f)));
|
|
84
77
|
await shot(page, 'chips-1280-light');
|
|
85
78
|
/* B4 */
|
|
86
|
-
await page.click('#
|
|
79
|
+
await page.click('#hmFiles .hm-att:nth-child(2) [data-hm-unfile]');
|
|
87
80
|
ok('B4 × removes the chip and deletes the file not sent', (await chips(page)).length === 1 && !!(await until(async () => filesIn().length === 1)));
|
|
88
81
|
/* B5 */
|
|
89
|
-
await page.evaluate(() => { const dt = new DataTransfer(); dt.items.add(new File(['note text'], 'notes.txt', { type: 'text/plain' })); const e = new ClipboardEvent('paste', { clipboardData: dt, bubbles: true, cancelable: true }); document.querySelector('#
|
|
82
|
+
await page.evaluate(() => { const dt = new DataTransfer(); dt.items.add(new File(['note text'], 'notes.txt', { type: 'text/plain' })); const e = new ClipboardEvent('paste', { clipboardData: dt, bubbles: true, cancelable: true }); document.querySelector('#hmIn').dispatchEvent(e); });
|
|
90
83
|
ok('B5 a pasted file is attached', !!(await until(async () => { const c = await chips(page); return c.length === 2 && c[1].name === 'notes.txt' && /KB/.test(c[1].meta); })));
|
|
91
|
-
ok('B5 the paste put no text in the box', (await page.inputValue('#
|
|
92
|
-
await page.evaluate(() => { const dt = new DataTransfer(); dt.items.add(new File(['x'], 'dropped.csv', { type: 'text/csv' })); const b = document.querySelector('#
|
|
84
|
+
ok('B5 the paste put no text in the box', (await page.inputValue('#hmIn')) === '');
|
|
85
|
+
await page.evaluate(() => { const dt = new DataTransfer(); dt.items.add(new File(['x'], 'dropped.csv', { type: 'text/csv' })); const b = document.querySelector('#hmLog'); b.dispatchEvent(new DragEvent('dragover', { dataTransfer: dt, bubbles: true, cancelable: true })); b.dispatchEvent(new DragEvent('drop', { dataTransfer: dt, bubbles: true, cancelable: true })); });
|
|
93
86
|
ok('B5 a file dropped on the conversation is attached', !!(await until(async () => (await chips(page)).length === 3)));
|
|
94
|
-
ok('B5 the drop outline goes away after the drop', !(await page.evaluate(() => document.querySelector('#
|
|
87
|
+
ok('B5 the drop outline goes away after the drop', !(await page.evaluate(() => document.querySelector('#hmChat').classList.contains('hm-drop'))));
|
|
95
88
|
/* B6 */
|
|
96
|
-
await page.fill('#
|
|
97
|
-
await page.
|
|
98
|
-
const ask = await until(async () => asks.find((a) => a.path.endsWith('/ask')));
|
|
89
|
+
await page.fill('#hmIn', 'Where is this on PMOS?');
|
|
90
|
+
await page.keyboard.press('Enter');
|
|
91
|
+
const ask = await until(async () => asks.find((a) => a.path.endsWith('/ask')), 12000);
|
|
99
92
|
ok('B6 send passes the words and the three saved names', !!ask && ask.body.text === 'Where is this on PMOS?' && Array.isArray(ask.body.files) && ask.body.files.length === 3 && ask.body.files.every((n) => filesIn().includes(n)), JSON.stringify(ask && ask.body));
|
|
100
|
-
ok('B6 after the send the chips go', !!(await until(async () => await page
|
|
93
|
+
ok('B6 after the send the chips go', !!(await until(async () => (await page.$('#hmFiles')) === null)));
|
|
101
94
|
// the real ask route turns the names into the closing line (no session here: the route answers, the line is checked through the store)
|
|
102
95
|
const lib = require('./lib/chat-files.js');
|
|
103
|
-
const paths = lib.pathsOf({ runtimeDir: T.STATE_DIR, key: KEY, names: ask.body.files });
|
|
104
|
-
ok('B6 the names resolve to the files of this conversation', paths.ok && paths.paths.length === 3);
|
|
96
|
+
const paths = lib.pathsOf({ runtimeDir: T.STATE_DIR, key: KEY, names: ask ? ask.body.files : [] });
|
|
97
|
+
ok('B6 the names resolve to the files of this conversation', paths.ok && paths.paths.length === 3, JSON.stringify(paths));
|
|
105
98
|
/* B7 */
|
|
106
|
-
|
|
107
|
-
await page.evaluate(
|
|
108
|
-
ok('B7 the PM\'s bubble shows the files as chips and the words, not the line',
|
|
99
|
+
st.messages = [{ role: 'user', text: lib.withFiles('Where is this on PMOS?', paths.paths), at: '2026-10-21T08:00:00Z' }]; st.session = 's-att';
|
|
100
|
+
const bub = await until(async () => page.evaluate(() => { const u = [...document.querySelectorAll('#hmLog .hm-u')].pop(); return u && u.querySelectorAll('.atc[data-att]').length === 3 ? u.textContent : null; }), 12000);
|
|
101
|
+
ok('B7 the PM\'s bubble shows the files as chips and the words, not the line', !!bub && /Where is this on PMOS\?/.test(bub) && !/Attached files/.test(bub), String(bub));
|
|
109
102
|
await shot(page, 'bubble-1280-light');
|
|
110
|
-
await page.click('#
|
|
111
|
-
ok('B7 a photo chip opens the picture in the
|
|
103
|
+
await page.click('#hmLog .hm-u .atc[data-att$=".png"]');
|
|
104
|
+
ok('B7 a photo chip opens the picture in the Viewer', !!(await until(async () => page.evaluate(() => { const i = document.querySelector('#czViewer:not([hidden]) img.atview'); return !!i && i.complete && i.naturalWidth === 2; }))));
|
|
112
105
|
await shot(page, 'viewer-1280-light');
|
|
113
106
|
const png = paths.paths.find((p) => p.endsWith('.png')), txt = paths.paths.find((p) => p.endsWith('.txt'));
|
|
114
107
|
const r1 = await fetch(BASE + '/api/chat-file?path=' + encodeURIComponent(png));
|
|
@@ -119,26 +112,24 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
|
|
|
119
112
|
ok('B7 a path outside the attachments is refused', r3.status === 404);
|
|
120
113
|
const r4 = await fetch(BASE + '/api/chat-file?key=' + encodeURIComponent(KEY) + '&name=x.png', { method: 'POST', body: PNG });
|
|
121
114
|
ok('B7 a save that does not come from the page is refused', r4.status === 403);
|
|
122
|
-
|
|
115
|
+
ok('B1-B7 no page errors', errors.length === 0, errors.join(' | '));
|
|
116
|
+
await ctx.close();
|
|
123
117
|
/* B8 */
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
await
|
|
127
|
-
ok('
|
|
118
|
+
({ page, ctx, errors } = await open({ url: '/premium.html?session=s-term' }));
|
|
119
|
+
await until(async () => page.evaluate(() => /A terminal session/.test((document.querySelector('#hmChat') || {}).textContent || '')), 6000);
|
|
120
|
+
ok('B8 a terminal session with no conversation key cannot attach: no Attach a file and no file picker', (await page.$('#hmFoot [data-hm-file]')) === null && (await page.$('#hmFile')) === null);
|
|
121
|
+
ok('B8 no page errors', errors.length === 0, errors.join(' | '));
|
|
128
122
|
await ctx.close();
|
|
129
123
|
|
|
130
124
|
/* B9 phone, both themes */
|
|
131
125
|
for (const scheme of ['light', 'dark']) {
|
|
132
126
|
({ page, ctx, errors } = await open({ w: 390, h: 844, scheme }));
|
|
133
|
-
await
|
|
134
|
-
const h0 = await page.evaluate(() => document.querySelector('#askF').getBoundingClientRect().height);
|
|
135
|
-
await page.setInputFiles('#askFile', [{ name: 'IMG_2041.png', mimeType: 'image/png', buffer: PNG }, { name: 'a-rather-long-file-name-for-a-phone.pdf', mimeType: 'application/pdf', buffer: Buffer.from('%PDF') }, { name: 'third.png', mimeType: 'image/png', buffer: PNG }]);
|
|
127
|
+
await page.setInputFiles('#hmFile', [{ name: 'IMG_2041.png', mimeType: 'image/png', buffer: PNG }, { name: 'a-rather-long-file-name-for-a-phone.pdf', mimeType: 'application/pdf', buffer: Buffer.from('%PDF') }, { name: 'third.png', mimeType: 'image/png', buffer: PNG }]);
|
|
136
128
|
await until(async () => (await chips(page)).length === 3 && (await chips(page)).every((x) => /KB/.test(x.meta)));
|
|
137
129
|
await shot(page, 'chips-390-' + scheme);
|
|
138
|
-
ok(`B9 ${scheme}: on a phone the +, the box and the chips stay inside the width`, await page.evaluate(() => { const w = innerWidth; return ['#
|
|
139
|
-
ok(`B9 ${scheme}: the chips sit in one row
|
|
140
|
-
ok(`B9 ${scheme}: the + and × are 44px targets`, await page.evaluate(() => document.querySelector('#
|
|
141
|
-
await page.click('#askPlus'); await shot(page, 'menu-390-' + scheme);
|
|
130
|
+
ok(`B9 ${scheme}: on a phone the +, the box and the chips stay inside the width`, await page.evaluate(() => { const w = innerWidth; return ['#hmAdd', '#hmIn', '#hmFiles'].every((s) => { const r = document.querySelector(s).getBoundingClientRect(); return r.width > 0 && r.left >= 0 && r.right <= w + 1; }) && document.documentElement.scrollWidth <= w; }));
|
|
131
|
+
ok(`B9 ${scheme}: the chips sit in one row`, await page.evaluate(() => new Set([...document.querySelectorAll('#hmFiles .hm-att')].map((x) => Math.round(x.getBoundingClientRect().top))).size === 1));
|
|
132
|
+
ok(`B9 ${scheme}: the + and × are 44px targets`, await page.evaluate(() => document.querySelector('#hmAdd').getBoundingClientRect().height >= 44 && document.querySelector('[data-hm-unfile]').getBoundingClientRect().height >= 44));
|
|
142
133
|
ok(`B9 ${scheme}: no page errors`, errors.length === 0, errors.join(' | '));
|
|
143
134
|
await ctx.close();
|
|
144
135
|
}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* C1 a chart block is a chip; it opens the Chart tab with the measure drawn from its readings, as proposed (bars)
|
|
7
7
|
* C2 a form pick redraws the chart and writes nothing; Save chart saves it with the picked form; Delete chart asks once and removes it
|
|
8
8
|
* C3 a dashboard block draws its charts in order and names a measure with no series; Save dashboard saves it
|
|
9
|
-
* I1 Insights has no Studio:
|
|
9
|
+
* I1 Insights has no Studio: Ask why opens Home's chat about Insights with the question in the box, not sent (Insights was rebuilt; its
|
|
10
|
+
* dashboards are edited on Insights itself)
|
|
10
11
|
* F1 no page error and no sideways scroll at 1280 and 390
|
|
11
12
|
* Set CHART_TAB_SHOTS=<dir> to save the page at 1280 and 390. */
|
|
12
13
|
const fs = require('fs');
|
|
@@ -53,12 +54,17 @@ const ASK = (t) => ({ role: 'user', text: '[PMOS report] rule\n\nThe PM says: '
|
|
|
53
54
|
const CHART = { kind: 'chart', proposal: { measure: 'krm-a', title: 'Partners activating', question: 'Are partners activating?', form: 'bars', range: null, target: 50, better: 'higher', note: '' } };
|
|
54
55
|
const DASH = { kind: 'dashboard', proposal: { name: 'Partner growth', purpose: 'The Monday partner review', charts: ['krm-a', 'krm-t', 'krm-l'] } };
|
|
55
56
|
|
|
57
|
+
/* premium-agreed-design: Home's chat (home-chat.js) draws the chip; a chart or dashboard opens in the Viewer card (cozy-viewer.js), whose kind line names it.
|
|
58
|
+
* A chart is the design's metrics view (Main.dc.html viewer "metrics": stat tiles, then the readings with the newest in ember); its forms, Save and
|
|
59
|
+
* Delete are its setup block, and a confirm asks in the card ([data-ct="askyes"]). */
|
|
56
60
|
const look = () => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
const vw = document.querySelector('#czViewer:not([hidden])');
|
|
62
|
+
const pane = vw ? vw.querySelector('.vz[data-vw^="chart:"], .vz[data-vw^="dashboard:"]') : null;
|
|
63
|
+
return { chip: (document.querySelector('#hmLog [data-report-open]') || {}).textContent || null, tabs: vw ? [(vw.querySelector('.cz-vw-kind') || {}).textContent || ''] : [], title: vw ? (vw.querySelector('.cz-vw-title') || {}).textContent || '' : '',
|
|
64
|
+
pane: pane ? pane.textContent.replace(/\s+/g, ' ').trim() : null, tiles: pane ? [...pane.querySelectorAll('.vz-mx-fig, .vz-mx-tile')].map((t) => t.className + ' ' + (t.dataset.form || '')) : [],
|
|
65
|
+
kpis: pane ? pane.querySelectorAll('.vz-kpi').length : 0, ember: pane ? pane.querySelectorAll('.vz-mx-fig .vz-bar.now').length : 0,
|
|
66
|
+
bars: pane ? pane.querySelectorAll('.vz-mx-fig .vz-bar').length : 0, form: pane ? ((pane.querySelector('.vz-sg [aria-pressed="true"]') || {}).textContent || null) : null,
|
|
67
|
+
wide: document.documentElement.scrollWidth > innerWidth + 1, say: (document.querySelector('#hmIn') || {}).value || '' };
|
|
62
68
|
};
|
|
63
69
|
|
|
64
70
|
(async () => {
|
|
@@ -76,9 +82,10 @@ const look = () => {
|
|
|
76
82
|
const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
|
|
77
83
|
await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-ch', goal: null } }));
|
|
78
84
|
await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages } }));
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
await
|
|
85
|
+
// premium-agreed-design: /premium-chat.html opens Home, whose chat is docked on a desktop; on a phone the list is the page (premium-uncovered-features
|
|
86
|
+
// HmPhone), so the address names the conversation and it opens as the page (HmPhone2)
|
|
87
|
+
await p.goto(BASE + url + (width < 761 && url === '/premium-chat.html' ? '?about=chat:charts' : ''));
|
|
88
|
+
await until(() => p.evaluate(() => !!document.querySelector('#hmLog [data-report-open]')));
|
|
82
89
|
await sleep(500);
|
|
83
90
|
return { p, ctx, errs };
|
|
84
91
|
};
|
|
@@ -86,62 +93,55 @@ const look = () => {
|
|
|
86
93
|
{ const { p, ctx, errs } = await open(1280, [ASK('chart partner activation as bars'), { role: 'assistant', text: 'Partner activation is at 33%.\n\n' + block(CHART) }]);
|
|
87
94
|
const s0 = await p.evaluate(look);
|
|
88
95
|
ok('C1 the chart block is a chip under Claude\'s words', /Partners activating/.test(s0.chip || '') && /New chart/.test(s0.chip || ''), JSON.stringify(s0));
|
|
89
|
-
await p.click('#
|
|
96
|
+
await p.click('#hmLog [data-report-open]');
|
|
90
97
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && v.tiles.length ? v : null; }) || await p.evaluate(look);
|
|
91
|
-
ok('C1 the Chart
|
|
98
|
+
ok('C1 the Chart view draws the measure from its five readings as bars, as proposed: three stat tiles, the newest bar in ember', s1.tabs.includes('Chart') && /New chart/.test(s1.pane || '') && s1.bars === 5 && s1.form === 'Bars' && s1.kpis === 3 && s1.ember === 1 && !(await p.$('#czViewer .rt, #czViewer .obody, #czViewer .mt1')), JSON.stringify(s1));
|
|
92
99
|
if (shots) await p.screenshot({ path: `${shots}/chart-1280.png` });
|
|
93
|
-
await p.click('#
|
|
100
|
+
await p.click('#czViewer [data-ct="form|line"]');
|
|
94
101
|
const s2 = await until(async () => { const v = await p.evaluate(look); return v.form === 'Line' ? v : null; }) || await p.evaluate(look);
|
|
95
|
-
ok('C2 a form pick redraws the chart and writes nothing', s2.bars === 0 && /
|
|
96
|
-
await p.click('#
|
|
102
|
+
ok('C2 a form pick redraws the chart and writes nothing', s2.bars === 0 && /line/.test(s2.tiles.join()) && PC.list(dir, board).length === 0, JSON.stringify(s2));
|
|
103
|
+
await p.click('#czViewer [data-ct="save"]');
|
|
97
104
|
const s3 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Saved\./.test(v.pane) ? v : null; }) || await p.evaluate(look);
|
|
98
105
|
const saved = PC.list(dir, board);
|
|
99
106
|
ok('C2 Save chart saves it with the picked form; the tab shows it saved', saved.length === 1 && saved[0].form === 'line' && saved[0].measure === 'krm-a' && saved[0].title === 'Partners activating' && /Saved chart/.test(s3.pane || ''), JSON.stringify([saved, s3.pane]));
|
|
100
|
-
await p.click('#
|
|
101
|
-
await p.click('#
|
|
107
|
+
await p.click('#czViewer [data-ct="remove"]');
|
|
108
|
+
await p.click('#czViewer [data-ct="askyes"]');
|
|
102
109
|
const s4 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Deleted\./.test(v.pane) ? v : null; }) || await p.evaluate(look);
|
|
103
110
|
ok('C2 Delete chart asks once, then the chart is removed', /Deleted\./.test(s4.pane || '') && PC.list(dir, board).length === 0, JSON.stringify(s4));
|
|
104
111
|
ok('F1 no page error and no sideways scroll (chart, 1280)', !errs.length && !s4.wide, errs.join(' | '));
|
|
105
112
|
await ctx.close(); }
|
|
106
113
|
|
|
107
114
|
{ const { p, ctx, errs } = await open(1280, [ASK('a dashboard for the partner review'), { role: 'assistant', text: 'Here it is.\n\n' + block(DASH) }]);
|
|
108
|
-
await p.click('#
|
|
115
|
+
await p.click('#hmLog [data-report-open]');
|
|
109
116
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && v.tiles.length ? v : null; }) || await p.evaluate(look);
|
|
110
|
-
ok('C3 the Dashboard tab draws two charts in order and names the measure with no series', s1.tabs.includes('Dashboard') && s1.tiles.length === 2 && /Partner growth/.test(s1.
|
|
117
|
+
ok('C3 the Dashboard tab draws two charts in order and names the measure with no series', s1.tabs.includes('Dashboard') && s1.tiles.length === 2 && /Partner growth/.test(s1.title) && /Lonely/.test(s1.pane || '') && /fewer than two readings/.test(s1.pane || ''), JSON.stringify(s1));
|
|
111
118
|
if (shots) await p.screenshot({ path: `${shots}/dashboard-1280.png` });
|
|
112
|
-
await p.click('#
|
|
119
|
+
await p.click('#czViewer [data-ct="save"]');
|
|
113
120
|
await until(async () => { const v = await p.evaluate(look); return v.pane && /Saved\./.test(v.pane) ? v : null; });
|
|
114
121
|
const D = PD.list(dir, board);
|
|
115
122
|
ok('C3 Save dashboard saves it with its charts in order', D.length === 1 && D[0].name === 'Partner growth' && D[0].charts.join() === 'krm-a,krm-t,krm-l', JSON.stringify(D));
|
|
116
123
|
ok('F1 no page error (dashboard, 1280)', !errs.length, errs.join(' | '));
|
|
117
124
|
await ctx.close(); }
|
|
118
125
|
|
|
126
|
+
/* I1, re-pointed for the rebuilt Insights (premium-agreed-design): Insights has no Studio, and its way into a chat is Ask why, which opens Home's
|
|
127
|
+
* chat about Insights with the question in the box, not sent. Dashboards are edited on Insights itself now (premium-insights.js side panel). */
|
|
119
128
|
{ const ctx = await browser.newContext({ viewport: { width: 1280, height: 860 } }), p = await ctx.newPage(), errs = [];
|
|
120
129
|
p.on('pageerror', (e) => errs.push(String(e)));
|
|
130
|
+
let asked = 0; await p.route('**/api/briefing-premium/ask**', (r) => { asked++; r.fulfill({ json: { ok: true } }); });
|
|
121
131
|
await p.goto(BASE + '/premium-insights.html');
|
|
122
|
-
await until(() => p.evaluate(() =>
|
|
123
|
-
const
|
|
124
|
-
await p.evaluate((
|
|
125
|
-
await
|
|
126
|
-
if (await p.locator('#dashBar').isHidden()) await p.click('#dashMore');
|
|
127
|
-
const hasStudio = await p.evaluate(() => !!document.querySelector('#oMain .stu') || [...document.scripts].some((s) => /premium-studio/.test(s.src)));
|
|
128
|
-
await Promise.all([p.waitForURL(/\/premium\.html\?/), p.click('#pdEdit')]); // premium-agreed-design H3: /premium-chat.html opens Home with its query
|
|
132
|
+
await until(() => p.evaluate(() => /premium\.html\?/.test((document.querySelector('#askWhy') || {}).href || '')));
|
|
133
|
+
const hasStudio = await p.evaluate(() => !!document.querySelector('.stu, #studio') || [...document.scripts].some((s) => /premium-studio/.test(s.src)));
|
|
134
|
+
const href = await p.evaluate(() => document.querySelector('#askWhy').href);
|
|
135
|
+
await Promise.all([p.waitForURL(/\/premium\.html\?/), p.click('#askWhy')]);
|
|
129
136
|
const u1 = new URL(p.url());
|
|
130
|
-
await until(() => p.evaluate(() => [...document.querySelectorAll('#dOut .obody.vw')].some((x) => !x.hidden && /Partner growth/.test(x.textContent))));
|
|
131
|
-
const s1 = await p.evaluate(look);
|
|
132
|
-
ok('I1 Edit on a saved dashboard opens Home\'s chat with its Dashboard tab, saved', !hasStudio && u1.pathname === '/premium.html' && u1.searchParams.get('open') === 'dashboard:' + D.id && /Saved dashboard/.test(s1.pane || ''), JSON.stringify([u1.search, s1.pane]));
|
|
133
|
-
await p.goto(BASE + '/premium-insights.html');
|
|
134
|
-
await until(() => p.evaluate(() => !!document.querySelector('#dashBody .mch')));
|
|
135
|
-
await p.evaluate(() => { const r = document.querySelector('[data-d="all"]'); if (r) r.click(); });
|
|
136
|
-
if (await p.locator('#dashBar').isHidden()) await p.click('#dashMore');
|
|
137
|
-
await Promise.all([p.waitForURL(/\/premium\.html\?/), p.click('#pcNew')]);
|
|
138
137
|
const s2 = await until(async () => { const v = await p.evaluate(look); return v.say ? v : null; }) || await p.evaluate(look);
|
|
139
|
-
ok('I1
|
|
140
|
-
ok('
|
|
138
|
+
ok('I1 Insights has no Studio; Ask why opens Home\'s chat about Insights', !hasStudio && u1.pathname === '/premium.html' && u1.searchParams.get('ask') === 'insights' && /ask=insights/.test(href), JSON.stringify([href, u1.search]));
|
|
139
|
+
ok('I1 the question waits in the box, not sent', /^Why/.test(s2.say) && asked === 0, JSON.stringify([s2.say, asked]));
|
|
140
|
+
ok('F1 no page error (Insights to Home)', !errs.length, errs.join(' | '));
|
|
141
141
|
await ctx.close(); }
|
|
142
142
|
|
|
143
143
|
{ const { p, ctx, errs } = await open(390, [ASK('chart partner activation'), { role: 'assistant', text: 'Here.\n\n' + block(CHART) }]);
|
|
144
|
-
await p.click('#
|
|
144
|
+
await p.click('#hmLog [data-report-open]');
|
|
145
145
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && v.tiles.length ? v : null; }) || await p.evaluate(look);
|
|
146
146
|
ok('C1 at 390 the chip opens the Chart tab over the page', s1.bars === 5, JSON.stringify(s1));
|
|
147
147
|
if (shots) await p.screenshot({ path: `${shots}/chart-390.png` });
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* C3 a Jira chip opens the ticket from the stored Jira reading, with Open in Jira; a key with no reading says so
|
|
9
9
|
* C4 a Slack chip opens a tab with Open in Slack
|
|
10
10
|
* C5 at 390 a new answer shows a bar over the message box instead of covering the conversation; its press opens the file on the Detail tab
|
|
11
|
-
* (since premium-agreed-design /premium-chat.html opens Home
|
|
11
|
+
* (since premium-agreed-design /premium-chat.html opens Home with the chat ?about names; the Viewer is the cozy card #czViewer, and on a
|
|
12
|
+
* phone the chat is the page and the Viewer covers it in place of the old Detail tab)
|
|
12
13
|
* C6 every chip is at least 44 px; no sideways scroll; no page error
|
|
13
14
|
* Set CHAT_CONTEXT_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
|
|
14
15
|
const { findBrowser } = require('./lib/find-browser');
|
|
@@ -59,17 +60,17 @@ const second = (k) => [
|
|
|
59
60
|
await p.route('**/api/jira/ticket**', (r) => r.fulfill({ json: { ok: true, ticket: /SGN-42/.test(r.request().url()) ? { key: 'SGN-42', summary: 'Fix the sign-up form', status: 'In Review', category: 'indeterminate', sprint: { name: 'Sprint 14', state: 'active' }, url: 'https://acme.atlassian.net/browse/SGN-42', fetchedAt: '2026-10-21T07:00:00Z' } : null } }));
|
|
60
61
|
await p.route('**/api/doc/locate**', (r) => { const u = decodeURIComponent(r.request().url()); const rel = (u.match(/path=([^&]+)/) || [])[1] || 'x.md'; r.fulfill({ json: { ok: true, ws: F.ws, rel, name: rel.split('/').pop(), abs: '/x/' + rel, mtime: 1, size: MD.length } }); });
|
|
61
62
|
await p.route('**/api/doc?**', (r) => r.fulfill({ contentType: 'text/plain', headers: { 'X-Doc-Kind': 'markdown' }, body: MD }));
|
|
62
|
-
await p.goto(chat);
|
|
63
|
-
|
|
64
|
-
await until(() => p.evaluate(() => document.querySelectorAll('#dBody .ctxchip').length > 0), 10000);
|
|
63
|
+
await p.goto(chat + '&about=work:ctx-test'); // premium-agreed-design: Home with this chat; on a phone the chat is the page
|
|
64
|
+
await until(() => p.evaluate(() => document.querySelectorAll('#hmLog .ctxchip').length > 0), 10000);
|
|
65
65
|
return { p, ctx, errs, conv };
|
|
66
66
|
};
|
|
67
67
|
const look = () => {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const vw = document.querySelector('#czViewer:not([hidden])'), peek = document.querySelector('#hmPeek');
|
|
69
|
+
const title = vw ? ((vw.querySelector('#czVwTitle') || {}).textContent || '').trim() : '';
|
|
70
|
+
return { tab: vw ? 'out' : 'chat', shut: !vw, layer: false, out: vw ? Math.round(vw.getBoundingClientRect().width) : 0,
|
|
71
|
+
tabs: vw && title ? [title] : [],
|
|
72
|
+
chips: [...document.querySelectorAll('#hmLog .ctxc')].map((c) => [...c.querySelectorAll('.ctxchip')].map((b) => b.dataset.ctx + ':' + b.querySelector('b').textContent + (b.classList.contains('lead') ? '*' : ''))),
|
|
73
|
+
peek: peek && !peek.hidden ? peek.textContent.trim() : null, minH: Math.min(...[...document.querySelectorAll('#hmLog .ctxchip')].map((b) => b.getBoundingClientRect().height)), wide: document.documentElement.scrollWidth > innerWidth + 1 };
|
|
73
74
|
};
|
|
74
75
|
const answer = async (p, conv, k, working) => { conv.messages = [...first(), ...second(k)]; conv.turn = working ? 'agent' : 'user'; };
|
|
75
76
|
|
|
@@ -88,14 +89,14 @@ const second = (k) => [
|
|
|
88
89
|
ok('C2 its chips: the file it changed, then the ticket and the Slack channel it worked with; a ticket only read and not named comes after', JSON.stringify(s2.chips[1]) === JSON.stringify(['file:signup-plan1.md*', 'slack:Slack channel', 'jira:SGN-42', 'jira:SGN-7']), JSON.stringify(s2.chips));
|
|
89
90
|
await sleep(2500);
|
|
90
91
|
ok('C2 it opens once: later reads open nothing more', JSON.stringify((await p.evaluate(look)).tabs) === JSON.stringify(['signup-plan1.md']));
|
|
91
|
-
await p.click('#
|
|
92
|
-
const tk = await until(() => p.evaluate(() => { const e = document.querySelector('#
|
|
92
|
+
await p.click('#hmLog .ctxchip[data-ctx="jira"][data-ctx-ref="SGN-42"]');
|
|
93
|
+
const tk = await until(() => p.evaluate(() => { const e = document.querySelector('#czViewer .obody.vw[data-vw="jira:SGN-42"]'); return e && /Fix the sign-up form/.test(e.textContent) ? { text: e.textContent, href: (e.querySelector('a') || {}).href } : null; }));
|
|
93
94
|
ok('C3 a Jira chip opens the ticket from the stored reading: key, summary, status, sprint, and Open in Jira', !!tk && /In Review/.test(tk.text) && /Active sprint: Sprint 14/.test(tk.text) && tk.href === 'https://acme.atlassian.net/browse/SGN-42', JSON.stringify(tk));
|
|
94
|
-
await p.click('#
|
|
95
|
-
const none = await until(() => p.evaluate(() => { const e = document.querySelector('#
|
|
95
|
+
await p.click('#hmLog .ctxchip[data-ctx="jira"][data-ctx-ref="SGN-7"]');
|
|
96
|
+
const none = await until(() => p.evaluate(() => { const e = document.querySelector('#czViewer .obody.vw[data-vw="jira:SGN-7"]'); return e && /no reading/.test(e.textContent) ? e.textContent : null; }));
|
|
96
97
|
ok('C3 a key with no stored reading says so and claims nothing', !!none, String(none));
|
|
97
|
-
await p.click('#
|
|
98
|
-
const sl = await until(() => p.evaluate(() => { const e = document.querySelector('#
|
|
98
|
+
await p.click('#hmLog .ctxchip[data-ctx="slack"]');
|
|
99
|
+
const sl = await until(() => p.evaluate(() => { const e = document.querySelector('#czViewer .obody.vw[data-vw^="slack:"]'); const a = e && e.querySelector('a'); return a ? a.href : null; }));
|
|
99
100
|
ok('C4 a Slack chip opens a tab with Open in Slack', sl === 'slack://channel?id=C0123ABCD', String(sl));
|
|
100
101
|
const s3 = await p.evaluate(look);
|
|
101
102
|
ok('C6 at 1280 every chip is at least 44 px and nothing scrolls sideways', s3.minH >= 44 && !s3.wide, JSON.stringify(s3));
|
|
@@ -110,10 +111,10 @@ const second = (k) => [
|
|
|
110
111
|
const s0 = await until(async () => { const v = await p.evaluate(look); return v.peek ? v : null; }, 6000) || await p.evaluate(look);
|
|
111
112
|
ok(`C5 at 390 (${scheme}) a new answer shows a bar over the message box and leaves the conversation uncovered`, /Claude wrote this · signup-plan2\.md\s*View/.test(s0.peek || '') && !s0.layer && s0.tab === 'chat', JSON.stringify(s0));
|
|
112
113
|
if (shots) await p.screenshot({ path: `${shots}/chat-context-390-${scheme}.png` });
|
|
113
|
-
await p.click('#
|
|
114
|
+
await p.click('#hmPeek');
|
|
114
115
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.tab === 'out' && v.tabs.length ? v : null; }) || await p.evaluate(look);
|
|
115
|
-
ok(`C5 at 390 (${scheme}) the bar's press opens the file
|
|
116
|
-
await p.click('#
|
|
116
|
+
ok(`C5 at 390 (${scheme}) the bar's press opens the file in the Viewer over the chat and the bar goes`, s1.tab === 'out' && s1.out >= 340 && JSON.stringify(s1.tabs) === JSON.stringify(['signup-plan2.md']) && !s1.peek, JSON.stringify(s1));
|
|
117
|
+
await p.click('#czViewer [data-cz-vw="close"]'); // closing the Viewer goes back to the chat
|
|
117
118
|
const s2 = await p.evaluate(look);
|
|
118
119
|
ok(`C6 at 390 (${scheme}) every chip is at least 44 px and nothing scrolls sideways`, s2.minH >= 44 && !s2.wide, JSON.stringify(s2));
|
|
119
120
|
ok(`C6 no page error at 390 (${scheme})`, errs.length === 0, errs.join(' | '));
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* G3 a ready goal: the conversation shows only the chip; the plan, SMART and Start / Change / Cancel are in the Goal tab
|
|
8
8
|
* G4 Stop the goal is in the Goal tab and reaches the server
|
|
9
9
|
* G5 at 390 the chip shows the Goal tab on the popup's Detail tab; a change offers the goal in the bar over the box
|
|
10
|
-
* (
|
|
10
|
+
* (premium-agreed-design: /premium-chat.html opens Home; the Goal tab is the Viewer card, and on a phone the Viewer covers the chat page)
|
|
11
11
|
* Set GOAL_VIEW_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
|
|
12
12
|
const { findBrowser } = require('./lib/find-browser');
|
|
13
13
|
require('./test-run').configure({ name: 'premium-chat-goal-view' });
|
|
@@ -35,17 +35,18 @@ const DRAFT = {
|
|
|
35
35
|
const READY = 'The goal is clear. Press Start when it reads right.\n\n```pmos-goal\n' + JSON.stringify({ step: 'ready', draft: DRAFT }) + '\n```';
|
|
36
36
|
const goalOf = (state, extra = {}) => ({ id: 'g1', state, draft: DRAFT, met: [], rounds: 2, ...extra });
|
|
37
37
|
|
|
38
|
-
/* the page's own state
|
|
38
|
+
/* the page's own state (premium-agreed-design: Home's chat is #hmLog; the Goal view opens in the Viewer card #czViewer, one item at a time;
|
|
39
|
+
* on a phone the chat is the page and the Viewer covers it, so "the Detail tab" is the Viewer shown and "the chat tab" is the Viewer closed) */
|
|
39
40
|
const look = () => {
|
|
40
|
-
const
|
|
41
|
-
const peek = document.querySelector('#
|
|
42
|
-
return { tab:
|
|
43
|
-
cardInChat: !!document.querySelector('#
|
|
44
|
-
smart: !!document.querySelector('#
|
|
45
|
-
tabs: [
|
|
46
|
-
pane: gp
|
|
47
|
-
peek: peek && !peek.hidden ? peek.textContent.trim() : null,
|
|
48
|
-
railOff:
|
|
41
|
+
const vw = document.querySelector('#czViewer:not([hidden])'), gp = vw ? vw.querySelector('.obody.vw[data-vw="goal"]') : null;
|
|
42
|
+
const peek = document.querySelector('#hmPeek');
|
|
43
|
+
return { tab: vw ? 'out' : 'chat', shut: !gp, layer: false, out: vw ? Math.round(vw.getBoundingClientRect().width) : 0, vh: innerHeight,
|
|
44
|
+
cardInChat: !!document.querySelector('#hmLog .gcard'), chip: (document.querySelector('#hmLog [data-goal-open]') || {}).textContent || null,
|
|
45
|
+
smart: !!document.querySelector('#hmLog .smart'), start: !!document.querySelector('#hmLog [data-goal="start"]'),
|
|
46
|
+
tabs: gp ? ['Goal'] : [], on: vw ? (vw.querySelector('.cz-vw-kind') || {}).textContent || null : null,
|
|
47
|
+
pane: gp ? gp.textContent.replace(/\s+/g, ' ').trim() : null, stop: !!document.querySelector('#czViewer [data-goal="stop"]'),
|
|
48
|
+
peek: peek && !peek.hidden ? peek.textContent.trim() : null,
|
|
49
|
+
railOff: !document.querySelector('nav.rail'), wide: document.documentElement.scrollWidth > innerWidth + 1 };
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
(async () => {
|
|
@@ -64,9 +65,8 @@ const look = () => {
|
|
|
64
65
|
await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-goal', goal: st.goal } }));
|
|
65
66
|
await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages: st.messages } }));
|
|
66
67
|
await p.route('**/api/briefing-premium/goal**', (r) => { st.posts.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ json: { ok: true } }); });
|
|
67
|
-
await p.goto(chat);
|
|
68
|
-
|
|
69
|
-
await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream #thr')));
|
|
68
|
+
await p.goto(chat + '&about=work:goal-test'); // premium-agreed-design: /premium-chat.html opens Home with the chat named by ?about
|
|
69
|
+
await until(() => p.evaluate(() => !!document.querySelector('#hmLog .hm-a, #hmLog .hm-u')));
|
|
70
70
|
await sleep(400);
|
|
71
71
|
return { p, ctx, errs, st };
|
|
72
72
|
};
|
|
@@ -75,18 +75,18 @@ const look = () => {
|
|
|
75
75
|
{ const { p, ctx, errs, st } = await open(1280, 'light', { goal: goalOf('stopped', { reason: 'pm' }), messages: working });
|
|
76
76
|
const s0 = await p.evaluate(look);
|
|
77
77
|
ok('G1 at 1280 a stopped goal draws no card in the conversation, only a small Goal chip', !s0.cardInChat && /Stopped/.test(s0.chip || '') && /0 of 3/.test(s0.chip || ''), JSON.stringify(s0));
|
|
78
|
-
ok('G1 opening the chat with a goal opens nothing by itself', s0.shut
|
|
78
|
+
ok('G1 opening the chat with a goal opens nothing by itself', s0.shut, JSON.stringify(s0));
|
|
79
79
|
if (shots) await p.screenshot({ path: `${shots}/chip-1280-light.png` });
|
|
80
|
-
await p.click('#
|
|
80
|
+
await p.click('#hmLog [data-goal-open]');
|
|
81
81
|
const s1 = await until(async () => { const v = await p.evaluate(look); return !v.shut && v.pane ? v : null; }) || await p.evaluate(look);
|
|
82
82
|
ok('G1 the chip opens a Goal tab with the goal, its done points and why it stopped', /Goal/.test(s1.on || '') && /Stopped/.test(s1.pane || '') && /0 of 3 done points met/.test(s1.pane || '') && /Totals match GA4/.test(s1.pane || '') && /You stopped it/.test(s1.pane || ''), JSON.stringify(s1));
|
|
83
|
-
await p.click('#
|
|
83
|
+
await p.click('#czViewer [data-cz-vw="close"]'); await until(() => p.evaluate(() => !document.querySelector('#czViewer:not([hidden])')));
|
|
84
84
|
st.goal = goalOf('started', { met: [DRAFT.done[0]] });
|
|
85
85
|
const s2 = await until(async () => { const v = await p.evaluate(look); return v.pane && /round 3/.test(v.pane) ? v : null; }) || await p.evaluate(look);
|
|
86
86
|
ok('G2 a goal that changes state opens the Goal tab by itself', !s2.shut && /Goal/.test(s2.on || '') && /1 of 3 done points met/.test(s2.pane || ''), JSON.stringify(s2));
|
|
87
|
-
ok('G4 Stop the goal is in the Goal tab, not in the conversation', s2.stop && !(await p.evaluate(() => !!document.querySelector('#
|
|
87
|
+
ok('G4 Stop the goal is in the Goal tab, not in the conversation', s2.stop && !(await p.evaluate(() => !!document.querySelector('#hmLog [data-goal="stop"]'))), JSON.stringify(s2));
|
|
88
88
|
if (shots) await p.screenshot({ path: `${shots}/goal-1280-light.png` });
|
|
89
|
-
await p.click('#
|
|
89
|
+
await p.click('#czViewer [data-goal="stop"]');
|
|
90
90
|
const posted = await until(() => st.posts.find((x) => x.act === 'stop'));
|
|
91
91
|
ok('G4 Stop reaches the server for this goal', posted && posted.id === 'g1', JSON.stringify(st.posts));
|
|
92
92
|
st.goal = goalOf('done', { met: DRAFT.done });
|
|
@@ -98,10 +98,10 @@ const look = () => {
|
|
|
98
98
|
{ const { p, ctx, errs, st } = await open(1280, 'dark', { goal: goalOf('grilling'), messages: [{ role: 'user', text: '[PMOS /goal] The PM set a goal: Enrich the Lightbox reports\n' }, { role: 'assistant', text: READY }] });
|
|
99
99
|
const s0 = await p.evaluate(look);
|
|
100
100
|
ok('G3 a ready goal is one chip in the conversation: no card, no SMART row, no buttons', !s0.smart && !s0.start && !s0.cardInChat && /Not started/.test(s0.chip || ''), JSON.stringify(s0));
|
|
101
|
-
await p.click('#
|
|
101
|
+
await p.click('#hmLog [data-goal-open]');
|
|
102
102
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane ? v : null; }) || await p.evaluate(look);
|
|
103
103
|
ok('G3 the Goal tab shows the plan: done when, may, serves, by', /Done when/.test(s1.pane || '') && /It may/.test(s1.pane || '') && /Serves/.test(s1.pane || '') && /Not started/.test(s1.pane || ''), JSON.stringify(s1));
|
|
104
|
-
await p.click('#
|
|
104
|
+
await p.click('#czViewer [data-goal="start"]');
|
|
105
105
|
const sent = await until(() => st.posts.find((x) => x.act === 'start'));
|
|
106
106
|
ok('G3 Start in the Goal tab sends the ready draft for this goal', sent && sent.id === 'g1' && sent.draft && sent.draft.goal === DRAFT.goal, JSON.stringify(st.posts));
|
|
107
107
|
if (shots) await p.screenshot({ path: `${shots}/ready-1280-dark.png` });
|
|
@@ -113,11 +113,11 @@ const look = () => {
|
|
|
113
113
|
const s0 = await p.evaluate(look);
|
|
114
114
|
ok(`G5 (${scheme}) at 390 the conversation shows the chip, not the card`, !s0.cardInChat && /Working/.test(s0.chip || '') && !s0.layer && s0.tab === 'chat', JSON.stringify(s0));
|
|
115
115
|
if (shots) await p.screenshot({ path: `${shots}/chip-390-${scheme}.png` });
|
|
116
|
-
await p.click('#
|
|
116
|
+
await p.click('#hmLog [data-goal-open]');
|
|
117
117
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.tab === 'out' && v.pane ? v : null; }) || await p.evaluate(look);
|
|
118
118
|
ok(`G5 (${scheme}) the chip shows the Goal tab on the popup's Detail tab, the popup's full width`, s1.tab === 'out' && s1.out >= 340 && /1 of 3 done points met/.test(s1.pane || ''), JSON.stringify(s1));
|
|
119
119
|
if (shots) await p.screenshot({ path: `${shots}/goal-390-${scheme}.png` });
|
|
120
|
-
await p.click('#
|
|
120
|
+
await p.click('#czViewer [data-cz-vw="close"]'); await until(() => p.evaluate(() => !document.querySelector('#czViewer:not([hidden])')));
|
|
121
121
|
st.goal = goalOf('waiting', { met: [DRAFT.done[0]] });
|
|
122
122
|
const s2 = await until(async () => { const v = await p.evaluate(look); return v.peek ? v : null; }) || await p.evaluate(look);
|
|
123
123
|
ok(`G5 (${scheme}) a change offers the goal in the bar over the box, without covering the conversation`, /Needs you/.test(s2.peek || '') && !s2.layer && s2.tab === 'chat', JSON.stringify(s2));
|