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
|
@@ -61,38 +61,33 @@ const SHOTS = process.env.PMOS_SHOTS || '';
|
|
|
61
61
|
await page.route('**/api/sessions', json({ sessions: [{ id: 's-flicker', origin: 'chat:k-flicker', name: 'Funnel report', shown: 'running', state: 'running' }] }));
|
|
62
62
|
await page.route('**/api/doc/locate*', json({ ok: true, ws: 'w0', rel: HTMLF, abs: '/Users/pm/pmos/' + HTMLF, name: '2026-10-19.html', mtime: 1, size: REPORT.length }));
|
|
63
63
|
await page.route('**/api/doc?*', (r) => r.fulfill({ status: 200, contentType: 'text/plain', headers: { 'X-Doc-Kind': 'html' }, body: REPORT }));
|
|
64
|
-
|
|
65
|
-
await
|
|
66
|
-
await
|
|
67
|
-
const S = await import('/pm/premium-shell.js');
|
|
68
|
-
S.openDlg({ eye: 'Your item', title: 'Funnel report', say: 'Ask about the report.', noteKey: 'k-flicker', pane: '<article class="paper doc"><p>Item record</p></article>', label: 'Item record' });
|
|
69
|
-
S.loadThread('k-flicker');
|
|
70
|
-
});
|
|
71
|
-
const fp = await until(() => page.$('#dBody .stream button.fpath[data-file]'), 8000);
|
|
64
|
+
// premium-agreed-design: the session's conversation is Home's chat (?session= names it) and the file it names opens in the Viewer card
|
|
65
|
+
await page.goto(BASE + '/premium.html?session=s-flicker&theme=' + theme);
|
|
66
|
+
const fp = await until(() => page.$('#hmLog button.fpath[data-file]'), 15000);
|
|
72
67
|
if (fp) await fp.evaluate((b) => b.click()); // on a phone the dialog opens on the Detail side, so the press goes through the button's own handler
|
|
73
68
|
return { ctx, page, errors, conv };
|
|
74
69
|
};
|
|
75
70
|
|
|
76
71
|
{
|
|
77
72
|
const { page, errors, conv, ctx } = await open();
|
|
78
|
-
const fr = await until(() => page.$('#
|
|
73
|
+
const fr = await until(() => page.$('#czViewer .obody.vw iframe.vwframe'), 8000);
|
|
79
74
|
ok('the chat names the report and the press opens it in the viewer as a frame', !!fr);
|
|
80
75
|
await sleep(1500); // the first draw's entrance has played
|
|
81
76
|
await page.evaluate(() => {
|
|
82
|
-
window.__rise = 0; window.__loads = 0; window.__frame = document.querySelector('#
|
|
83
|
-
window.__turns = [...document.querySelectorAll('#
|
|
84
|
-
document.querySelector('#
|
|
77
|
+
window.__rise = 0; window.__loads = 0; window.__frame = document.querySelector('#czViewer .obody.vw iframe.vwframe');
|
|
78
|
+
window.__turns = [...document.querySelectorAll('#hmLog .hm-u, #hmLog .hm-a')];
|
|
79
|
+
document.querySelector('#hmLog').addEventListener('animationstart', () => { window.__rise++; }); // any entrance a turn plays again
|
|
85
80
|
if (window.__frame) window.__frame.addEventListener('load', () => { window.__loads++; });
|
|
86
81
|
});
|
|
87
82
|
await sleep(7000); // three conversation reads and two list reads
|
|
88
|
-
const st = await page.evaluate(() => ({ rise: window.__rise, turns: window.__turns.length, same: window.__turns.every((t) => t.isConnected), frame: window.__frame === document.querySelector('#
|
|
83
|
+
const st = await page.evaluate(() => ({ rise: window.__rise, turns: window.__turns.length, same: window.__turns.every((t) => t.isConnected), frame: window.__frame === document.querySelector('#czViewer .obody.vw iframe.vwframe'), loads: window.__loads }));
|
|
89
84
|
ok('F1 while nothing changes, the turns stay the same nodes over several reads', st.turns >= 2 && st.same, JSON.stringify(st));
|
|
90
85
|
ok('F1 no turn replays its entrance while nothing changes', st.rise === 0, JSON.stringify(st));
|
|
91
86
|
ok('F2 the viewer keeps the same frame and never reloads it', st.frame && st.loads === 0, JSON.stringify(st));
|
|
92
87
|
conv.messages.push({ role: 'user', text: 'Add the weekly view.' }, { role: 'assistant', text: 'Added the weekly view.' });
|
|
93
|
-
const got = await until(() => page.evaluate(() => /Added the weekly view/.test(document.querySelector('#
|
|
88
|
+
const got = await until(() => page.evaluate(() => /Added the weekly view/.test(document.querySelector('#hmLog').textContent)), 6000);
|
|
94
89
|
await sleep(800);
|
|
95
|
-
const st2 = await page.evaluate(() => ({ rise: window.__rise, frame: window.__frame === document.querySelector('#
|
|
90
|
+
const st2 = await page.evaluate(() => ({ rise: window.__rise, frame: window.__frame === document.querySelector('#czViewer .obody.vw iframe.vwframe'), loads: window.__loads }));
|
|
96
91
|
ok('F3 a new message still shows in the conversation', !!got);
|
|
97
92
|
ok('F3 the redraw for it does not replay the entrance of the turns on screen', st2.rise === 0, JSON.stringify(st2));
|
|
98
93
|
ok('F3 the viewer frame is untouched by the new message', st2.frame && st2.loads === 0, JSON.stringify(st2));
|
|
@@ -103,7 +98,7 @@ const SHOTS = process.env.PMOS_SHOTS || '';
|
|
|
103
98
|
if (SHOTS) {
|
|
104
99
|
for (const [w, h] of [[1280, 900], [390, 844]]) for (const theme of ['light', 'dark']) {
|
|
105
100
|
const { page, ctx } = await open({ w, h, theme });
|
|
106
|
-
await until(() => page.$('#
|
|
101
|
+
await until(() => page.$('#czViewer .obody.vw iframe.vwframe'), 8000);
|
|
107
102
|
await sleep(1500);
|
|
108
103
|
fs.mkdirSync(SHOTS, { recursive: true });
|
|
109
104
|
await page.screenshot({ path: path.join(SHOTS, `after-${w}-${theme}.png`) });
|
|
@@ -148,17 +148,14 @@ const SHOTS = process.env.PMOS_SHOTS || '';
|
|
|
148
148
|
const errors = [];
|
|
149
149
|
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
150
150
|
await page.route('**/api/brief-page*', (r) => r.fulfill({ contentType: 'application/json', body: '{"ok":false,"error":"off in this suite"}' }));
|
|
151
|
-
|
|
152
|
-
await
|
|
153
|
-
await page.evaluate(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
});
|
|
157
|
-
await page.evaluate((f) => { const b = document.createElement('button'); b.type = 'button'; b.className = 'fpath'; b.dataset.file = f; b.textContent = f; document.querySelector('#dBody .stream').append(b); b.click(); }, PRD);
|
|
158
|
-
await until(() => page.$('#dOut .obody.vw:not([hidden]) [data-fsh]'), 10000);
|
|
151
|
+
// premium-agreed-design: a chat is Home's own (?about= names the conversation) and a file it names opens in the Viewer card
|
|
152
|
+
await page.goto(BASE + '/premium.html?about=work:share-test&theme=' + theme);
|
|
153
|
+
await until(() => page.evaluate(() => !!document.querySelector('#hmLog') && !!document.querySelector('#hmFoot textarea')), 15000);
|
|
154
|
+
await page.evaluate((f) => { const b = document.createElement('button'); b.type = 'button'; b.className = 'fpath'; b.dataset.file = f; b.textContent = f; document.querySelector('#hmLog').append(b); b.click(); }, PRD);
|
|
155
|
+
await until(() => page.$('#czViewer:not([hidden]) .obody.vw [data-fsh]'), 10000);
|
|
159
156
|
return { ctx, page, errors };
|
|
160
157
|
};
|
|
161
|
-
const ICON = '#
|
|
158
|
+
const ICON = '#czViewer:not([hidden]) .obody.vw [data-fsh]';
|
|
162
159
|
{
|
|
163
160
|
const { page, errors, ctx } = await open();
|
|
164
161
|
await page.click(ICON);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
/* premium-viewer-test.js — the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
/* premium-viewer-test.js — the Viewer (initiative premium-viewer, S1; planning/prd/premium-viewer-prd.md R1, R7; re-pointed by premium-agreed-design, area viewer).
|
|
4
|
+
* The Agreed design replaced the dialog's tabbed right pane with one Viewer card (window.czViewer, cozy-viewer.js) that shows one item at a time.
|
|
5
|
+
* Serves the real Home page from the real server with the Briefing model answered by a stand-in, then drives window.__premiumViewer (the views'
|
|
6
|
+
* entry, which opens in the card when the page has no dialog) and window.czViewer.
|
|
7
|
+
* R1 the card: open, refill on the same id, one item at a time (no tabs, no dialog), the page's own nodes untouched, close and Escape, confirm, style
|
|
8
|
+
* R7 floors: 390px covers the screen, 44px targets, dark theme
|
|
6
9
|
* Every wait polls the page; no fixed sleep stands in for a state. */
|
|
7
10
|
const path = require('path');
|
|
8
11
|
const { spawn } = require('child_process');
|
|
@@ -43,73 +46,52 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
43
46
|
page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
|
|
44
47
|
await page.route('**/api/briefing-premium*', (r) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: B.build(F.facts()), as_of: Date.now() }) }));
|
|
45
48
|
await page.goto(BASE + '/premium.html?theme=' + theme);
|
|
46
|
-
|
|
49
|
+
await until(() => page.evaluate(() => document.querySelectorAll('#hmList .hm-r').length > 0 && !!window.czViewer), 20000);
|
|
50
|
+
await page.evaluate(() => import('/pm/premium-viewer.js'));
|
|
51
|
+
S.up = await until(() => page.evaluate(() => !!window.__premiumViewer && !!window.czViewer), 10000);
|
|
47
52
|
return { page, ctx, S };
|
|
48
53
|
};
|
|
49
|
-
/* opens the first row that opens a dialog on this page (a row with its own page would navigate away) */
|
|
50
|
-
const openDialog = async (page) => {
|
|
51
|
-
const n = await page.evaluate(() => document.querySelectorAll('#rank .rr .rhd').length);
|
|
52
|
-
for (let i = 0; i < n; i++) {
|
|
53
|
-
const url = page.url();
|
|
54
|
-
await page.evaluate((k) => document.querySelectorAll('#rank .rr .rhd')[k].click(), i);
|
|
55
|
-
if (await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on')), 3000)) return true;
|
|
56
|
-
if (page.url() !== url) { await page.goBack(); await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr .rhd').length > 0 && !!window.__premiumViewer), 20000); }
|
|
57
|
-
}
|
|
58
|
-
return false;
|
|
59
|
-
};
|
|
60
54
|
const st = (page) => page.evaluate(() => {
|
|
61
|
-
const
|
|
55
|
+
const v = document.querySelector('#czViewer');
|
|
62
56
|
const vis = (e) => !!e && !e.hidden && getComputedStyle(e).display !== 'none';
|
|
63
|
-
return {
|
|
64
|
-
|
|
57
|
+
return { open: vis(v), cur: window.czViewer.current(), cards: document.querySelectorAll('#czViewer').length, panes: [...document.querySelectorAll('#czViewer .obody.vw')].map((p) => p.dataset.vw),
|
|
58
|
+
title: v ? (v.querySelector('.cz-vw-title') || {}).textContent : '', tabs: !!document.querySelector('#vTabs, .vtab'), dlg: !!document.querySelector('#dlg') };
|
|
65
59
|
});
|
|
66
60
|
|
|
67
61
|
/* R1 desktop */
|
|
68
62
|
{
|
|
69
63
|
const { page, ctx, S } = await open();
|
|
70
|
-
ok('R1
|
|
71
|
-
|
|
64
|
+
ok('R1 Home loads with the viewer module and the Viewer card', S.up);
|
|
65
|
+
// the page's own list: a node and a handler on it must survive every open and close of the Viewer (the old #oMain rule)
|
|
66
|
+
await page.evaluate(() => { const m = document.querySelector('#hmList'); window.__hits = 0; m.addEventListener('click', () => { window.__hits++; }); const p = document.createElement('p'); p.id = 'vwMark'; p.textContent = 'mark'; m.append(p); });
|
|
72
67
|
let s = await st(page);
|
|
73
|
-
ok('R1 with
|
|
74
|
-
/* a page's handler on #oMain, and a node inside it, must survive the tabs */
|
|
75
|
-
await page.evaluate(() => { const m = document.querySelector('#oMain'); window.__hits = 0; m.addEventListener('click', () => { window.__hits++; }); const p = document.createElement('p'); p.id = 'vwMark'; p.textContent = 'mark'; m.append(p); });
|
|
68
|
+
ok('R1 with nothing opened there is no tab strip and no old dialog', !s.tabs && !s.dlg, JSON.stringify(s));
|
|
76
69
|
await page.evaluate(() => window.__premiumViewer.vwOpen({ id: 'a', title: 'Alpha doc', icon: 'doc', html: '<p id="paneA">Alpha</p>', wire: (el) => { el.querySelector('#paneA').dataset.wired = '1'; } }));
|
|
77
70
|
s = await st(page);
|
|
78
|
-
ok('R1 opening an item shows the
|
|
79
|
-
ok('R1 the item fills
|
|
80
|
-
ok('R1 the
|
|
81
|
-
await page.click('#vTabs .vtab[data-vw="main"]');
|
|
82
|
-
s = await st(page);
|
|
83
|
-
ok('R1 a click on the main tab shows #oMain and hides the item', s.main && s.on === 'main' && s.panes.every((p) => !p[1]), JSON.stringify(s));
|
|
84
|
-
ok('R1 #oMain was not re-rendered: the node inside it and its handler are still there', await page.evaluate(() => { document.querySelector('#vwMark').click(); return !!document.querySelector('#oMain #vwMark') && window.__hits === 1; }));
|
|
71
|
+
ok('R1 opening an item shows the Viewer card with its title, and no tab strip', s.open && s.cards === 1 && s.title === 'Alpha doc' && JSON.stringify(s.panes) === '["a"]' && !s.tabs, JSON.stringify(s));
|
|
72
|
+
ok('R1 the item fills the card and wire runs on it', await page.evaluate(() => document.querySelector('#czViewer #paneA') && document.querySelector('#czViewer #paneA').dataset.wired === '1'));
|
|
73
|
+
ok('R1 the page\'s own list was not re-rendered: the node inside it and its handler are still there', await page.evaluate(() => { document.querySelector('#vwMark').click(); return !!document.querySelector('#hmList #vwMark') && window.__hits === 1; }));
|
|
85
74
|
await page.evaluate(() => window.__premiumViewer.vwOpen({ id: 'a', title: 'Alpha doc', html: '<p id="paneA">Alpha 2</p>' }));
|
|
86
75
|
s = await st(page);
|
|
87
|
-
ok('R1 opening the same id again refills
|
|
76
|
+
ok('R1 opening the same id again refills the card, with no second item', s.cards === 1 && JSON.stringify(s.panes) === '["a"]' && (await page.textContent('#czViewer #paneA')) === 'Alpha 2', JSON.stringify(s));
|
|
88
77
|
for (const id of ['b', 'c', 'd', 'e']) await page.evaluate((x) => window.__premiumViewer.vwOpen({ id: x, title: 'Item ' + x, html: `<p>${x}</p>` }), id);
|
|
89
78
|
s = await st(page);
|
|
90
|
-
ok('R1
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
ok('R1
|
|
94
|
-
await page.
|
|
95
|
-
await page.keyboard.press('ArrowLeft');
|
|
96
|
-
s = await st(page);
|
|
97
|
-
ok('R1 the arrow keys move between tabs', s.on === 'c' && (await page.evaluate(() => document.activeElement.dataset.vw)) === 'c', JSON.stringify(s));
|
|
98
|
-
await page.keyboard.press('Delete');
|
|
99
|
-
s = await st(page);
|
|
100
|
-
ok('R1 Delete closes the focused tab', JSON.stringify(s.ids) === '["b","d"]', JSON.stringify(s));
|
|
101
|
-
const yes = page.evaluate(() => window.__premiumViewer.vwConfirm(document.querySelector('#dOut .obody.vw:not([hidden])'), { text: 'Undo all 3 edits?', yes: 'Undo all' }));
|
|
102
|
-
await until(() => page.evaluate(() => !!document.querySelector('.vcf')));
|
|
103
|
-
ok('R1 vwConfirm draws a card with the question in the shown pane', (await page.textContent('.vcf p')) === 'Undo all 3 edits?');
|
|
104
|
-
await page.click('.vcf [data-a="1"]');
|
|
79
|
+
ok('R1 one item at a time: each open replaces the one shown', s.cards === 1 && JSON.stringify(s.panes) === '["e"]' && s.cur && s.cur.id === 'vw:e' && !s.tabs, JSON.stringify(s));
|
|
80
|
+
const yes = page.evaluate(() => window.__premiumViewer.vwConfirm(document.querySelector('#czViewer .obody.vw'), { text: 'Undo all 3 edits?', yes: 'Undo all' }));
|
|
81
|
+
await until(() => page.evaluate(() => !!document.querySelector('#czViewer .vcf')));
|
|
82
|
+
ok('R1 vwConfirm draws a card with the question in the shown item', (await page.textContent('#czViewer .vcf p')) === 'Undo all 3 edits?');
|
|
83
|
+
await page.click('#czViewer .vcf [data-a="1"]');
|
|
105
84
|
ok('R1 vwConfirm resolves true on the yes button and removes the card', (await yes) === true && !(await page.$('.vcf')));
|
|
106
|
-
await page.evaluate(() => window.__premiumViewer.vwStyle('none-such'));
|
|
107
|
-
|
|
85
|
+
ok('R1 vwStyle adds the view\'s stylesheet link once', await page.evaluate(() => { window.__premiumViewer.vwStyle('none-such'); window.__premiumViewer.vwStyle('none-such'); window.__premiumViewer.vwStyle('../x'); const l = document.querySelectorAll('link[data-vw-css="none-such"]'); return l.length === 1 && l[0].getAttribute('href') === '/pm/premium-vw-none-such.css' && !document.querySelector('link[href*="/x.css"]'); }));
|
|
86
|
+
await page.click('#czViewer [data-cz-vw="close"]');
|
|
87
|
+
s = await st(page);
|
|
88
|
+
ok('R1 Close empties and hides the card', !s.open && s.panes.length === 0, JSON.stringify(s));
|
|
89
|
+
await page.evaluate(() => window.__premiumViewer.vwOpen({ id: 'f', title: 'Item f', html: '<p>f</p>' }));
|
|
108
90
|
await page.keyboard.press('Escape');
|
|
109
|
-
await until(() => page.evaluate(() => !
|
|
110
|
-
await
|
|
91
|
+
ok('R1 Escape closes the Viewer', !!(await until(() => page.evaluate(() => !window.czViewer.isOpen()), 3000)));
|
|
92
|
+
await page.evaluate(() => window.__premiumViewer.vwOpen({ id: 'g', title: 'Item g', html: '<p>g</p>' }));
|
|
111
93
|
s = await st(page);
|
|
112
|
-
ok('R1 the next
|
|
94
|
+
ok('R1 the next item starts alone in the card', s.open && JSON.stringify(s.panes) === '["g"]', JSON.stringify(s));
|
|
113
95
|
ok('R1 no page error', S.errors.length === 0, S.errors.join(' | '));
|
|
114
96
|
await ctx.close();
|
|
115
97
|
}
|
|
@@ -117,18 +99,17 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
117
99
|
/* R7 phone and dark theme */
|
|
118
100
|
{
|
|
119
101
|
const { page, ctx, S } = await open({ w: 390, h: 844, theme: 'dark' });
|
|
120
|
-
|
|
121
|
-
for (const id of ['a', 'b']) await page.evaluate((x) => window.__premiumViewer.vwOpen({ id: x, title: 'A long item title ' + x, html: `<p>${x}</p>` }), id);
|
|
102
|
+
for (const id of ['a', 'b']) await page.evaluate((x) => window.__premiumViewer.vwOpen({ id: x, title: 'A long item title that does not fit on one line of a phone ' + x, html: `<p>${x}</p>` }), id);
|
|
122
103
|
const m = await page.evaluate(() => {
|
|
123
104
|
const r = (e) => e.getBoundingClientRect();
|
|
124
|
-
const
|
|
125
|
-
return {
|
|
126
|
-
over: document.documentElement.scrollWidth > window.innerWidth,
|
|
127
|
-
bg: getComputedStyle(document.querySelector('#vTabs .vtab[aria-selected="true"]')).backgroundColor };
|
|
105
|
+
const v = document.querySelector('#czViewer'), ib = [...v.querySelectorAll('.cz-vw-ib')];
|
|
106
|
+
return { ibH: Math.min(...ib.map((t) => r(t).height)), ibW: Math.min(...ib.map((t) => r(t).width)), w: r(v).width, h: r(v).height,
|
|
107
|
+
over: document.documentElement.scrollWidth > window.innerWidth, bg: getComputedStyle(v).backgroundColor };
|
|
128
108
|
});
|
|
129
|
-
ok('R7
|
|
130
|
-
ok('R7 the
|
|
131
|
-
ok('R7
|
|
109
|
+
ok('R7 the card covers the screen at 390px', m.w >= 389 && m.h >= 843, JSON.stringify(m));
|
|
110
|
+
ok('R7 the header buttons are at least 44px at 390px', m.ibH >= 44 && m.ibW >= 44, JSON.stringify(m));
|
|
111
|
+
ok('R7 the page does not scroll sideways', !m.over, JSON.stringify(m));
|
|
112
|
+
ok('R7 in the dark theme the card is not a light card', (() => { const c = (m.bg.match(/\d+/g) || []).slice(0, 3).map(Number); return c.length === 3 && c[0] + c[1] + c[2] < 3 * 160; })(), m.bg);
|
|
132
113
|
ok('R7 no page error', S.errors.length === 0, S.errors.join(' | '));
|
|
133
114
|
await ctx.close();
|
|
134
115
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
/* premium-vw-backlog-test.js — the Jira backlog as a viewer tab on the premium Board (initiative premium-viewer, R10, R7; planning/prd/premium-viewer-prd.md).
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Re-pointed for premium-agreed-design: the Agreed Board has no Sprint card and opens no dialog, so the backlog is reached the way the
|
|
5
|
+
* viewer still offers it: the sprint view's "Open the backlog", with the sprint view opened through its module over a task dialog of the
|
|
6
|
+
* initiative page. GET /api/boards/sprints and the page models are stand-ins. The Board is checked to carry none of it. Every wait polls the page; no fixed sleep stands in for a state. */
|
|
6
7
|
const path = require('path');
|
|
7
8
|
const { spawn } = require('child_process');
|
|
8
9
|
const { findBrowser } = require('./lib/find-browser');
|
|
9
10
|
const T = require('./test-run').configure({ name: 'premium-vw-backlog' });
|
|
10
11
|
const BP = require('./lib/board-premium.js');
|
|
11
12
|
const F = require('./fixtures/board-premium-facts.js');
|
|
13
|
+
const IP = require('./lib/initiative-premium.js');
|
|
14
|
+
const IF = require('./fixtures/initiative-premium-facts.js');
|
|
15
|
+
const IMODEL = IP.build(IF.facts());
|
|
12
16
|
|
|
13
17
|
const BASE = T.BASE;
|
|
14
18
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
@@ -50,50 +54,56 @@ const SPRINTS = { ok: true, source: 'jira', readAt: '2026-10-19T09:00:00Z', velo
|
|
|
50
54
|
await page.route('**/api/board-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model, as_of: Date.now() }) }));
|
|
51
55
|
await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [] }) }));
|
|
52
56
|
await page.route('**/api/boards/sprints*', (r) => { S.reads.push(new URL(r.request().url()).search); r.fulfill({ contentType: 'application/json', body: JSON.stringify(sprints) }); });
|
|
53
|
-
await page.
|
|
54
|
-
|
|
57
|
+
await page.route('**/api/initiative-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: IMODEL, as_of: Date.now() }) }));
|
|
58
|
+
await page.goto(BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1&theme=' + theme);
|
|
59
|
+
// the Board's expand link lands on Home's initiative layout (premium-agreed-design); its Overview has the Sprint press, and the Viewer shows one item at a time
|
|
60
|
+
S.up = await until(() => page.evaluate(() => !!document.querySelector('.hm-card [data-hm-ov]') && !!window.__premiumViewer && !!window.__premiumVwJira), 20000);
|
|
61
|
+
if (S.up) { if (!(await page.locator('.hm-card [data-hm-ov]').isVisible())) await page.click('#hmNeeds'); await page.click('.hm-card [data-hm-ov]'); /* a phone: the initiative card is in the top bar's sheet */ S.up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer [data-ov-sprint]'))); }
|
|
62
|
+
S.reads.length = 0;
|
|
55
63
|
return { page, ctx, S };
|
|
56
64
|
};
|
|
65
|
+
const toSprint = async (page) => {
|
|
66
|
+
if (!(await page.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-ov-sprint]')))) { if (!(await page.locator('.hm-card [data-hm-ov]').isVisible())) await page.click('#hmNeeds'); await page.click('.hm-card [data-hm-ov]'); }
|
|
67
|
+
await until(() => page.evaluate(() => !!document.querySelector('#czViewer [data-ov-sprint]')), 5000);
|
|
68
|
+
await page.click('#czViewer [data-ov-sprint]');
|
|
69
|
+
return until(() => page.evaluate(() => !!document.querySelector('#czViewer .obody.vw[data-vw="sprint:w1"] [data-jbl]')), 5000);
|
|
70
|
+
};
|
|
57
71
|
const openBacklog = async (page) => {
|
|
58
|
-
|
|
59
|
-
await page.click('#
|
|
60
|
-
|
|
61
|
-
const btn = await page.$('#openBacklog');
|
|
62
|
-
if (!btn) return false;
|
|
63
|
-
await page.evaluate(() => document.querySelector('#openBacklog').click());
|
|
64
|
-
return until(() => page.evaluate(() => document.querySelectorAll('#dOut .obody.vw .bl-s').length > 0), 5000);
|
|
72
|
+
if (!(await toSprint(page))) return false;
|
|
73
|
+
await page.click('#czViewer .obody.vw[data-vw="sprint:w1"] [data-jbl]');
|
|
74
|
+
return until(() => page.evaluate(() => document.querySelectorAll('#czViewer .obody.vw .bl-s').length > 0), 5000);
|
|
65
75
|
};
|
|
76
|
+
const curId = (page) => page.evaluate(() => { const e = document.querySelectorAll('#czViewer:not([hidden]) .obody.vw'); return e.length === 1 ? e[0].dataset.vw : [...e].map((x) => x.dataset.vw).join(); });
|
|
66
77
|
const read = (page) => page.evaluate(() => {
|
|
67
|
-
const p = document.querySelector('#
|
|
78
|
+
const p = document.querySelector('#czViewer:not([hidden]) .obody.vw');
|
|
68
79
|
return { secs: p ? [...p.querySelectorAll('.bl-s')].map((s) => [s.querySelector('.bl-h b').textContent, [...s.querySelectorAll('.bl-k')].map((k) => k.textContent)]) : [],
|
|
69
|
-
text: p ? p.textContent.replace(/\s+/g, ' ') : '',
|
|
80
|
+
text: p ? p.textContent.replace(/\s+/g, ' ') : '', on: p ? p.dataset.vw : null };
|
|
70
81
|
});
|
|
71
82
|
|
|
72
83
|
/* R10 desktop */
|
|
73
84
|
{
|
|
74
85
|
const { page, ctx, S } = await open();
|
|
75
|
-
ok('R10 the
|
|
76
|
-
ok('R10 the sprint
|
|
86
|
+
ok('R10 Home loads the initiative with its Overview open', S.up);
|
|
87
|
+
ok('R10 the sprint view has "Open the backlog", and it opens the backlog in the Viewer', await openBacklog(page));
|
|
77
88
|
let s = await read(page);
|
|
78
|
-
ok('R10 the
|
|
89
|
+
ok('R10 the backlog is the Viewer\'s one item, and the initiative is still the page behind it', s.on === 'backlog:w1' && await page.evaluate(() => new URLSearchParams(location.search).get('ini') === 'self-serve-v2' && !!document.querySelector('.hm-card [data-hm-ov]')), JSON.stringify(s.on));
|
|
79
90
|
ok('R10 the board is read with its workspace and board', S.reads.length >= 1 && S.reads.every((q) => /board=w1/.test(q) && /ws=w1/.test(q)), JSON.stringify(S.reads));
|
|
80
91
|
ok('R10 the open sprints first, then the Backlog, each with its tickets by key', JSON.stringify(s.secs) === '[["S 14",["P-1","P-2"]],["S 15",[]],["Backlog",["P-3","Q-2"]]]', JSON.stringify(s.secs));
|
|
81
92
|
ok('R10 it says what it leaves out and that Jira owns rank and sprint', /Only the tickets this board's initiatives pushed/.test(s.text) && /Ranking and moving between sprints happen in Jira/.test(s.text));
|
|
82
|
-
ok('R10 a blocked ticket says why; points and initiative are shown', /Flagged in Jira/.test(s.text) && /3 points, 1 not estimated/.test(s.text) && await page.evaluate(() => document.querySelectorAll('#
|
|
83
|
-
ok('R10 nothing can be dragged or sent to Jira', await page.evaluate(() => !document.querySelector('#
|
|
84
|
-
await page.click('#
|
|
93
|
+
ok('R10 a blocked ticket says why; points and initiative are shown', /Flagged in Jira/.test(s.text) && /3 points, 1 not estimated/.test(s.text) && await page.evaluate(() => document.querySelectorAll('#czViewer .obody.vw .bl-in').length === 4));
|
|
94
|
+
ok('R10 nothing can be dragged or sent to Jira', await page.evaluate(() => !document.querySelector('#czViewer .obody.vw[data-vw="backlog:w1"] [draggable="true"]') && !/Send to Jira/.test(document.querySelector('#czViewer .obody.vw[data-vw="backlog:w1"]').textContent)));
|
|
95
|
+
await page.click('#czViewer .obody.vw [data-f="bug"]');
|
|
85
96
|
s = await read(page);
|
|
86
97
|
ok('R10 the Bugs filter keeps the bug and says when a section has none', JSON.stringify(s.secs.map((x) => x[1])) === '[[],[],["Q-2"]]' && /None match this filter/.test(s.text), JSON.stringify(s.secs));
|
|
87
|
-
await page.click('#
|
|
98
|
+
await page.click('#czViewer .obody.vw [data-f="blocked"]');
|
|
88
99
|
s = await read(page);
|
|
89
100
|
ok('R10 the Blocked filter keeps the blocked ticket', JSON.stringify(s.secs.map((x) => x[1])) === '[["P-2"],[],[]]', JSON.stringify(s.secs));
|
|
90
|
-
await page.click('#
|
|
91
|
-
await page.click('#
|
|
92
|
-
ok('R10 a row opens its ticket in the
|
|
93
|
-
await page
|
|
94
|
-
await
|
|
95
|
-
await
|
|
96
|
-
ok('R10 the sprint tab\'s "Open the backlog" opens the backlog tab', await until(() => page.evaluate(() => window.__premiumViewer.vwState().on === 'backlog:w1'), 5000));
|
|
101
|
+
await page.click('#czViewer .obody.vw [data-f=""]');
|
|
102
|
+
await page.click('#czViewer .obody.vw [data-tk="Q-2"]');
|
|
103
|
+
ok('R10 a row opens its ticket in the Viewer, in place of the backlog', await until(async () => (await curId(page)) === 'jira:Q-2', 5000), JSON.stringify(await curId(page)));
|
|
104
|
+
await toSprint(page);
|
|
105
|
+
await page.click('#czViewer .obody.vw[data-vw="sprint:w1"] [data-jbl]');
|
|
106
|
+
ok('R10 the sprint view\'s "Open the backlog" opens the backlog again', await until(async () => (await curId(page)) === 'backlog:w1', 5000));
|
|
97
107
|
ok('R10 no page error', S.errors.length === 0, S.errors.join(' | '));
|
|
98
108
|
await ctx.close();
|
|
99
109
|
}
|
|
@@ -101,22 +111,32 @@ const SPRINTS = { ok: true, source: 'jira', readAt: '2026-10-19T09:00:00Z', velo
|
|
|
101
111
|
/* R10 no reading */
|
|
102
112
|
{
|
|
103
113
|
const { page, ctx, S } = await open({ sprints: { ok: true, source: 'none', readAt: null, sprints: [], velocity: [], backlog: { readAt: null, issues: [], points: null, links: {} } } });
|
|
104
|
-
await page.evaluate(() =>
|
|
105
|
-
await page.
|
|
106
|
-
await until(() => page.evaluate(() => !!document.querySelector('#openBacklog')), 5000);
|
|
107
|
-
await page.evaluate(() => document.querySelector('#openBacklog').click());
|
|
108
|
-
ok('R10 with no Jira reading the tab says so', await until(() => page.evaluate(() => /No Jira reading for this board yet/.test((document.querySelector('#dOut .obody.vw[data-vw="backlog:w1"]') || {}).textContent || '')), 5000));
|
|
114
|
+
await page.evaluate(() => window.__premiumVwBacklog ? window.__premiumVwBacklog.openBacklog({ ws: 'w1', board: 'w1' }) : import('/pm/premium-vw-backlog.js').then((m) => m.openBacklog({ ws: 'w1', board: 'w1' })));
|
|
115
|
+
ok('R10 with no Jira reading the tab says so', await until(() => page.evaluate(() => /No Jira reading for this board yet/.test((document.querySelector('#czViewer .obody.vw[data-vw="backlog:w1"]') || {}).textContent || '')), 5000));
|
|
109
116
|
ok('R10 no page error (no reading)', S.errors.length === 0, S.errors.join(' | '));
|
|
110
117
|
await ctx.close();
|
|
111
118
|
}
|
|
112
119
|
|
|
120
|
+
/* the Agreed Board (premium-agreed-design) carries no Sprint card, no backlog button and no dialog of its own */
|
|
121
|
+
{
|
|
122
|
+
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), page = await ctx.newPage(), errs = [];
|
|
123
|
+
page.on('pageerror', (e) => errs.push(String((e && e.message) || e)));
|
|
124
|
+
const model = BP.build(F.facts({ sprints: { source: 'jira', readAt: SPRINTS.readAt, sprints: [SPRINT] } }));
|
|
125
|
+
await page.route('**/api/board-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model, as_of: Date.now() }) }));
|
|
126
|
+
await page.goto(BASE + '/premium-board.html');
|
|
127
|
+
const up = await until(() => page.evaluate(() => document.querySelectorAll('#ibBody .bt-l').length > 0), 20000);
|
|
128
|
+
ok('R10 the Agreed Board has no Sprint card or backlog button; its sprint chip opens the read-only Sprint and release panel, "Waiting for design"', up && await page.evaluate(() => !document.querySelector('#cSpr, #openBacklog, #popSpr')) && (await page.click('#chSprint'), await until(() => page.evaluate(() => { const k = document.querySelector('#peek'); return !!k && !k.hidden && (document.querySelector('#pkTitle') || {}).textContent === 'Sprint and release' && /Waiting for design/.test(k.textContent) && !document.querySelector('#peek [data-jbl]') && !!!document.querySelector('#dlg.on'); }))));
|
|
129
|
+
ok('R10 no page error on the Board', errs.length === 0, errs.join(' | '));
|
|
130
|
+
await ctx.close();
|
|
131
|
+
}
|
|
132
|
+
|
|
113
133
|
/* R7 phone and dark theme */
|
|
114
134
|
{
|
|
115
135
|
const { page, ctx, S } = await open({ w: 390, h: 844, theme: 'dark' });
|
|
116
136
|
ok('R7 the backlog opens at 390px', await openBacklog(page));
|
|
117
137
|
await page.evaluate(() => Promise.race([Promise.all(document.getAnimations().filter((a) => a.effect && a.effect.getTiming().iterations !== Infinity).map((a) => a.finished.catch(() => {}))), new Promise((r) => setTimeout(r, 3000))])); // the dialog's open transition scales its buttons: measure them once it ends
|
|
118
138
|
const m = await page.evaluate(() => {
|
|
119
|
-
const p = document.querySelector('#
|
|
139
|
+
const p = document.querySelector('#czViewer:not([hidden]) .obody.vw');
|
|
120
140
|
const small = [...p.querySelectorAll('button')].filter((b) => b.getBoundingClientRect().width && b.getBoundingClientRect().height < 44).map((b) => b.textContent.trim().slice(0, 20));
|
|
121
141
|
return { small, wide: document.documentElement.scrollWidth > window.innerWidth + 1, bg: getComputedStyle(p.querySelector('.bl-s')).backgroundColor };
|
|
122
142
|
});
|