create-pmos 0.692.0 → 0.694.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 +22 -16
- package/payload/KIT-VERSION +1 -1
- 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/workspace/adler-moments-test.js +3 -35
- package/workspace/adler-seasons-test.js +1 -1
- package/workspace/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-doc-edit-test.js +1 -1
- package/workspace/briefing-premium-work-test.js +2 -2
- package/workspace/changelog.json +21 -2
- package/workspace/chat-asks-test.js +1 -1
- package/workspace/core-docs-workflow-test.js +1 -1
- package/workspace/ev-everywhere-test.js +3 -14
- package/workspace/guide/home.md +2 -2
- package/workspace/guide/layout.md +2 -2
- package/workspace/guide/settings-and-switches.md +0 -1
- package/workspace/impact-screens-test.js +2 -47
- package/workspace/ini-workflow-test.js +1 -1
- package/workspace/lib/board-grill.js +17 -24
- package/workspace/lib/discovery-questions.js +36 -0
- package/workspace/lib/routes-board-grill.js +31 -3
- package/workspace/live-pill-round-test.js +6 -18
- package/workspace/milestone-suggest-test.js +4 -28
- package/workspace/news-viewers-test.js +3 -29
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +3 -3
- package/workspace/premium-briefing-depth-test.js +4 -4
- package/workspace/premium-chat-attach-test.js +3 -2
- package/workspace/premium-chat-chart-tab-test.js +8 -7
- package/workspace/premium-chat-context-test.js +3 -1
- package/workspace/premium-chat-goal-view-test.js +3 -1
- package/workspace/premium-chat-line-test.js +8 -6
- package/workspace/premium-chat-report-tab-test.js +13 -5
- package/workspace/premium-chat-term-test.js +2 -2
- package/workspace/premium-chat-viewer-test.js +10 -16
- package/workspace/premium-core-doc-issue-test.js +7 -2
- package/workspace/premium-discuss-landing-test.js +9 -5
- package/workspace/premium-html-viewer-test.js +7 -3
- package/workspace/premium-link-suggest-test.js +6 -10
- package/workspace/premium-phone-card-test.js +2 -2
- package/workspace/premium-viewer-download-test.js +1 -1
- package/workspace/premium-viewer-flicker-test.js +1 -1
- package/workspace/premium-viewer-share-test.js +2 -2
- package/workspace/premium-viewer-test.js +1 -1
- package/workspace/premium-vw-cal-test.js +1 -1
- package/workspace/premium-vw-copy-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +1 -1
- package/workspace/premium-vw-item-test.js +1 -1
- package/workspace/premium-work-depth-test.js +2 -2
- package/workspace/program-charter-test.js +1 -12
- package/workspace/program-leave-test.js +2 -2
- package/workspace/program-order-test.js +3 -65
- package/workspace/project-onboard-flow-test.js +5 -5
- package/workspace/public/pm/bd-asks.js +6 -5
- package/workspace/public/pm/cozy-home.css +0 -6
- package/workspace/public/pm/cozy-panels.js +2 -6
- package/workspace/public/pm/cozy-popup.css +1 -0
- package/workspace/public/pm/cozy-popup.js +15 -2
- package/workspace/public/pm/cozy-today-page.css +1 -1
- package/workspace/public/pm/cozy-today.css +0 -14
- package/workspace/public/pm/cozy-viewer.js +14 -38
- package/workspace/public/pm/goal-chat.js +2 -2
- package/workspace/public/pm/home-app.js +8 -67
- package/workspace/public/pm/home-chat.js +1 -1
- package/workspace/public/pm/home-ses-name.js +3 -2
- package/workspace/public/pm/home-today.js +4 -18
- package/workspace/public/pm/ini-view-model.js +2 -2
- package/workspace/public/pm/premium-board.js +1 -1
- package/workspace/public/premium-intelligence.html +1 -1
- package/workspace/public/premium-viewer.html +1 -1
- package/workspace/public/premium-workflows.html +1 -1
- package/workspace/ready-dash-ui-test.js +1 -1
- package/workspace/rename-test.js +2 -2
- package/workspace/server.js +11 -12
- package/workspace/session-names-test.js +34 -56
- package/workspace/sort-order-test.js +2 -71
- package/workspace/split-merge-ui-test.js +1 -1
- package/workspace/stage-card-tasks-test.js +1 -1
- package/workspace/stage-card-test.js +1 -1
- package/workspace/task-card-test.js +1 -1
- package/workspace/task-press-test.js +1 -1
- package/workspace/task-views-test.js +1 -1
- package/workspace/test-lists/adler-seasons-art.json +3 -6
- package/workspace/test-lists/batch18-asks.json +1 -1
- package/workspace/test-lists/briefing-premium.json +1 -11
- package/workspace/test-lists/discovery-three-questions.json +5 -0
- package/workspace/test-lists/premium-agreed-viewer.json +1 -1
- package/workspace/test-run.js +0 -2
- package/workspace/test-timings.json +0 -4
- package/workspace/tk-tasks-test.js +3 -17
- package/workspace/viewer-trail-test.js +2 -2
- package/workspace/workflows-setup-test.js +4 -2
- package/workspace/adler-seasons-art-test.js +0 -116
- package/workspace/briefing-premium-initiative-test.js +0 -289
- package/workspace/briefing-premium-products-test.js +0 -209
- package/workspace/briefing-premium-sources-test.js +0 -250
- package/workspace/briefing-premium-test.js +0 -282
- package/workspace/home-other-product-test.js +0 -197
- package/workspace/home-pill-test.js +0 -138
- package/workspace/home-railcard-test.js +0 -196
- package/workspace/home-rows-test.js +0 -389
- package/workspace/panels-test.js +0 -454
- package/workspace/public/premium.html +0 -48
- package/workspace/test-lists/batch18-panels.json +0 -9
- package/workspace/test-lists/home-railcard.json +0 -9
- package/workspace/test-lists/home-sessions-pill.json +0 -6
- package/workspace/test-lists/viewer-home-rows.json +0 -9
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
/* briefing-premium-test.js — the premium Briefing, now Home in the Agreed design (initiative briefing-premium, planning/prd/briefing-premium-prd.md
|
|
4
|
-
* R1 to R13; re-pointed by premium-agreed-design: the Briefing, My work, Chat and the initiative page are one Home — a list, a chat and the
|
|
5
|
-
* Viewer — so the old hero, rail, dock, "N of M done" and row dialog are gone by design, and their checks move to what replaced them).
|
|
6
|
-
* Serves the real page from the real server and answers GET /api/briefing-premium with the model lib/briefing-premium.js builds from a
|
|
7
|
-
* fixture (fixtures/briefing-premium-facts.js), so the page is checked against known data.
|
|
8
|
-
* R1 Home is the default page; the console stays at /console.html and nothing on Home links to it; the place menu; Settings and Ctrl K
|
|
9
|
-
* R2 the list head: Today, New with its four choices, and the fold
|
|
10
|
-
* R4 the one list (premium-uncovered-features, canvas HmMyWork): no Needs you group and no Your list; each next step is a row of its
|
|
11
|
-
* group with its tile, title and hint, the greeting counts them; the first row opens its chat and its Viewer
|
|
12
|
-
* R8 on a phone the list is the page (canvas HmPhone) and its greeting counts the same next steps
|
|
13
|
-
* R9 a page that cannot read the repository says so
|
|
14
|
-
* R10 a page where nothing was pressed to record sends only GETs
|
|
15
|
-
* W1-W8 record a decision, put a row off, start an agent; the POST answers are mocked here, the refusals are the real server's
|
|
16
|
-
* R11 floors: 44 px targets on a phone, no sideways scroll at 390 px in both themes, Escape closes the Viewer
|
|
17
|
-
* R12 fidelity to the Agreed design at 1440 and 390 px, light and dark: cozy tokens, the 316 px list, the selected row's lift
|
|
18
|
-
* H4 the program panel's links into Home (initiative program-hierarchy): ?item=pt:<program>:<key> and ?ask=program:<id>
|
|
19
|
-
* Every wait polls the page. */
|
|
20
|
-
const fs = require('fs');
|
|
21
|
-
const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
|
|
22
|
-
const path = require('path');
|
|
23
|
-
const { spawn } = require('child_process');
|
|
24
|
-
const { findBrowser } = require('./lib/find-browser');
|
|
25
|
-
const T = require('./test-run').configure({ name: 'briefing-premium' });
|
|
26
|
-
const B = require('./lib/briefing-premium.js');
|
|
27
|
-
const F = require('./fixtures/briefing-premium-facts.js');
|
|
28
|
-
|
|
29
|
-
const BASE = T.BASE;
|
|
30
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
31
|
-
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
32
|
-
const results = [];
|
|
33
|
-
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
34
|
-
let srv = null; let browser = null;
|
|
35
|
-
const finish = async (code) => {
|
|
36
|
-
if (browser) await browser.close().catch(() => {});
|
|
37
|
-
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
38
|
-
T.killTmux();
|
|
39
|
-
const bad = results.filter((x) => !x.cond).length;
|
|
40
|
-
console.log(`\n${results.length - bad}/${results.length} briefing-premium assertions passed`);
|
|
41
|
-
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
42
|
-
};
|
|
43
|
-
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
44
|
-
const MODEL = B.build(F.facts());
|
|
45
|
-
const NEEDS = '#hmList .hm-r[data-id^="n:"]'; // the next steps: rows of the one list, in their product or under Not in an initiative
|
|
46
|
-
const vw = () => { const v = document.querySelector('#czViewer:not([hidden])'); return v ? { kind: (v.querySelector('.cz-vw-kind') || {}).textContent || '', title: (v.querySelector('#czVwTitle') || {}).textContent || '', text: v.textContent } : null; };
|
|
47
|
-
|
|
48
|
-
(async () => {
|
|
49
|
-
const exe = findBrowser();
|
|
50
|
-
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the briefing-premium suite cannot run'); return finish(1); }
|
|
51
|
-
let chromium;
|
|
52
|
-
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed — the briefing-premium suite cannot run'); return finish(1); }
|
|
53
|
-
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
54
|
-
await T.waitForServer(BASE);
|
|
55
|
-
browser = classicBoard(await chromium.launch({ executablePath: exe }));
|
|
56
|
-
|
|
57
|
-
const open = async ({ w = 1440, h = 900, theme = 'light', model = MODEL, fail = false, mock = true, touch = false, programs = null, qs = '' } = {}) => {
|
|
58
|
-
const ctx = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: theme, hasTouch: touch });
|
|
59
|
-
const page = await ctx.newPage();
|
|
60
|
-
const errors = [], reqs = [], posts = [];
|
|
61
|
-
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
62
|
-
page.on('request', (r) => { if (!r.url().startsWith(BASE)) return; const u = new URL(r.url()); reqs.push(r.method() + ' ' + u.pathname); if (r.method() === 'POST') posts.push({ path: u.pathname, body: (() => { try { return JSON.parse(r.postData() || 'null'); } catch { return null; } })(), headers: r.headers() }); });
|
|
63
|
-
const json = (body, status = 200) => (r) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(body) });
|
|
64
|
-
await page.route(/\/api\/briefing-premium(\?.*)?$/, fail ? json({ ok: false, error: 'the repository could not be read' }, 500) : json({ ok: true, state: 'ready', model, as_of: Date.now() }));
|
|
65
|
-
if (fail) await page.route(/\/api\/board-premium(\?.*)?$/, json({ ok: false, error: 'the repository could not be read' }, 500));
|
|
66
|
-
if (programs) await page.route('**/api/programs', json({ ok: true, programs }));
|
|
67
|
-
await page.route('**/api/briefing-premium/thread**', json({ ok: true, turns: [], working: false }));
|
|
68
|
-
if (mock) for (const act of ['decide', 'put-off', 'return', 'start']) await page.route('**/api/briefing-premium/' + act + '*', json({ ok: true, session: 's-new' }));
|
|
69
|
-
if (mock) await page.route('**/api/agent/start*', json({ ok: true, session: 's-new', id: 's-new' })); // Start opens a real agent session: answered here
|
|
70
|
-
// Home's card depends on the hour (the evening shows the day's recap, not the greeting): the page reads a fixed morning clock, so
|
|
71
|
-
// the suite gives the same answer at any time of day
|
|
72
|
-
const am = new Date(); am.setHours(10, 0, 0, 0); await page.clock.setFixedTime(am);
|
|
73
|
-
await page.goto(BASE + '/premium.html?theme=' + theme + qs);
|
|
74
|
-
const up = await until(() => page.evaluate((sel) => document.querySelectorAll(sel).length > 0 || /could not read/.test((document.querySelector('#hmList') || {}).textContent || ''), NEEDS), 20000);
|
|
75
|
-
return { ctx, page, errors, reqs, posts, up };
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/* R1 */
|
|
79
|
-
const A = await open();
|
|
80
|
-
ok('0 the page draws the list', !!A.up);
|
|
81
|
-
if (!A.up) return finish(1);
|
|
82
|
-
const p = A.page;
|
|
83
|
-
{ const def = await fetch(BASE + '/').then((r) => r.text());
|
|
84
|
-
ok('R1 the premium Home is the default page', /class="cz cz-home( pm-ds)?"/.test(def) && !/id="c3-root"/.test(def));
|
|
85
|
-
const gone = await Promise.all(['/console.html', '/classic.html'].map((u) => fetch(BASE + u, { redirect: 'manual' })));
|
|
86
|
-
ok('R1 /console.html and /classic.html go to Home: the console and the classic page are deleted', gone.every((r) => r.status === 302 && /\/premium\.html$/.test(r.headers.get('location') || '')), gone.map((r) => r.status).join());
|
|
87
|
-
const old = await fetch(BASE + '/c3.html', { redirect: 'manual' }); ok('R1 /c3.html with no query goes to Home', old.status === 302 && /\/premium\.html$/.test(old.headers.get('location') || ''));
|
|
88
|
-
const rail = await p.evaluate(() => ({ gone: !document.querySelector('nav.rail, .rail [data-go], #dlg'), places: [...document.querySelectorAll('#czMenu a')].map((a) => (a.querySelector('span, b') || a).textContent.trim() + '>' + a.getAttribute('href')), cur: (document.querySelector('#czMenu [aria-current="page"]') || {}).textContent || '' }));
|
|
89
|
-
ok('R1 no old rail and no old dialog; the places are Today, Work and Goals (slice 1) and Today is current', rail.gone && /^Today>\/today\.html,Work>\/premium-board\.html,Goals>\/premium-goals\.html(,(Events|Library|Routine)>\/premium-[a-z]+\.html)*$/.test(rail.places.join()) && /Today/.test(rail.cur), JSON.stringify(rail));
|
|
90
|
-
ok('R1 nothing on Home links to the console', await p.evaluate(() => !document.querySelector('a[href*="console"], a[href*="c3.html"], [data-href*="console"]')));
|
|
91
|
-
// premium-uncovered-features (EvSettings): Settings is its own dialog, opened from the place menu
|
|
92
|
-
if (await p.isVisible('#czFab')) await p.click('#czFab'); await p.click('[data-cz-settings]');
|
|
93
|
-
const st = await until(() => p.evaluate(() => { const d = document.querySelector('#evSettings:not([hidden])'); return d ? d.getAttribute('aria-label') + ' ' + ((d.querySelector('h2') || {}).textContent || '') : null; }));
|
|
94
|
-
ok('R1 Settings opens its dialog', !!st && /Settings/.test(st), String(st));
|
|
95
|
-
await p.keyboard.press('Escape');
|
|
96
|
-
ok('R11 Escape closes Settings', !!(await until(() => p.evaluate(() => !document.querySelector('#evSettings:not([hidden])')))));
|
|
97
|
-
await p.route('**/api/sessions', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ sessions: [{ id: 's1', name: 'Fix the footer', state: 'idle', shown: 'quiet' }] }) }));
|
|
98
|
-
await p.keyboard.press('Control+k');
|
|
99
|
-
// premium-uncovered-features (EvSearch): Search is the palette over the page
|
|
100
|
-
ok('SB2 Ctrl K opens Search with the box focused', !!(await until(() => p.evaluate(() => !!document.querySelector('#evSearch:not([hidden]) #evQ') && document.activeElement && document.activeElement.id === 'evQ'))), await p.evaluate(() => JSON.stringify({ sp: !!document.querySelector('#evSearch:not([hidden])'), act: document.activeElement && (document.activeElement.id || document.activeElement.tagName) })));
|
|
101
|
-
await p.keyboard.type('fix');
|
|
102
|
-
ok('SB4 typing finds the session by its name', !!(await until(() => p.evaluate(() => [...document.querySelectorAll('#evRes .ev-mi')].some((b) => /Fix the footer/.test(b.textContent))))));
|
|
103
|
-
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#evSearch:not([hidden])')));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/* R2 */
|
|
107
|
-
{ await p.click('[data-hm-new]');
|
|
108
|
-
const nw = await until(() => p.evaluate(() => { const m = document.querySelector('#hmMenu:not([hidden])'); return m ? [...m.querySelectorAll('[role=menuitem], button')].map((b) => b.textContent.trim()).filter(Boolean) : null; }));
|
|
109
|
-
ok('R2 the list head is the greeting (Home A + C, HvAC), and New offers its four kinds, one word each (batch 14 item 10, canvas PmAHome)', await p.evaluate(() => /^Good (morning|afternoon|evening)$/.test(document.querySelector('#hmList .hm-hd [data-hm-day] b').textContent)) && !!nw && nw.length === 4 && /^Task/.test(nw[0]) && /^Chat/.test(nw[1]) && /^Recording/.test(nw[2]) && /^Initiative/.test(nw[3]), JSON.stringify(nw));
|
|
110
|
-
ok('R2 New is headed New and has no sub lines (no "What is it for?")', await p.evaluate(() => { const m = document.querySelector('#hmMenu:not([hidden])'); return !!m && m.querySelector('.hm-ml').textContent === 'New' && !m.querySelector('em'); }));
|
|
111
|
-
await p.keyboard.press('Escape');
|
|
112
|
-
// batch 18 item 15 (TbT1Split) put one icon-only fold back on the list head, after New: it folds the list to the rail
|
|
113
|
-
ok('R2 the list head has one icon-only fold, last, named for a screen reader', await p.evaluate(() => { const f = document.querySelectorAll('#hmList .hm-hd [data-hm-fold]'); return f.length === 1 && !f[0].textContent.trim() && f[0].getAttribute('aria-label') === 'Fold the list to the rail' && !f[0].nextElementSibling; })); }
|
|
114
|
-
|
|
115
|
-
/* R4 */
|
|
116
|
-
{ const L = await p.evaluate((sel) => ({ rows: [...document.querySelectorAll(sel)].map((r) => ({ id: r.dataset.id, t: r.querySelector('.hm-rt b').textContent, h: (r.querySelector('.hm-rm') || {}).title || '', mark: !!r.querySelector('.hv-mk .hv-d, .hv-mk .hv-ck, .hv-mk svg') })), more: (document.querySelector('[data-hm-allneeds]') || {}).textContent || '', sel: (document.querySelector('.hm-r.sel') || {}).dataset ? document.querySelector('.hm-r.sel').dataset.id : null }), NEEDS);
|
|
117
|
-
const G = await p.evaluate(() => ({ groups: [...document.querySelectorAll('#hmList [aria-label]')].map((g) => g.getAttribute('aria-label')), greet: (document.querySelector('#hmList .hv-sub') || {}).textContent || '' }));
|
|
118
|
-
ok('R4 Home has no Needs you group and no Your list; every next step of the model is a row of the one list', !G.groups.includes('Needs you') && !G.groups.includes('Your list') && MODEL.list.rows.every((m) => L.rows.some((r) => r.id === 'n:' + m.key)), JSON.stringify({ G, n: L.rows.length, want: MODEL.list.rows.length }));
|
|
119
|
-
ok('R4 every row is one line: its mark (a dot or a check box) and its title (HvAC)', L.rows.every((r) => r.mark && r.t.length > 3), JSON.stringify(L.rows));
|
|
120
|
-
ok('R4 no "N are yours" line: the count is Your move\'s (chief-of-staff delete list)', !/(\d+) (?:is|are) yours/.test(G.greet), G.greet);
|
|
121
|
-
ok('R4 on a desktop the first next step is selected when Home opens', !!L.sel && L.rows.some((r) => r.id === L.sel), JSON.stringify(L));
|
|
122
|
-
const r0 = L.rows.find((r) => r.id === 'n:waited:reviews') || L.rows[0];
|
|
123
|
-
await p.click(`.hm-r[data-id="${r0.id}"] .hm-rm`); // Settings and Search took the Viewer above; selecting the row again opens its own
|
|
124
|
-
const v0 = await until(() => p.evaluate(vw));
|
|
125
|
-
// the Viewer names the thing the ask is about (batch 18 item 2-A: "5 failed reviews", the initiative's name), not the row's verb
|
|
126
|
-
ok('R4 the selected row opens its Viewer beside its chat', !!v0 && !!v0.title && await p.evaluate((id) => (window.czViewer.current() || {}).id === 'need:' + id.slice(2) && !!document.querySelector('#hmLog'), r0.id), JSON.stringify(v0));
|
|
127
|
-
const selBg = await p.evaluate(() => getComputedStyle(document.querySelector('.hm-r.sel')).backgroundColor);
|
|
128
|
-
ok('R12 the selected row is tinted (HvACDesk .sel)', selBg && !/rgba\(0, 0, 0, 0\)|transparent/.test(selBg), selBg);
|
|
129
|
-
const hd = await p.evaluate(() => { const h = document.querySelector('#hmCh'); return h && !h.hidden ? { t: (h.querySelector('.hm-chb') || {}).textContent || '', mark: !!h.querySelector('.hv-mk .hv-d, .hv-mk .hv-ck'), y: Math.round(h.getBoundingClientRect().top), size: getComputedStyle(h.querySelector('.hm-chb')).fontSize } : null; });
|
|
130
|
-
ok('R12 the chat\'s header line names the open row: its mark and its title, 15 px (the row title role, batch 26 item 6), at the top of the chat card (HvACDesk .ch)', !!hd && hd.t === r0.t && hd.mark && hd.y === 32 && hd.size === '15px', JSON.stringify(hd)); }
|
|
131
|
-
|
|
132
|
-
/* R10 */
|
|
133
|
-
ok('R10 a page where nothing was pressed to record sends no POST', A.posts.filter((x) => /briefing-premium\/(decide|put-off|return|start)/.test(x.path)).length === 0, JSON.stringify(A.posts.map((x) => x.path)));
|
|
134
|
-
|
|
135
|
-
/* W1-W7: record a decision (batch 18 item 2-A, OvA2Decide): the choices, the why and Record are in the Viewer; the chat's pills open it */
|
|
136
|
-
{ const key = 'decision:KC5';
|
|
137
|
-
await p.click(`.hm-r[data-id="n:${key}"] .hm-rm`);
|
|
138
|
-
const v = await until(() => p.evaluate(() => { const x = document.querySelector('#czViewer:not([hidden]) .nv-dec'); return x && x.querySelector('[data-nv-opt]') ? [...x.querySelectorAll('[data-nv-opt]')].map((b) => b.dataset.nvOpt) : null; }));
|
|
139
|
-
ok('W1 the decision opens in the Viewer with its three choices, none picked (no pick is on record)', JSON.stringify(v) === JSON.stringify(['reshape', 'extend', 'retire']) && await p.evaluate(() => !document.querySelector('#czViewer [data-nv-opt][aria-checked="true"]')), JSON.stringify(v));
|
|
140
|
-
ok('W1 with no pick on record the one primary is Weigh it for me, and nothing says to record on a card in the chat', await p.evaluate(() => { const v = document.querySelector('#czViewer'); return (v.querySelector('.czs-pri') || {}).textContent === 'Weigh it for me' && !/card in the chat/.test(v.textContent); }));
|
|
141
|
-
ok('W1 the chat beside it asks a question and its pills are the choices', await p.evaluate(() => /\?/.test(document.querySelector('#hmLog').textContent) && [...document.querySelectorAll('#hmLog button')].some((b) => /Extend the date/.test(b.textContent)) && !document.querySelector('#hmLog .ut-dec')));
|
|
142
|
-
const btn = () => p.evaluate(() => { const b = document.querySelector('#czViewer [data-nv-rec]'); return { dis: b.disabled, t: b.textContent }; });
|
|
143
|
-
const pick = (k) => p.click(`#czViewer [data-nv-opt="${k}"]`);
|
|
144
|
-
ok('W1 before a choice the record button is off', (await btn()).dis);
|
|
145
|
-
await pick('extend');
|
|
146
|
-
const b1 = await btn();
|
|
147
|
-
ok('W1 with a choice and no reason it is still off, and it names the choice', b1.dis && /Record: extend the date/.test(b1.t), JSON.stringify(b1));
|
|
148
|
-
await p.fill('#nvWhy', 'ok');
|
|
149
|
-
ok('W1 a reason under three characters keeps it off', (await btn()).dis);
|
|
150
|
-
await p.fill('#nvWhy', 'The partner needs two more weeks');
|
|
151
|
-
ok('W1 a choice and a reason turn it on', !(await btn()).dis);
|
|
152
|
-
await p.click('#czViewer [data-nv-rec]');
|
|
153
|
-
const post = await until(() => A.posts.find((x) => x.path === '/api/briefing-premium/decide'));
|
|
154
|
-
ok('W6 the press posts the key, the choice and the reason, and no writer field', !!post && post.body.key === key && post.body.choice === 'extend' && post.body.why === 'The partner needs two more weeks' && !('by' in post.body), JSON.stringify(post && post.body));
|
|
155
|
-
ok('W7 a recorded press says where it was recorded', !!(await until(() => p.evaluate(() => /pm-decisions\.md/.test(document.querySelector('#toast').textContent)))));
|
|
156
|
-
/* W3 put off: the clock press in the Viewer's header */
|
|
157
|
-
const k2 = 'decision:premium-ux';
|
|
158
|
-
await p.click(`.hm-r[data-id="n:${k2}"] .hm-rm`);
|
|
159
|
-
await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-cz-vw-p="later"]')));
|
|
160
|
-
ok('W3 Put off is one icon in the Viewer\'s header beside Pin (aria-pressed), and its menu stays shut until pressed', await p.evaluate(() => { const m = document.querySelector('#hmMenu'), pin = document.querySelector('#czViewer [data-cz-vw-p="pin"]'); return (!m || m.hidden) && !!pin && pin.getAttribute('aria-pressed') === 'false' && document.querySelector('#czViewer [data-cz-vw-p="later"]').getAttribute('aria-label') === 'Put off'; }));
|
|
161
|
-
await p.click('#czViewer [data-cz-vw-p="later"]');
|
|
162
|
-
ok('W3 its menu has three live choices', await p.evaluate(() => [...document.querySelectorAll('#hmMenu:not([hidden]) [data-hm-mi] b')].map((b) => b.textContent).join() === 'Later today,Tomorrow,Next week'));
|
|
163
|
-
await p.locator('#hmMenu [data-hm-mi]').filter({ hasText: 'Tomorrow' }).first().click();
|
|
164
|
-
ok('W3 "Tomorrow" posts the key and the time', !!(await until(() => A.posts.find((x) => x.path === '/api/briefing-premium/put-off' && x.body.key === k2 && x.body.until === 'tomorrow'))));
|
|
165
|
-
/* the row's × puts it off until tomorrow */
|
|
166
|
-
const k3 = 'blocked:onboarding-scan';
|
|
167
|
-
await p.click(`.hm-r[data-id="n:${k3}"] .hm-rm`).catch(() => {}); // Home A + C: the × shows on the open row only
|
|
168
|
-
await p.click(`.hm-r[data-id="n:${k3}"] [data-hm-end]`).catch(() => {});
|
|
169
|
-
ok('W3 the row\'s × puts it off until tomorrow', !!(await until(() => A.posts.find((x) => x.path === '/api/briefing-premium/put-off' && x.body.key === k3))));
|
|
170
|
-
/* W8 start (OvA1Start, OvA1After) */
|
|
171
|
-
const k4 = 'blocked:console-3-boards';
|
|
172
|
-
await p.click(`.hm-r[data-id="n:${k4}"] .hm-rm`);
|
|
173
|
-
await until(() => p.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-czs-act="start"]')));
|
|
174
|
-
const s0 = await p.evaluate(() => { const v = document.querySelector('#czViewer'); return { line: (v.querySelector('.czs-line') || {}).textContent || '', offer: (v.querySelector('.nv-offer') || {}).textContent || '', cost: (v.querySelector('.nv-cost') || {}).textContent || '', pri: (v.querySelector('.czs-pri') || {}).textContent || '', own: (v.querySelector('.nv-own') || {}).textContent || '' }; });
|
|
175
|
-
ok('W8 a blocked row says what is missing, offers ✦ what PMOS drafts (batch 25 item 6: a concrete proposal), says what waiting costs, and holds ONE verb', s0.line === 'Blocked: the spec is missing' && /^I can draft the PRD/.test(s0.offer) && /^If it waits: /.test(s0.cost) && s0.pri === 'Draft the PRD' && /Yours to unblock · New feature/.test(s0.own), JSON.stringify(s0));
|
|
176
|
-
await p.click('[data-czs-act="start"]');
|
|
177
|
-
const sp = await until(() => { const l = A.posts.filter((x) => x.path === '/api/agent/start'); return l.length ? l : null; });
|
|
178
|
-
ok('W8 Start posts one agent start for that row', !!sp && sp.length === 1, JSON.stringify(A.posts.map((x) => [x.path, x.body])));
|
|
179
|
-
const s1 = await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); const l = v && v.querySelector('.czs-line'); return l && /^Drafting the PRD/.test(l.textContent) ? { stop: !!v.querySelector('[data-czs-act="stop"][aria-label="Stop the agent"]'), chat: !!v.querySelector('[data-czs-act="talk"]'), pri: !!v.querySelector('.czs-pri') } : null; }));
|
|
180
|
-
ok('W8 after Start the same card says what the agent does now, with Stop and its chat and no other verb (OvA1After)', !!s1 && s1.stop && s1.chat && !s1.pri, JSON.stringify(s1));
|
|
181
|
-
const mint = await T.nonce(BASE);
|
|
182
|
-
const writes = A.posts.filter((x) => /briefing-premium\/(decide|put-off)|\/api\/agent\/start/.test(x.path));
|
|
183
|
-
ok('W5 every press carried the launch nonce the server minted', !!mint && writes.length >= 4 && writes.every((x) => x.headers['x-pmos-nonce'] === mint), String(mint).slice(0, 4) + ' ' + writes.length);
|
|
184
|
-
ok('0 no page error on the write flow', A.errors.length === 0, A.errors.join(' | '));
|
|
185
|
-
}
|
|
186
|
-
await A.ctx.close();
|
|
187
|
-
|
|
188
|
-
/* W6: a refused press keeps the Viewer and the typed reason */
|
|
189
|
-
{ const R = await open({ mock: false });
|
|
190
|
-
await R.page.route('**/api/briefing-premium/decide*', (r) => r.fulfill({ status: 409, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'This decision is already on record.' }) }));
|
|
191
|
-
await R.page.click('.hm-r[data-id="n:decision:KC5"] .hm-rm');
|
|
192
|
-
await until(() => R.page.evaluate(() => !!document.querySelector('#czViewer [data-nv-opt]')));
|
|
193
|
-
await R.page.click('#czViewer [data-nv-opt="retire"]'); await R.page.fill('#nvWhy', 'No longer worth the date'); await R.page.click('#czViewer [data-nv-rec]');
|
|
194
|
-
ok('W6 a refused press shows the server reason, keeps the Viewer and keeps the typed reason', !!(await until(() => R.page.evaluate(() => /already on record/.test((document.querySelector('#nvMsg') || {}).textContent || '') && document.querySelector('#nvWhy').value === 'No longer worth the date'))));
|
|
195
|
-
await R.ctx.close(); }
|
|
196
|
-
|
|
197
|
-
{
|
|
198
|
-
// the real server refuses what it must, with requests that cannot write
|
|
199
|
-
// The browser steps above can leave fetch's pooled socket idle past the server's 5 s keep-alive, so the first
|
|
200
|
-
// GET / can meet a reset socket and T.nonce() answers ''. One plain GET first opens a fresh socket.
|
|
201
|
-
await fetch(BASE + '/').then((r) => r.text()).catch(() => '');
|
|
202
|
-
const hdr = await T.pressHeaders(BASE);
|
|
203
|
-
const send = (h, body, route = 'decide') => fetch(BASE + '/api/briefing-premium/' + route, { method: 'POST', headers: h, body: JSON.stringify(body) }).then(async (r) => ({ s: r.status, j: await r.json().catch(() => ({})) }));
|
|
204
|
-
const good = { key: 'decision:nope', choice: 'kill', why: 'test only' };
|
|
205
|
-
const noN = await send({ 'Content-Type': 'application/json', Origin: BASE }, good);
|
|
206
|
-
const nonce = await T.nonce(BASE);
|
|
207
|
-
ok('W5 a press without the launch nonce is refused', !nonce || noN.s === 403, JSON.stringify(noN));
|
|
208
|
-
const ag = await send({ ...hdr, 'x-pmos-session': 'sess-1' }, good);
|
|
209
|
-
ok('W5 D98: an agent session is not refused as an agent: its press is checked like the PM\'s (an unknown prototype is 404)', ag.s === 404, JSON.stringify(ag));
|
|
210
|
-
const wf = await send(hdr, { ...good, by: 'pm' });
|
|
211
|
-
ok('W5 a body with a writer field is refused with 400', wf.s === 400, JSON.stringify(wf));
|
|
212
|
-
const before = fs.readFileSync(path.join(__dirname, '..', 'pm-decisions.md'), 'utf8');
|
|
213
|
-
const bad = await send(hdr, { key: 'decision:../../x', choice: 'kill', why: 'test only' });
|
|
214
|
-
const none = await send(hdr, { key: 'decision:proto-does-not-exist', choice: 'kill', why: 'test only' });
|
|
215
|
-
const after = fs.readFileSync(path.join(__dirname, '..', 'pm-decisions.md'), 'utf8');
|
|
216
|
-
ok('W6 a bad key and an unknown prototype are refused and pm-decisions.md is unchanged', bad.s === 400 && none.s === 404 && before === after, JSON.stringify([bad, none]));
|
|
217
|
-
const askBad = await send(hdr, { key: '../x', text: 'q' }, 'ask');
|
|
218
|
-
const askAgent = await send({ ...hdr, 'x-pmos-session': 'sess-1' }, { key: '../x', text: 'q' }, 'ask');
|
|
219
|
-
const askNoNonce = await send({ 'Content-Type': 'application/json', Origin: BASE }, { key: 'decision:KC5', text: 'q' }, 'ask');
|
|
220
|
-
const askWriter = await send(hdr, { key: 'decision:KC5', text: 'q', by: 'pm' }, 'ask');
|
|
221
|
-
ok('A7 the ask route refuses a missing nonce (403), a writer field (400) and a bad key (400), for an agent session too (D98: checked, not refused as an agent), and starts nothing', askAgent.s === 400 && (!nonce || askNoNonce.s === 403) && askWriter.s === 400 && askBad.s === 400, JSON.stringify([askAgent, askNoNonce, askWriter, askBad]));
|
|
222
|
-
const thr = await fetch(BASE + '/api/briefing-premium/thread?key=../x').then((r) => r.status);
|
|
223
|
-
const thrGet = await fetch(BASE + '/api/briefing-premium/ask').then((r) => r.status);
|
|
224
|
-
ok('A7 the thread route refuses a bad key and the ask route refuses GET', thr === 400 && thrGet === 405, JSON.stringify([thr, thrGet]));
|
|
225
|
-
const get = await fetch(BASE + '/api/briefing-premium/decide').then((r) => r.status);
|
|
226
|
-
ok('W5 a GET on a recording route is refused', get === 405, String(get));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
/* R9 */
|
|
231
|
-
{ const E = await open({ fail: true });
|
|
232
|
-
ok('R9 a page that cannot read the repository says so', !!(await until(() => E.page.evaluate(() => /Home could not read the repository/.test(document.querySelector('#hmList').textContent)))));
|
|
233
|
-
await E.ctx.close(); }
|
|
234
|
-
|
|
235
|
-
/* R8, R11, R12 on a phone, both themes */
|
|
236
|
-
for (const theme of ['light', 'dark']) {
|
|
237
|
-
const P = await open({ w: 390, h: 844, theme, touch: true });
|
|
238
|
-
// Home A + C (HvAC, XvAPhDay): the list folds "Not in an initiative" on a phone; every next step is in Your day, which "Good morning" opens
|
|
239
|
-
await until(() => P.page.evaluate(() => { const l = document.querySelector('#hmList'); return l && getComputedStyle(l).display !== 'none' && !!document.querySelector('#hmList .hv-sub'); }));
|
|
240
|
-
const top = await P.page.evaluate(() => (document.querySelector('#hmList .hv-sub') || {}).textContent || '');
|
|
241
|
-
// Your day is an item in the Viewer, full screen on a phone (XvAPhDay): the same rows, split since batch 15 item 3 (design E) into the
|
|
242
|
-
// calls of Your move, Drafted for you and Can wait
|
|
243
|
-
await P.page.click('#hmList [data-hm-day]');
|
|
244
|
-
const rows = await until(() => P.page.evaluate(() => document.querySelectorAll('#czViewer:not([hidden]) .yd [data-id^="n:"]').length));
|
|
245
|
-
await P.page.evaluate(() => window.czViewer.close());
|
|
246
|
-
ok(`R8 (${theme}) on a phone the list is the page, Your day lists every next step, and no "N are yours" line`, rows >= MODEL.list.rows.length && !/(\d+) (?:is|are) yours/.test(top) && await P.page.evaluate(() => document.body.classList.contains('hm-plist')), JSON.stringify({ top, rows }));
|
|
247
|
-
const small = await P.page.evaluate(() => [...document.querySelectorAll('#hmTop button, #hmList .hm-rm, #hmFoot button, #hmFoot label')].filter((b) => b.offsetParent !== null).map((b) => b.getBoundingClientRect()).filter((r) => r.height && r.height < 43.5).length);
|
|
248
|
-
ok(`R11 (${theme}) every control on the phone's top bar, sheet and composer is 44 px`, small === 0, String(small));
|
|
249
|
-
const ov = await P.page.evaluate(() => document.documentElement.scrollWidth - innerWidth);
|
|
250
|
-
ok(`R11 no sideways scroll at 390 px (${theme})`, ov <= 0, String(ov));
|
|
251
|
-
const fs16 = await P.page.evaluate(() => [...document.querySelectorAll('textarea, input:not([type=file])')].filter((e) => e.offsetParent !== null && parseFloat(getComputedStyle(e).fontSize) < 16).length);
|
|
252
|
-
ok(`R11 on a touch phone every text field is at least 16 px, so focus does not zoom the page (${theme})`, fs16 === 0, String(fs16));
|
|
253
|
-
ok(`0 no page error at 390 (${theme})`, P.errors.length === 0, P.errors.join(' | '));
|
|
254
|
-
await P.ctx.close();
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/* H4 the program panel's links into Home: ?item=pt:<program>:<key> selects that program task; ?ask=program:<id> opens the chat with the program as its scope */
|
|
258
|
-
{ const PR = require('./fixtures/program-ascent.js').programs();
|
|
259
|
-
const T1 = await open({ programs: PR, qs: '&item=pt:project-ascent:pt-vendor-form' });
|
|
260
|
-
const s1 = await until(() => T1.page.evaluate(() => { const h = document.querySelector('#hmCh'); return h && !h.hidden && /Sign the CIAM/.test(h.textContent) ? { rows: document.querySelectorAll('#hmList [data-id^="pt:"]').length, head: h.textContent, chip: ((document.querySelector('#hmFoot [data-hm-scope]') || {}).textContent || '') } : null; }));
|
|
261
|
-
// Home lists no tasks (feedback batch 4, item 4): the program's tasks are on its panel; the link still opens that task's chat
|
|
262
|
-
ok('H4 ?item=pt:<program>:<key> opens that program task\'s chat, the program\'s, and Home lists no task row', !!s1 && s1.rows === 0 && /Sign the CIAM vendor order form/.test(s1.head) && /Project Ascent/.test(s1.head) && /In: Project Ascent/.test(s1.chip), JSON.stringify(s1));
|
|
263
|
-
await T1.ctx.close();
|
|
264
|
-
const T2 = await open({ programs: PR, qs: '&ask=program:project-ascent&label=Project%20Ascent' });
|
|
265
|
-
const s2 = await until(() => T2.page.evaluate(() => { const c = document.querySelector('#hmFoot [data-hm-scope]'); return c && /Project Ascent/.test(c.textContent) ? { chip: c.textContent, head: (document.querySelector('#hmCh .hm-chb') || {}).textContent || '', sel: !!document.querySelector('.hm-r.sel') } : null; }));
|
|
266
|
-
ok('H4 ?ask=program:<id> opens the chat with the program as its scope, and selects no row', !!s2 && s2.head === 'Project Ascent' && !s2.sel, JSON.stringify(s2));
|
|
267
|
-
ok('0 no page error on the program links', T1.errors.length === 0 && T2.errors.length === 0, T1.errors.concat(T2.errors).join(' | '));
|
|
268
|
-
await T2.ctx.close();
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/* R12 fidelity at 1440, light and dark */
|
|
272
|
-
for (const theme of ['light', 'dark']) {
|
|
273
|
-
const D = await open({ theme });
|
|
274
|
-
const f = await D.page.evaluate(() => {
|
|
275
|
-
const desk = document.querySelector('#hmDesk'), list = document.querySelector('#hmList'), cs = getComputedStyle(document.querySelector('#hmChat')), r = list.getBoundingClientRect();
|
|
276
|
-
return { inset: Math.round(r.left), radius: cs.borderTopLeftRadius, list: Math.round(list.getBoundingClientRect().width), font: getComputedStyle(document.body).fontFamily, theme: document.documentElement.dataset.theme || '', bg: getComputedStyle(document.body).backgroundColor, rail: !!document.querySelector('nav.rail'), menu: !!document.querySelector('#czMenu, .cz-nav') };
|
|
277
|
-
});
|
|
278
|
-
ok(`R12 Home follows the Home A + C design at 1440 px (HvACDesk), ${theme}: the list after the rail of places (slice 1: the desk at 12 + 72 + 12 px, the list 16 px inside it) and 360 px wide, the chat a card with a 24 px radius, Plus Jakarta Sans, the place menu, no old rail`, f.inset === 112 && f.radius === '24px' && f.list === 360 && /Plus Jakarta Sans/.test(f.font) && f.menu && !f.rail, JSON.stringify(f));
|
|
279
|
-
await D.ctx.close();
|
|
280
|
-
}
|
|
281
|
-
return finish();
|
|
282
|
-
})();
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
/* home-other-product-test.js — an initiative and a product of ANOTHER product Home reads (testing fix, 2026-10-25). Home on IDPF also lists
|
|
4
|
-
* Microsites as its own group (D.others). Pressing a Microsites initiative read it from IDPF's board, so the Viewer said "The initiative could
|
|
5
|
-
* not be read", and pressing the Microsites heading moved the whole page to the Microsites workspace, so the IDPF chat was gone.
|
|
6
|
-
* O1 a Microsites initiative is read from the Microsites board (ws=microsites), and its page opens in the Viewer under its own title
|
|
7
|
-
* O2 the chat is the initiative's own, named by its title (its target carries ws=microsites)
|
|
8
|
-
* O3 the Microsites heading opens its page in the Viewer and Home stays on IDPF: no navigation, the list keeps the IDPF group
|
|
9
|
-
* O5 its chat's first message starts a session in Microsites, and "A new session" (In: chip, + New) starts a second one beside it
|
|
10
|
-
* O6 batch 11 item 10: an initiative `pmos initiative new` made in Microsites sits in Later, so the Microsites model does not list it. Its
|
|
11
|
-
* next step (tagged ws=microsites) puts it on Home; pressing it reads it from Microsites, never IDPF's board, under its title
|
|
12
|
-
* O8 batch 14 item 9: the product's name in its page's header renames it (POST /api/workspaces/rename), with Undo
|
|
13
|
-
* O7 the same initiative opened by a link with no next step: the read on IDPF fails, the Microsites one finds it, and its chat is Microsites'
|
|
14
|
-
* Serves the real page from the real server; the reads are fixtures (fixtures/program-ascent.js through the Board and Home fixtures). */
|
|
15
|
-
const path = require('path');
|
|
16
|
-
const { spawn } = require('child_process');
|
|
17
|
-
const { findBrowser } = require('./lib/find-browser');
|
|
18
|
-
const { besidePage } = require('./lib/beside-page'); // these checks are about work beside the page, not the popup
|
|
19
|
-
const T = require('./test-run').configure({ name: 'home-other-product' });
|
|
20
|
-
const IP = require('./lib/initiative-premium.js');
|
|
21
|
-
const F = require('./fixtures/initiative-premium-facts.js');
|
|
22
|
-
const BP = require('./lib/board-premium.js');
|
|
23
|
-
const BF = require('./fixtures/board-premium-facts.js');
|
|
24
|
-
const BRP = require('./lib/briefing-premium.js');
|
|
25
|
-
const BRF = require('./fixtures/briefing-premium-facts.js');
|
|
26
|
-
|
|
27
|
-
const BASE = T.BASE;
|
|
28
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
29
|
-
const until = async (fn, ms = 20000, step = 100) => { const t0 = Date.now(); for (;;) { let v = null; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
30
|
-
const results = [];
|
|
31
|
-
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 400) : ''}`); };
|
|
32
|
-
let srv = null; let browser = null;
|
|
33
|
-
const finish = async (code) => {
|
|
34
|
-
if (browser) await browser.close().catch(() => {});
|
|
35
|
-
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
36
|
-
T.killTmux();
|
|
37
|
-
const bad = results.filter((x) => !x.cond).length;
|
|
38
|
-
console.log(`\n${results.length - bad}/${results.length} home-other-product assertions passed`);
|
|
39
|
-
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
40
|
-
};
|
|
41
|
-
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
42
|
-
|
|
43
|
-
const ID = 'psle-refresh', TITLE = 'PSLE microsite refresh'; // a Microsites initiative (fixtures/program-ascent.js)
|
|
44
|
-
// the Microsites initiative's model: the Initiatives fixture, as this initiative on the Microsites board
|
|
45
|
-
const model = () => { const m = IP.build(F.facts()); return { ...m, id: ID, key: 'init:' + ID, title: TITLE, board: { ...m.board, ws: 'microsites', id: 'microsites', name: 'Microsites' } }; };
|
|
46
|
-
|
|
47
|
-
(async () => {
|
|
48
|
-
const exe = findBrowser();
|
|
49
|
-
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
50
|
-
let chromium;
|
|
51
|
-
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
52
|
-
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
53
|
-
await T.waitForServer(BASE);
|
|
54
|
-
browser = besidePage(await chromium.launch({ executablePath: exe }));
|
|
55
|
-
|
|
56
|
-
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
|
|
57
|
-
const page = await ctx.newPage();
|
|
58
|
-
const errors = [], reads = [], opens = [];
|
|
59
|
-
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
60
|
-
page.on('load', () => opens.push(page.url())); // a full load; pushState and replaceState are not one
|
|
61
|
-
const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
|
|
62
|
-
// the real route reads the board the query names: the Microsites initiative is not on IDPF's board, so a read there is a 404
|
|
63
|
-
await page.route('**/api/initiative-premium*', (r) => {
|
|
64
|
-
const q = new URL(r.request().url()).searchParams; reads.push({ id: q.get('id'), ws: q.get('ws'), board: q.get('board') });
|
|
65
|
-
if (q.get('id') === ID && q.get('ws') === 'microsites') return json(r, { ok: true, state: 'ready', model: model(), as_of: Date.now() });
|
|
66
|
-
return json(r, { ok: false, state: 'error', error: 'no work-lane initiative ' + q.get('id') + ' in this workspace' }, 404);
|
|
67
|
-
});
|
|
68
|
-
await page.route(/\/api\/board-premium(\?.*)?$/, (r) => { const ws = new URL(r.request().url()).searchParams.get('ws') || 'idpf'; return json(r, { ok: true, state: 'ready', model: BP.build(BF.programFacts(ws)), as_of: Date.now() }); });
|
|
69
|
-
await page.route(/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BRP.buildMany(BRF.programFacts()), as_of: Date.now() }));
|
|
70
|
-
await page.route('**/api/programs', (r) => json(r, { ok: true, programs: [] })); // no program: each initiative sits in its product's group
|
|
71
|
-
await page.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
|
|
72
|
-
await page.goto(BASE + '/premium.html?ws=idpf');
|
|
73
|
-
const row = `#hmList [data-hm-sel="i:${ID}"]`;
|
|
74
|
-
const listed = await until(async () => {
|
|
75
|
-
// a closed group opens; "N more" opens the rows with no call (home-nav-rows-with-a-call)
|
|
76
|
-
await page.evaluate(() => document.querySelectorAll('#hmList [data-hm-pg][aria-expanded="false"], #hmList .hv-fold[aria-expanded="false"]').forEach((b) => b.click())).catch(() => {});
|
|
77
|
-
return page.evaluate((s) => { const b = document.querySelector(s); return !!b && !!b.offsetParent; }, row);
|
|
78
|
-
}, 40000);
|
|
79
|
-
ok('O0 Home on IDPF lists the Microsites initiative in the Microsites group', listed);
|
|
80
|
-
|
|
81
|
-
await page.click(row);
|
|
82
|
-
const V = '#czViewer:not([hidden])';
|
|
83
|
-
const st = await until(() => page.evaluate((v) => { const o = document.querySelector(v); if (!o) return null; if (o.querySelector('[data-hi-v="page"]')) return 'ok'; return /could not be read/.test(o.textContent) ? 'err' : null; }, V), 30000);
|
|
84
|
-
ok('O1 the initiative\'s page opens in the Viewer, not "The initiative could not be read"', st === 'ok', st);
|
|
85
|
-
const last = reads.filter((x) => x.id === ID).pop();
|
|
86
|
-
ok('O1 it is read from the Microsites board', !!last && last.ws === 'microsites' && last.board === 'microsites', JSON.stringify(reads));
|
|
87
|
-
ok('O1 the Viewer names it by its title, not its id', await until(() => page.evaluate((a) => ((document.querySelector(a[0] + ' .cz-vw-title, ' + a[0] + ' h1, ' + a[0] + ' [data-cz-vw-title]') || {}).textContent || '').includes(a[1]), [V, TITLE]), 5000));
|
|
88
|
-
ok('O2 the chat is the initiative\'s own, named by its title', await page.evaluate((t) => (document.querySelector('#hmChat textarea, textarea') || {}).placeholder === 'Message PMOS about ' + t, TITLE));
|
|
89
|
-
|
|
90
|
-
// O3 the Microsites heading: its page in the Viewer, Home stays on IDPF
|
|
91
|
-
const navs = opens.length;
|
|
92
|
-
const head = await page.evaluate(() => { const b = [...document.querySelectorAll('#hmList [data-hm-prodopen]')].find((x) => /Microsites/.test(x.getAttribute('aria-label') || '')); if (!b) return false; b.click(); return true; });
|
|
93
|
-
ok('O3 the Microsites heading is pressable', head);
|
|
94
|
-
ok('O3 its page opens in the Viewer with its goals', await until(() => page.evaluate((v) => { const o = document.querySelector(v); return !!o && !!o.querySelector('[aria-label="Goals"]') && /Microsites/.test(o.textContent); }, V), 10000));
|
|
95
|
-
await sleep(500);
|
|
96
|
-
ok('O3 Home stays on IDPF: no navigation, and the IDPF group is still in the list', opens.length === navs && new URL(page.url()).searchParams.get('ws') === 'idpf' && await page.evaluate(() => [...document.querySelectorAll('#hmList [data-hm-prodopen]')].some((b) => /IDPF/.test(b.getAttribute('aria-label') || ''))), JSON.stringify(opens.slice(navs)) + ' ' + page.url());
|
|
97
|
-
ok('O3 the chat is the Microsites product\'s own', await page.evaluate(() => (document.querySelector('#hmChat textarea, textarea') || {}).placeholder === 'Message PMOS about Microsites'));
|
|
98
|
-
// O8 batch 14 item 9 (Wawan, "Should be able to rename product"): the product's name in its page's header is the rename press. It saves
|
|
99
|
-
// the PM's name for the repository (POST /api/workspaces/rename, the id stays) and the header shows the new name.
|
|
100
|
-
const renames = [];
|
|
101
|
-
await page.route('**/api/workspaces/rename', (r) => { renames.push(JSON.parse(r.request().postData() || '{}')); return json(r, { ok: true, workspace: { id: 'microsites', name: 'Microsites web', label: 'Microsites web' } }); });
|
|
102
|
-
const rnBtn = await until(() => page.evaluate((v) => { const b = document.querySelector(v + ' [data-cz-vw-rn]'); if (!b || !/Microsites/.test(b.textContent)) return false; b.click(); return true; }, V), 5000);
|
|
103
|
-
ok('O8 the product\'s name in its page header is a rename press', rnBtn);
|
|
104
|
-
if (rnBtn) { await page.fill(V + ' [data-cz-vw-ren] input', 'Microsites web'); await page.keyboard.press('Enter'); }
|
|
105
|
-
ok('O8 it saves the name for the Microsites repository', await until(() => renames.length === 1, 5000) && renames[0].id === 'microsites' && renames[0].name === 'Microsites web', JSON.stringify(renames));
|
|
106
|
-
ok('O8 the header shows the new name, with Undo in the toast', await until(() => page.evaluate((v) => /Microsites web/.test((document.querySelector(v + ' #czVwTitle') || {}).textContent || '') && /Undo/.test((document.querySelector('#toast') || {}).textContent || ''), V), 5000));
|
|
107
|
-
// O5 a product's chat starts its first session and, like an initiative, a new one beside it (batch 9 item 3, Wawan 2026-10-26: "I can't
|
|
108
|
-
// initiate a new session" on pmos-scarlet). Each send asks with the product's own key in its own workspace; a new session has the next key.
|
|
109
|
-
const asks = [];
|
|
110
|
-
await page.route('**/api/briefing-premium/ask*', (r) => { asks.push({ ws: new URL(r.request().url()).searchParams.get('ws'), ...JSON.parse(r.request().postData() || '{}') }); return json(r, { ok: true, session: 'sess-' + asks.length, started: true }); });
|
|
111
|
-
await page.fill('#hmIn', 'How is Microsites doing?'); await page.keyboard.press('Enter');
|
|
112
|
-
ok('O5 the first message starts the Microsites product chat in its workspace', await until(() => asks.length === 1, 5000) && asks[0].key === 'chat:product:microsites' && asks[0].ws === 'microsites', JSON.stringify(asks));
|
|
113
|
-
await page.click('#hmChat [data-hm-scope]');
|
|
114
|
-
const fresh = await until(() => page.evaluate(() => { const b = [...document.querySelectorAll('#hmMenu [role=menuitem], #hmMenu button')].find((x) => /A new session/.test(x.textContent)); if (!b) return null; const sub = b.textContent; b.click(); return sub; }), 3000);
|
|
115
|
-
ok('O5 its In: chip offers "A new session" in Microsites', !!fresh && /Microsites/.test(fresh), fresh);
|
|
116
|
-
ok('O5 the new session\'s chat is open, empty and still about Microsites', await until(() => page.evaluate(() => { const t = document.querySelector('#hmIn'); return !!t && t.placeholder === 'Message PMOS about Microsites' && /A new session in Microsites/.test(document.querySelector('#hmChat').textContent); }), 3000));
|
|
117
|
-
await page.fill('#hmIn', 'A second thread'); await page.keyboard.press('Enter');
|
|
118
|
-
ok('O5 it sends with the next key, so a second session starts beside the first', await until(() => asks.length === 2, 5000) && asks[1].key === 'chat:product:microsites:2' && asks[1].ws === 'microsites', JSON.stringify(asks));
|
|
119
|
-
await page.click('[data-hm-new]');
|
|
120
|
-
const nw = await until(() => page.evaluate(() => [...document.querySelectorAll('#hmMenu [role=menuitem], #hmMenu button')].map((x) => x.textContent).find((x) => /^Chat/.test(x)) || null), 3000);
|
|
121
|
-
ok('O5 the + New menu\'s Chat names the product on its right: "Chat Microsites" (batch 14 item 10)', !!nw && /^ChatMicrosites$/.test(nw), nw);
|
|
122
|
-
await page.keyboard.press('Escape');
|
|
123
|
-
|
|
124
|
-
// O4 a phone (Wawan, 2026-10-25): the chat is not beside the page, so the page ends with the way to its own chat
|
|
125
|
-
const pctx = await browser.newContext({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true });
|
|
126
|
-
const pp = await pctx.newPage();
|
|
127
|
-
pp.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
128
|
-
for (const [pat, fn] of [['**/api/initiative-premium*', (r) => json(r, { ok: false, state: 'error', error: 'none' }, 404)],
|
|
129
|
-
[/\/api\/board-premium(\?.*)?$/, (r) => { const ws = new URL(r.request().url()).searchParams.get('ws') || 'idpf'; return json(r, { ok: true, state: 'ready', model: BP.build(BF.programFacts(ws)), as_of: Date.now() }); }],
|
|
130
|
-
[/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BRP.buildMany(BRF.programFacts()), as_of: Date.now() })],
|
|
131
|
-
['**/api/programs', (r) => json(r, { ok: true, programs: [] })],
|
|
132
|
-
['**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false })]]) await pp.route(pat, fn);
|
|
133
|
-
await pp.goto(BASE + '/premium.html?ws=idpf');
|
|
134
|
-
const ph = await until(() => pp.evaluate(() => { const b = [...document.querySelectorAll('#hmList [data-hm-prodopen]')].find((x) => /Microsites/.test(x.getAttribute('aria-label') || '')); if (!b || !b.offsetParent) return false; b.click(); return true; }), 40000);
|
|
135
|
-
ok('O4 a phone: the Microsites heading is pressable', ph);
|
|
136
|
-
const tk = await until(() => pp.evaluate((v) => { const t = document.querySelector(v + ' .hi-talk'); return !!t && !!t.offsetParent && /Message PMOS about Microsites/.test(t.textContent); }, V), 10000);
|
|
137
|
-
ok('O4 a phone: its page ends with "Message PMOS about Microsites"', tk);
|
|
138
|
-
if (tk) await pp.click(V + ' .hi-talk');
|
|
139
|
-
ok('O4 a phone: the press opens the Microsites chat full screen, the page closed', await until(() => pp.evaluate(() => { const t = document.querySelector('#hmChat textarea, textarea'); return !document.querySelector('#czViewer:not([hidden]) .hi-talk') && !!t && !!t.offsetParent && t.placeholder === 'Message PMOS about Microsites'; }), 5000));
|
|
140
|
-
await pctx.close();
|
|
141
|
-
|
|
142
|
-
// O6, O7 (batch 11 item 10): an initiative made by `pmos initiative new` in Microsites, unplaced (Later), so not on the model's list
|
|
143
|
-
const NEW = 'psle-addon-follow-on', NEW_TITLE = 'PSLE Companion add-on follow-on plan';
|
|
144
|
-
const newModel = () => ({ ...model(), id: NEW, key: 'init:' + NEW, title: NEW_TITLE });
|
|
145
|
-
const later = async (withStep) => {
|
|
146
|
-
const c = await browser.newContext({ viewport: { width: 1440, height: 900 } });
|
|
147
|
-
const pg = await c.newPage(), rd = [], asked = [];
|
|
148
|
-
pg.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
149
|
-
await pg.route('**/api/initiative-premium*', (r) => {
|
|
150
|
-
const q = new URL(r.request().url()).searchParams; rd.push({ id: q.get('id'), ws: q.get('ws'), board: q.get('board') });
|
|
151
|
-
// the real route: a workspace's default board when none is named; an id on another board is a 404
|
|
152
|
-
if (q.get('id') === NEW && q.get('ws') === 'microsites' && (!q.get('board') || q.get('board') === 'microsites')) return json(r, { ok: true, state: 'ready', model: newModel(), as_of: Date.now() });
|
|
153
|
-
return json(r, { ok: false, state: 'error', error: 'no work-lane initiative ' + q.get('id') + ' in this workspace' }, 404);
|
|
154
|
-
});
|
|
155
|
-
await pg.route(/\/api\/board-premium(\?.*)?$/, (r) => { const ws = new URL(r.request().url()).searchParams.get('ws') || 'idpf'; return json(r, { ok: true, state: 'ready', model: BP.build(BF.programFacts(ws)), as_of: Date.now() }); });
|
|
156
|
-
await pg.route(/\/api\/briefing-premium(\?.*)?$/, (r) => {
|
|
157
|
-
const m = BRP.buildMany(BRF.programFacts());
|
|
158
|
-
if (withStep) m.list.rows = [{ key: 'blocked:' + NEW + ':microsites', kind: 'blocked', title: 'Unblock the brief step', subject: NEW_TITLE, prepared: '', product: 'Microsites', ws: 'microsites', from: [NEW] }].concat(m.list.rows || []);
|
|
159
|
-
return json(r, { ok: true, state: 'ready', model: m, as_of: Date.now() });
|
|
160
|
-
});
|
|
161
|
-
await pg.route('**/api/programs', (r) => json(r, { ok: true, programs: [] }));
|
|
162
|
-
// the last route added wins: the ask's own after the catch-all
|
|
163
|
-
await pg.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
|
|
164
|
-
await pg.route('**/api/briefing-premium/ask*', (r) => { asked.push({ ws: new URL(r.request().url()).searchParams.get('ws') }); return json(r, { ok: true, session: 'sess-x', started: true }); });
|
|
165
|
-
await pg.goto(BASE + '/premium.html?ws=idpf' + (withStep ? '' : '&ini=' + NEW));
|
|
166
|
-
return { c, pg, rd, asked };
|
|
167
|
-
};
|
|
168
|
-
const pageState = (pg) => until(() => pg.evaluate((v) => { const o = document.querySelector(v); if (!o) return null; if (o.querySelector('[data-hi-v="page"]')) return 'ok'; return /could not be read/.test(o.textContent) ? 'err' : null; }, V), 30000);
|
|
169
|
-
{
|
|
170
|
-
const { c, pg, rd } = await later(true);
|
|
171
|
-
const nrow = `#hmList [data-hm-sel="i:${NEW}"]`;
|
|
172
|
-
const seen = await until(async () => {
|
|
173
|
-
await pg.evaluate(() => document.querySelectorAll('#hmList [data-hm-pg][aria-expanded="false"]').forEach((b) => b.click())).catch(() => {});
|
|
174
|
-
return pg.evaluate((s) => { const b = document.querySelector(s); return !!b && !!b.offsetParent; }, nrow);
|
|
175
|
-
}, 40000);
|
|
176
|
-
ok('O6 the Microsites initiative in Later shows on Home under its next step', seen);
|
|
177
|
-
if (seen) await pg.click(nrow);
|
|
178
|
-
const s6 = await pageState(pg);
|
|
179
|
-
ok('O6 its page opens, not "The initiative could not be read"', s6 === 'ok', s6);
|
|
180
|
-
ok('O6 it is read from Microsites, never from IDPF\'s board', rd.some((x) => x.id === NEW && x.ws === 'microsites') && !rd.some((x) => x.id === NEW && (x.board === 'idpf' || (x.ws || 'idpf') === 'idpf')), JSON.stringify(rd));
|
|
181
|
-
ok('O6 the chat names it by its title, not its id', await until(() => pg.evaluate((t) => (document.querySelector('#hmIn') || {}).placeholder === 'Message PMOS about ' + t, NEW_TITLE), 5000), await pg.evaluate(() => (document.querySelector('#hmIn') || {}).placeholder));
|
|
182
|
-
await c.close();
|
|
183
|
-
}
|
|
184
|
-
{
|
|
185
|
-
const { c, pg, rd, asked } = await later(false);
|
|
186
|
-
const s7 = await pageState(pg);
|
|
187
|
-
ok('O7 opened by a link with no next step: its page opens from Microsites', s7 === 'ok', s7 + ' ' + JSON.stringify(rd));
|
|
188
|
-
ok('O7 the chat is its own, in Microsites', await until(() => pg.evaluate((t) => (document.querySelector('#hmIn') || {}).placeholder === 'Message PMOS about ' + t, NEW_TITLE), 5000), await pg.evaluate(() => (document.querySelector('#hmIn') || {}).placeholder));
|
|
189
|
-
await pg.fill('#hmIn', 'What is next?'); await pg.keyboard.press('Enter');
|
|
190
|
-
ok('O7 its first message starts the session in Microsites', await until(() => asked.length >= 1, 5000) && asked[0].ws === 'microsites', JSON.stringify(asked));
|
|
191
|
-
await c.close();
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
ok('no page error', errors.length === 0, errors.join(' | '));
|
|
195
|
-
await ctx.close();
|
|
196
|
-
return finish();
|
|
197
|
-
})().catch((e) => { console.error(e); finish(1); });
|