create-pmos 0.397.0 → 0.398.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +101 -52
- package/workspace/briefing-premium-board-test.js +252 -128
- package/workspace/briefing-premium-calendar-2-test.js +135 -198
- package/workspace/briefing-premium-calendar-3-test.js +143 -418
- package/workspace/briefing-premium-calendar-test.js +86 -196
- package/workspace/briefing-premium-doc-edit-test.js +95 -83
- package/workspace/briefing-premium-initiative-test.js +159 -296
- package/workspace/briefing-premium-insights-test.js +337 -219
- package/workspace/briefing-premium-metrics-test.js +53 -97
- package/workspace/briefing-premium-products-test.js +40 -27
- package/workspace/briefing-premium-sources-test.js +66 -48
- package/workspace/briefing-premium-test.js +150 -647
- package/workspace/briefing-premium-work-test.js +88 -283
- package/workspace/changelog.json +12 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +47 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-premium.js +85 -19
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +62 -14
- package/workspace/lib/insights-records.js +101 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-insights-premium.js +12 -3
- package/workspace/lib/routes-insights-records.js +129 -0
- package/workspace/lib/routes-notes.js +1 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/transcript-steps.js +123 -0
- package/workspace/lib/viewer-meeting.js +205 -0
- package/workspace/lib/viewer-report.js +89 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +85 -75
- package/workspace/premium-briefing-depth-test.js +66 -53
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +35 -37
- package/workspace/premium-chat-context-test.js +19 -18
- package/workspace/premium-chat-goal-view-test.js +23 -23
- package/workspace/premium-chat-notes-test.js +26 -31
- package/workspace/premium-chat-report-tab-test.js +32 -28
- package/workspace/premium-chat-term-test.js +16 -16
- package/workspace/premium-chat-viewer-test.js +60 -59
- package/workspace/premium-core-doc-issue-test.js +50 -43
- package/workspace/premium-html-viewer-test.js +14 -17
- package/workspace/premium-phone-card-test.js +7 -2
- package/workspace/premium-phone-room-test.js +41 -35
- package/workspace/premium-report-read-test.js +115 -197
- package/workspace/premium-viewer-download-test.js +19 -22
- package/workspace/premium-viewer-flicker-test.js +11 -16
- package/workspace/premium-viewer-share-test.js +6 -9
- package/workspace/premium-viewer-test.js +41 -60
- package/workspace/premium-vw-backlog-test.js +53 -33
- package/workspace/premium-vw-cal-test.js +82 -128
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +11 -10
- package/workspace/premium-vw-item-test.js +50 -49
- package/workspace/premium-vw-jira-test.js +53 -27
- package/workspace/premium-vw-meet-test.js +118 -187
- package/workspace/premium-vw-notes-test.js +85 -108
- package/workspace/premium-vw-rec-test.js +72 -194
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +61 -53
- package/workspace/public/pm/bd-acts.js +305 -0
- package/workspace/public/pm/bd-span.js +186 -82
- package/workspace/public/pm/bd-stages.js +25 -11
- package/workspace/public/pm/c3-doc-sheet.js +1 -1
- package/workspace/public/pm/c3-md.js +3 -395
- package/workspace/public/pm/c3-phone-detail.js +1 -1
- package/workspace/public/pm/c3-phone-model.js +3 -68
- package/workspace/public/pm/chat-term.js +3 -3
- package/workspace/public/pm/cozy-board.css +497 -230
- package/workspace/public/pm/cozy-home.css +570 -142
- package/workspace/public/pm/cozy-home.js +5 -3
- package/workspace/public/pm/cozy-insights.css +296 -167
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +17 -6
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-viewer.css +3 -3
- package/workspace/public/pm/cozy-viewer.js +144 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +83 -1
- package/workspace/public/pm/home-adddoc.js +48 -0
- package/workspace/public/pm/home-app.js +905 -0
- package/workspace/public/pm/home-around.js +515 -0
- package/workspace/public/pm/home-chat.js +459 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-more.js +249 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-work.js +519 -0
- package/workspace/public/pm/phone-moment.js +69 -0
- package/workspace/public/pm/pm-work-view.js +1 -1
- package/workspace/public/pm/premium-attach.js +4 -0
- package/workspace/public/pm/premium-board.js +423 -394
- package/workspace/public/pm/premium-chart-tab.js +110 -62
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +25 -21
- package/workspace/public/pm/premium-insights.js +792 -568
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-notes.js +1 -1
- package/workspace/public/pm/premium-report-frame.css +20 -0
- package/workspace/public/pm/premium-report-read.js +509 -480
- package/workspace/public/pm/premium-report-tab.js +87 -63
- package/workspace/public/pm/premium-shell.js +72 -119
- package/workspace/public/pm/premium-viewer.js +22 -1
- package/workspace/public/pm/premium-vw-cal.js +187 -48
- package/workspace/public/pm/premium-vw-doc.css +6 -0
- package/workspace/public/pm/premium-vw-doc.js +40 -2
- package/workspace/public/pm/premium-vw-file.js +2 -2
- package/workspace/public/pm/premium-vw-meet.js +6 -83
- package/workspace/public/pm/premium-vw-mtg.js +731 -0
- package/workspace/public/pm/premium-vw-notes.js +56 -69
- package/workspace/public/pm/premium-vw-open.js +35 -0
- package/workspace/public/pm/premium-vw-page.js +16 -0
- package/workspace/public/pm/premium-vw-rec.js +11 -218
- package/workspace/public/pm/premium-vw-slides.css +5 -0
- package/workspace/public/pm/premium-vw-slides.js +44 -8
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +28 -70
- package/workspace/public/premium-initiative.html +8 -48
- package/workspace/public/premium-insights.html +22 -60
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium.html +16 -107
- package/workspace/server.js +18 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/public/pm/premium-work.js +0 -729
- package/workspace/public/pm/premium.js +0 -1146
|
@@ -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 the cozy part marked Waiting for design, 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,8 @@ 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
|
-
await p.goto(BASE + url); // premium-agreed-design
|
|
80
|
-
|
|
81
|
-
await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream')));
|
|
85
|
+
await p.goto(BASE + url); // premium-agreed-design: /premium-chat.html opens Home, whose chat is docked on a desktop and is the page on a phone
|
|
86
|
+
await until(() => p.evaluate(() => !!document.querySelector('#hmLog [data-report-open]')));
|
|
82
87
|
await sleep(500);
|
|
83
88
|
return { p, ctx, errs };
|
|
84
89
|
};
|
|
@@ -86,62 +91,55 @@ const look = () => {
|
|
|
86
91
|
{ 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
92
|
const s0 = await p.evaluate(look);
|
|
88
93
|
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('#
|
|
94
|
+
await p.click('#hmLog [data-report-open]');
|
|
90
95
|
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
|
|
96
|
+
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
97
|
if (shots) await p.screenshot({ path: `${shots}/chart-1280.png` });
|
|
93
|
-
await p.click('#
|
|
98
|
+
await p.click('#czViewer [data-ct="form|line"]');
|
|
94
99
|
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('#
|
|
100
|
+
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));
|
|
101
|
+
await p.click('#czViewer [data-ct="save"]');
|
|
97
102
|
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
103
|
const saved = PC.list(dir, board);
|
|
99
104
|
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('#
|
|
105
|
+
await p.click('#czViewer [data-ct="remove"]');
|
|
106
|
+
await p.click('#czViewer [data-ct="askyes"]');
|
|
102
107
|
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
108
|
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
109
|
ok('F1 no page error and no sideways scroll (chart, 1280)', !errs.length && !s4.wide, errs.join(' | '));
|
|
105
110
|
await ctx.close(); }
|
|
106
111
|
|
|
107
112
|
{ 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('#
|
|
113
|
+
await p.click('#hmLog [data-report-open]');
|
|
109
114
|
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.
|
|
115
|
+
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
116
|
if (shots) await p.screenshot({ path: `${shots}/dashboard-1280.png` });
|
|
112
|
-
await p.click('#
|
|
117
|
+
await p.click('#czViewer [data-ct="save"]');
|
|
113
118
|
await until(async () => { const v = await p.evaluate(look); return v.pane && /Saved\./.test(v.pane) ? v : null; });
|
|
114
119
|
const D = PD.list(dir, board);
|
|
115
120
|
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
121
|
ok('F1 no page error (dashboard, 1280)', !errs.length, errs.join(' | '));
|
|
117
122
|
await ctx.close(); }
|
|
118
123
|
|
|
124
|
+
/* 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
|
|
125
|
+
* chat about Insights with the question in the box, not sent. Dashboards are edited on Insights itself now (premium-insights.js side panel). */
|
|
119
126
|
{ const ctx = await browser.newContext({ viewport: { width: 1280, height: 860 } }), p = await ctx.newPage(), errs = [];
|
|
120
127
|
p.on('pageerror', (e) => errs.push(String(e)));
|
|
128
|
+
let asked = 0; await p.route('**/api/briefing-premium/ask**', (r) => { asked++; r.fulfill({ json: { ok: true } }); });
|
|
121
129
|
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
|
|
130
|
+
await until(() => p.evaluate(() => /premium\.html\?/.test((document.querySelector('#askWhy') || {}).href || '')));
|
|
131
|
+
const hasStudio = await p.evaluate(() => !!document.querySelector('.stu, #studio') || [...document.scripts].some((s) => /premium-studio/.test(s.src)));
|
|
132
|
+
const href = await p.evaluate(() => document.querySelector('#askWhy').href);
|
|
133
|
+
await Promise.all([p.waitForURL(/\/premium\.html\?/), p.click('#askWhy')]);
|
|
129
134
|
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
135
|
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('
|
|
136
|
+
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]));
|
|
137
|
+
ok('I1 the question waits in the box, not sent', /^Why/.test(s2.say) && asked === 0, JSON.stringify([s2.say, asked]));
|
|
138
|
+
ok('F1 no page error (Insights to Home)', !errs.length, errs.join(' | '));
|
|
141
139
|
await ctx.close(); }
|
|
142
140
|
|
|
143
141
|
{ const { p, ctx, errs } = await open(390, [ASK('chart partner activation'), { role: 'assistant', text: 'Here.\n\n' + block(CHART) }]);
|
|
144
|
-
await p.click('#
|
|
142
|
+
await p.click('#hmLog [data-report-open]');
|
|
145
143
|
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && v.tiles.length ? v : null; }) || await p.evaluate(look);
|
|
146
144
|
ok('C1 at 390 the chip opens the Chart tab over the page', s1.bars === 5, JSON.stringify(s1));
|
|
147
145
|
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));
|
|
@@ -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
|
}
|