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
|
@@ -46,7 +46,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
46
46
|
const S = { errors: [] };
|
|
47
47
|
page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
|
|
48
48
|
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() }) }));
|
|
49
|
-
await page.goto(BASE + '/
|
|
49
|
+
await page.goto(BASE + '/today.html?theme=light');
|
|
50
50
|
S.up = await until(() => page.evaluate(() => document.querySelectorAll('#hmList .hm-r').length > 0 && !!window.czViewer), 20000);
|
|
51
51
|
await page.evaluate(() => {
|
|
52
52
|
const item = (x) => ({ id: 't:' + x, kind: 'Ticket', title: 'Item ' + x, icon: 'jira',
|
|
@@ -96,7 +96,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
96
96
|
// the trail list: hover ← on a desk
|
|
97
97
|
await page.hover('#czViewer [data-cz-vw="back"]');
|
|
98
98
|
const list = await until(() => page.evaluate(() => { const m = document.querySelector('#czViewer .cz-vw-trail'); return m ? [...m.querySelectorAll('button')].map((b) => b.textContent.trim() + (b.classList.contains('here') ? '*' : '')) : null; }), 3000);
|
|
99
|
-
ok('L hovering ← lists the trail, newest first, ending at the page it started on', JSON.stringify(list) === '["Item D*","Item B","Item A","
|
|
99
|
+
ok('L hovering ← lists the trail, newest first, ending at the page it started on', JSON.stringify(list) === '["Item D*","Item B","Item A","Today"]', JSON.stringify(list));
|
|
100
100
|
await page.click('#czViewer .cz-vw-trail [data-cz-vw-go="-2"]');
|
|
101
101
|
s = await at(page, 'Item A');
|
|
102
102
|
ok('L a press in the list jumps there, and → leads back along it', s && s.fwd === 'Forward to Item B' && JSON.stringify(s.trail.ahead) === '["Item B","Item D"]', JSON.stringify(s));
|
|
@@ -121,7 +121,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
121
121
|
ok('M one numbered list across To do, In progress, Done and the dashed Won\'t do · Archived column', M.cols.join('|') === "To do|In progress|Done|Won't do · Archived" && M.nums === '1,2,3,4,5,6,7,8,9,10' && M.todo.join() === 'Triage' && M.done.join() === '◆ Review', JSON.stringify(M));
|
|
122
122
|
ok('M Optional is dashed, Only when names its words, ◆ marks a milestone', M.opt && /Only when value over \$50k/.test(M.only), M.only);
|
|
123
123
|
ok('M Add a stage per column; every stage but Triage drags', M.adds === 3 && M.drag === 9 && M.triageDrag === null, JSON.stringify([M.adds, M.drag]));
|
|
124
|
-
ok('M the old address lands on
|
|
124
|
+
ok('M the old address lands on Today with Settings › Workspaces › Workflows open, wide; the address forgets ?settings and ?wf', M.where[0] === '/today.html' && !/settings=|wf=/.test(M.where[1]) && M.where[2] && M.where[3] && /^Workspaces/.test(M.where[4] || '') && M.where[5] === 'Workflows', JSON.stringify(M.where));
|
|
125
125
|
await shot(p, 'wf-model-1440');
|
|
126
126
|
|
|
127
127
|
/* ── S a stage in the Viewer (WfAStage) ── */
|
|
@@ -288,6 +288,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
288
288
|
const ask = await until(() => N.posts.find((x) => x.path === '/api/briefing-premium/ask'));
|
|
289
289
|
ok('N a message goes to the chat under a pop:workflow key, with the New workflow context', ask && /^pop:workflow:new-/.test(ask.body.key) && /workflow-setup skill/.test(JSON.stringify(ask.body.context || '')), JSON.stringify(ask && ask.body));
|
|
290
290
|
N.db.draft = F.draft();
|
|
291
|
+
// on Today the chat is the popup's (home-page-retire): close it, as the PM would, before going to Settings
|
|
292
|
+
if (await q.isVisible('.cz-pop')) { await q.keyboard.press('Escape'); await until(() => q.evaluate(() => !document.querySelector('.cz-pop:not([hidden])') || getComputedStyle(document.querySelector('.cz-pop')).display === 'none'), 3000); }
|
|
291
293
|
await openWf(q);
|
|
292
294
|
await until(() => q.evaluate(() => /Vendor onboarding/.test((document.querySelector('#wfList [data-wf="new"]') || {}).innerText || '')));
|
|
293
295
|
ok('N the draft waits in Settings › Workflows as its row, by its name', await q.evaluate(() => /Vendor onboarding\s*draft/.test(document.querySelector('#wfList [data-wf="new"]').innerText)));
|
|
@@ -357,7 +359,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
357
359
|
await g.click('#evSettings [data-ev-sub=""]');
|
|
358
360
|
ok('G ← goes back to Workspaces, the dialog its usual size, and the row "Workflows ›" is there', await until(() => g.evaluate(() => !document.querySelector('#evSettings #wfMain') && !document.querySelector('#evSettings').classList.contains('ev-wide') && !!document.querySelector('#evSettings [data-ev-sub="workflows"]'))));
|
|
359
361
|
await g.click('#evSettings [data-ev-sub="workflows"]');
|
|
360
|
-
ok('G the row opens the sub-panel in place, not a page', await until(() => g.evaluate(() => document.querySelectorAll('#evSettings .wf-card').length > 0 && location.pathname === '/
|
|
362
|
+
ok('G the row opens the sub-panel in place, not a page', await until(() => g.evaluate(() => document.querySelectorAll('#evSettings .wf-card').length > 0 && location.pathname === '/today.html')));
|
|
361
363
|
await g.click('#evSettings [data-ev-close]');
|
|
362
364
|
ok('G no page error in Settings', G.errors.length === 0, G.errors.join(' | '));
|
|
363
365
|
await G.ctx.close();
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
/* adler-seasons-art-test.js — Adler dressed for the season, in the real Home (feedback batch 18 item 8-B; canvas AsPlaces, AsSet2Tap).
|
|
4
|
-
* The real Home from the real server, at 390 px with touch and at 1280 px; the board and briefing are the fixtures. The page's clock is
|
|
5
|
-
* 09:30 on Deepavali (8 Nov 2026), and the calendar module (pm/cozy-seasons.js, 8-A's) is stubbed to answer Deepavali, so this suite tests
|
|
6
|
-
* 8-B's half only. POST /api/settings is recorded.
|
|
7
|
-
* Y1 Your day opens on the Deepavali scene (the charm's sky, the diya), and the greeting wishes it: "Happy Deepavali"
|
|
8
|
-
* Y2 the scene fits the sheet: no sideways scroll, and the scene is as wide as the card
|
|
9
|
-
* T1 a press on the scene says "Dressed for Deepavali." with two named icons; no toast said he dressed up
|
|
10
|
-
* T2 "Not this one" saves the calendar's setting (POST /api/settings) and the scene goes plain at once
|
|
11
|
-
* N no page error
|
|
12
|
-
* PMOS_SHOTS=<dir> also saves the screenshots. */
|
|
13
|
-
const path = require('path');
|
|
14
|
-
const fs = require('fs');
|
|
15
|
-
const { spawn } = require('child_process');
|
|
16
|
-
const { findBrowser } = require('./lib/find-browser');
|
|
17
|
-
const T = require('./test-run').configure({ name: 'adler-seasons-art' });
|
|
18
|
-
const BRP = require('./lib/briefing-premium.js');
|
|
19
|
-
const BRF = require('./fixtures/briefing-premium-facts.js');
|
|
20
|
-
const BP = require('./lib/board-premium.js');
|
|
21
|
-
const BF = require('./fixtures/board-premium-facts.js');
|
|
22
|
-
|
|
23
|
-
const BASE = T.BASE;
|
|
24
|
-
const SHOTS = process.env.PMOS_SHOTS || '';
|
|
25
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
26
|
-
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); } };
|
|
27
|
-
const results = [];
|
|
28
|
-
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
29
|
-
let srv = null; let browser = null;
|
|
30
|
-
const finish = async (code) => {
|
|
31
|
-
if (browser) await browser.close().catch(() => {});
|
|
32
|
-
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
33
|
-
T.killTmux();
|
|
34
|
-
const bad = results.filter((x) => !x.cond).length;
|
|
35
|
-
console.log(`\n${results.length - bad}/${results.length} adler-seasons-art assertions passed`);
|
|
36
|
-
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
37
|
-
};
|
|
38
|
-
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
39
|
-
|
|
40
|
-
// 8-A's calendar, as the page imports it: Deepavali, the day itself; "Not this one" names one setting row
|
|
41
|
-
const SEASONS = `export const charmToday = () => ({ key: 'deepavali', name: 'Deepavali', until: '2026-11-10T23:59:59', today: true });
|
|
42
|
-
export const skipThisYear = (key, now) => ({ key: 'adler.dress.skip', value: key + ':' + now.getFullYear() });`;
|
|
43
|
-
|
|
44
|
-
(async () => {
|
|
45
|
-
const exe = process.env.PMOS_CHROME || findBrowser();
|
|
46
|
-
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the adler-seasons-art suite cannot run'); return finish(1); }
|
|
47
|
-
let chromium;
|
|
48
|
-
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
49
|
-
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
50
|
-
await T.waitForServer(BASE);
|
|
51
|
-
browser = await chromium.launch({ executablePath: exe });
|
|
52
|
-
if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
|
|
53
|
-
const BRIEF = BRP.build(BRF.facts());
|
|
54
|
-
// a calm day: the fixture's two blocked rows would make Your day say the news plainly instead of the wish (home-day.js, concerned
|
|
55
|
-
// replaces it). The suite passed without this only while Home's reads were too slow to land before the press (page speed, 2026-10-29).
|
|
56
|
-
if (BRIEF.list && Array.isArray(BRIEF.list.rows)) BRIEF.list.rows = BRIEF.list.rows.filter((r) => r.kind !== 'blocked');
|
|
57
|
-
const BOARD = BP.build(BF.facts());
|
|
58
|
-
|
|
59
|
-
for (const [tag, vp] of [['390', { width: 390, height: 844, hasTouch: true, isMobile: true }], ['1280', { width: 1280, height: 860 }]]) {
|
|
60
|
-
const { width, height, ...rest } = vp;
|
|
61
|
-
const ctx = await browser.newContext({ viewport: { width, height }, ...rest });
|
|
62
|
-
const page = await ctx.newPage();
|
|
63
|
-
const errors = [], posts = [], toasts = [];
|
|
64
|
-
page.on('pageerror', (e) => errors.push(String(e)));
|
|
65
|
-
page.on('request', (rq) => { if (rq.method() === 'POST') posts.push({ path: new URL(rq.url()).pathname, body: rq.postData() || '' }); });
|
|
66
|
-
const json = (rq, b) => rq.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(b) });
|
|
67
|
-
await page.clock.setFixedTime(new Date(2026, 10, 8, 9, 30));
|
|
68
|
-
await page.route(/\/api\/board-premium(\?.*)?$/, (rq) => json(rq, { ok: true, state: 'ready', model: BOARD, as_of: Date.now() }));
|
|
69
|
-
await page.route(/\/api\/briefing-premium(\?.*)?$/, (rq) => json(rq, { ok: true, state: 'ready', model: BRIEF, as_of: Date.now() }));
|
|
70
|
-
await page.route('**/api/briefing-premium/**', (rq) => json(rq, { ok: true, turns: [], working: false }));
|
|
71
|
-
await page.route(/\/pm\/cozy-seasons\.js(\?.*)?$/, (rq) => rq.fulfill({ status: 200, contentType: 'text/javascript', body: SEASONS }));
|
|
72
|
-
await page.route(/\/api\/settings$/, (rq) => (rq.request().method() === 'POST' ? json(rq, { ok: true }) : rq.continue()));
|
|
73
|
-
await page.exposeFunction('__toast', (t) => toasts.push(t));
|
|
74
|
-
await page.addInitScript(() => {
|
|
75
|
-
document.addEventListener('DOMContentLoaded', () => { const t = document.getElementById('toast'); if (t) new MutationObserver(() => { if (t.classList.contains('on')) window.__toast(t.textContent); }).observe(t, { attributes: true }); });
|
|
76
|
-
});
|
|
77
|
-
await page.goto(BASE + '/premium.html');
|
|
78
|
-
await until(() => page.evaluate(() => !!document.querySelector('#hmList [data-hm-day]')), 30000);
|
|
79
|
-
// the calendar answers once Settings > Adler is read (cozy-nav's loadPrefs); wait for the charm before opening the day
|
|
80
|
-
await until(() => page.evaluate(() => import('/pm/cozy-adler.js').then((A) => !!A.dress())), 15000);
|
|
81
|
-
|
|
82
|
-
/* Y1-Y2 */
|
|
83
|
-
await page.click('#hmList [data-hm-day]');
|
|
84
|
-
const y1 = await until(() => page.evaluate(() => {
|
|
85
|
-
const b = document.querySelector('#czViewer .yd-open'); const sc = b && b.querySelector('.yd-scene svg.ad-scene');
|
|
86
|
-
if (!sc) return null;
|
|
87
|
-
const r = sc.getBoundingClientRect(), card = b.getBoundingClientRect();
|
|
88
|
-
return { charm: sc.classList.contains('ch-deepavali'), sky: !!sc.querySelector('.adg-deepavali0'), diya: !!sc.querySelector('image[href$="/diya.png"]'), line: b.querySelector('.yd-ht b').textContent,
|
|
89
|
-
w: Math.round(r.width), cw: Math.round(card.width), h: Math.round(r.height), scroll: document.documentElement.scrollWidth - innerWidth };
|
|
90
|
-
}), 15000);
|
|
91
|
-
ok(`Y1 ${tag} Your day opens on the Deepavali scene with the diya, and wishes it`, y1 && y1.charm && y1.sky && y1.diya && /^Happy Deepavali\b/.test(y1.line), JSON.stringify(y1));
|
|
92
|
-
ok(`Y2 ${tag} the scene fills the card's width, keeps its height, and nothing scrolls sideways`, y1 && y1.w >= y1.cw - 2 && y1.h > 60 && y1.h <= 152 && y1.scroll <= 0, JSON.stringify(y1));
|
|
93
|
-
if (SHOTS) { await sleep(400); await page.screenshot({ path: path.join(SHOTS, `day-deepavali-${tag}.png`) }); }
|
|
94
|
-
|
|
95
|
-
/* T1-T2 */
|
|
96
|
-
await page.click('#czViewer .yd-scene[data-ad-dress]');
|
|
97
|
-
const t1 = await until(() => page.evaluate(() => { const t = document.querySelector('#czViewer .ad-tip'); return t ? { text: t.querySelector('.ad-tip-t').textContent, icons: [...t.querySelectorAll('button')].map((b) => b.getAttribute('aria-label')) } : null; }));
|
|
98
|
-
ok(`T1 ${tag} a press says "Dressed for Deepavali." with "Not this one" and Dress for the day; no toast said he dressed`, t1 && t1.text === 'Dressed for Deepavali.' && t1.icons.length === 2 && /^Not this one/.test(t1.icons[0]) && !toasts.some((x) => /Deepavali|dress/i.test(x)), JSON.stringify({ t1, toasts }));
|
|
99
|
-
if (SHOTS) await page.screenshot({ path: path.join(SHOTS, `tap-${tag}.png`) });
|
|
100
|
-
// CI diagnostics (the press has timed out there with the tip detached and "not stable"): count how often Your day is drawn again after the tip opened
|
|
101
|
-
await page.evaluate(() => { window.__redraws = 0; const v = document.getElementById('czViewer'); new MutationObserver((ms) => { for (const m of ms) if ([...m.removedNodes].some((x) => x.nodeType === 1 && (x.matches('.ad-tip') || x.querySelector('.ad-tip')))) window.__redraws++; }).observe(v, { childList: true, subtree: true }); });
|
|
102
|
-
try { await page.click('#czViewer .ad-tip [data-ad-tip="skip"]', { timeout: 8000 }); }
|
|
103
|
-
catch (e) {
|
|
104
|
-
const d = await page.evaluate(() => ({ redraws: window.__redraws, tip: !!document.querySelector('.ad-tip'), btn: (() => { const b = document.querySelector('.ad-tip [data-ad-tip="skip"]'); if (!b) return null; const r = b.getBoundingClientRect(); return [r.x, r.y, r.width, r.height].map(Math.round); })(), imgs: document.querySelectorAll('#czViewer image').length }));
|
|
105
|
-
console.log(' ! T1 press needed the fallback: ' + JSON.stringify(d));
|
|
106
|
-
await page.evaluate(() => { const b = document.querySelector('.ad-tip [data-ad-tip="skip"]'); if (b) b.click(); });
|
|
107
|
-
}
|
|
108
|
-
const t2 = await until(() => page.evaluate(() => { const b = document.querySelector('#czViewer .yd-open'); return b && !b.querySelector('.ch-deepavali') && !b.querySelector('.ad-tip') ? { plain: true, btn: !!b.querySelector('[data-ad-dress]') } : null; }));
|
|
109
|
-
const saved = posts.find((p) => p.path === '/api/settings');
|
|
110
|
-
ok(`T2 ${tag} "Not this one" saves the calendar's setting, and he is plain at once`, t2 && !t2.btn && saved && JSON.parse(saved.body).key === 'adler.dress.skip' && JSON.parse(saved.body).value === 'deepavali:2026', JSON.stringify({ t2, saved }));
|
|
111
|
-
|
|
112
|
-
ok(`N ${tag} no page error`, !errors.length, JSON.stringify(errors));
|
|
113
|
-
await ctx.close();
|
|
114
|
-
}
|
|
115
|
-
return finish();
|
|
116
|
-
})();
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
/* briefing-premium-initiative-test.js — the initiative (initiative briefing-premium-initiative; planning/prd/briefing-premium-initiative-prd.md I1 to I12),
|
|
4
|
-
* re-pointed for premium-agreed-design and again for the Home list fix (canvas HbC): the initiative is a page in Home's Viewer
|
|
5
|
-
* (/premium.html?ini=<id>), the list stays the list, and the old /premium-initiative.html?id= link lands there. The page holds the stage card,
|
|
6
|
-
* three tasks and the documents that need a look; its + and "Show all N" drill into Tasks, Documents and Stage, with ← back to the page. What moved elsewhere has its own suite:
|
|
7
|
-
* a document's page premium-vw-doc-test.js, Add a document briefing-premium-adddoc-test.js, Issue it premium-core-doc-issue-test.js, the record and
|
|
8
|
-
* task views premium-vw-item-test.js, the Jira views premium-vw-jira-test.js. The old page's List / By stage / Timeline views, the document filter
|
|
9
|
-
* and search and the document sheet's tabs have no place in the Agreed design and are not drawn.
|
|
10
|
-
* Serves the real page from the real server. Most checks answer GET /api/initiative-premium with the model lib/initiative-premium.js builds from a
|
|
11
|
-
* fixture and GET /api/board-premium with lib/board-premium.js's; the last block reads this repository's own initiative through the real route.
|
|
12
|
-
* I1 place · I2 reading · I3 header · I4 overview (Tasks, Documents, Stage: premium-uncovered-features) · I6 tasks · I7 documents · I10 presses · I12 floors and fidelity */
|
|
13
|
-
const path = require('path');
|
|
14
|
-
const { spawn } = require('child_process');
|
|
15
|
-
const { findBrowser } = require('./lib/find-browser');
|
|
16
|
-
const { besidePage } = require('./lib/beside-page'); // these checks are about work beside the page, not the popup
|
|
17
|
-
const { openMission } = require('./lib/open-mission');
|
|
18
|
-
const T = require('./test-run').configure({ name: 'briefing-premium-initiative' });
|
|
19
|
-
const IP = require('./lib/initiative-premium.js');
|
|
20
|
-
const F = require('./fixtures/initiative-premium-facts.js');
|
|
21
|
-
const BP = require('./lib/board-premium.js');
|
|
22
|
-
const BF = require('./fixtures/board-premium-facts.js');
|
|
23
|
-
const BRP = require('./lib/briefing-premium.js');
|
|
24
|
-
const BRF = require('./fixtures/briefing-premium-facts.js');
|
|
25
|
-
|
|
26
|
-
const BASE = T.BASE;
|
|
27
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
28
|
-
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
29
|
-
const results = [];
|
|
30
|
-
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
31
|
-
let srv = null; let browser = null;
|
|
32
|
-
const finish = async (code) => {
|
|
33
|
-
if (browser) await browser.close().catch(() => {});
|
|
34
|
-
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
35
|
-
T.killTmux();
|
|
36
|
-
const bad = results.filter((x) => !x.cond).length;
|
|
37
|
-
console.log(`\n${results.length - bad}/${results.length} briefing-premium-initiative assertions passed`);
|
|
38
|
-
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
39
|
-
};
|
|
40
|
-
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
41
|
-
|
|
42
|
-
const mk = (o) => IP.build(F.facts(o));
|
|
43
|
-
const BOARD = BP.build(BF.facts());
|
|
44
|
-
const BRIEF = BRP.build(BRF.facts());
|
|
45
|
-
const WRITES = /^\/api\/(?:boards\/(?:move|tasks\/(?:add|state))|lifecycle|core-docs\/draft|task-plans\/propose)$/;
|
|
46
|
-
|
|
47
|
-
// the phone design (Ph2_init): a phone shows an initiative as the popup's phone page; the old page is ⋯ › Every part
|
|
48
|
-
const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', { state: 'attached', timeout: 20000 }); await pg.evaluate(() => { const r = (window.__czVwMore ? window.__czVwMore(document.body) : []).find((x) => x.label === 'Every part'); if (r) r.go(); }); await pg.waitForTimeout(800); };
|
|
49
|
-
(async () => {
|
|
50
|
-
const exe = findBrowser();
|
|
51
|
-
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
52
|
-
let chromium;
|
|
53
|
-
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
54
|
-
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
|
|
55
|
-
await T.waitForServer(BASE);
|
|
56
|
-
browser = besidePage(await chromium.launch({ executablePath: exe }));
|
|
57
|
-
|
|
58
|
-
const open = async ({ w = 1280, h = 900, theme = 'light', model = mk(), answers = null, url = '/premium.html?ini=self-serve-v2&ws=w1&board=w1' } = {}) => {
|
|
59
|
-
const ctx = await openMission(await browser.newContext({ viewport: { width: w, height: h } }));
|
|
60
|
-
const page = await ctx.newPage();
|
|
61
|
-
let current = model, calls = 0, answer = { status: 200, body: { ok: true } };
|
|
62
|
-
const errors = [], posts = [];
|
|
63
|
-
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
64
|
-
page.on('request', (rq) => { if (rq.method() === 'POST') posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}'), headers: rq.headers() }); });
|
|
65
|
-
const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
|
|
66
|
-
await page.route('**/api/initiative-premium*', (r) => { calls++; if (answers) { const a = answers(calls, r.request().url()); return json(r, a.body, a.status); } return json(r, { ok: true, state: 'ready', model: current, as_of: Date.now() }); });
|
|
67
|
-
await page.route(/\/api\/board-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BOARD, as_of: Date.now() }));
|
|
68
|
-
await page.route(/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BRIEF, as_of: Date.now() }));
|
|
69
|
-
for (const p of ['**/api/boards/move', '**/api/boards/tasks/**', '**/api/lifecycle', '**/api/core-docs/draft']) await page.route(p, (r) => json(r, answer.body, answer.status));
|
|
70
|
-
await page.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
|
|
71
|
-
await page.goto(BASE + url + (url.includes('?') ? '&' : '?') + 'theme=' + theme);
|
|
72
|
-
// ready: the card is drawn and the board's initiatives are read (the switcher and the card's kind line come from them)
|
|
73
|
-
const up = await ready(page, !answers);
|
|
74
|
-
return { ctx, page, errors, posts, up, calls: () => calls, setModel: (m) => { current = m; }, set: (a) => { answer = a; } };
|
|
75
|
-
};
|
|
76
|
-
const V = '#czViewer:not([hidden])';
|
|
77
|
-
// ready: the initiative's page is open in the Viewer (canvas HbC), its kind line from the board's row (kind · anchor) and, when the
|
|
78
|
-
// initiative reads, its card from the record (the ladder). Before the record reads, the page says it is reading.
|
|
79
|
-
async function ready(page, full = true) { return until(() => page.evaluate((f) => /·/.test((document.querySelector('#czViewer:not([hidden]) .cz-vw-kind') || {}).textContent || '') && (!f || (!!document.querySelector('#czViewer .iv-mc') && !!((document.querySelector('#czViewer .iv-tel-t .iv-shn b') || {}).textContent || '').trim())), full), 30000); }
|
|
80
|
-
const txt = (p, s) => p.evaluate((q) => ((document.querySelector(q) || {}).textContent || '').replace(/\s+/g, ' ').trim(), s);
|
|
81
|
-
// batch 11 item 20: the page holds the Tasks (the old All tasks panel is gone); its ⋯ holds Move to a stage and its Documents fold opens
|
|
82
|
-
// Documents; the Stage and Documents views hold each other under ⋯; ← goes back to the page. view names the one to show ('tasks' is the page)
|
|
83
|
-
const LABEL = { docs: 'Documents', stage: 'Stage' };
|
|
84
|
-
const onPage = (p) => p.evaluate((v) => !!document.querySelector(v + ' [data-hi-v="page"]'), V);
|
|
85
|
-
const show = async (p, view) => {
|
|
86
|
-
if (view === 'tasks') { for (let i = 0; i < 4 && !(await onPage(p)); i++) { await p.click('#czViewer [data-cz-vw="back"]'); await sleep(150); } return until(() => onPage(p)); }
|
|
87
|
-
if (await onPage(p) && view === 'docs') await p.click(`${V} [data-iv-docs]`);
|
|
88
|
-
else if (await onPage(p)) { // batch 16 item 5c: the page's ⋯ no longer holds the stage; the Stage view sits under Documents' ⋯
|
|
89
|
-
await p.click(`${V} [data-iv-docs]`); await until(() => p.evaluate((v) => !!document.querySelector(v + ' [data-hi-v="docs"]'), V));
|
|
90
|
-
await p.click('#czViewer [data-cz-vw="more"]'); await until(() => p.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu')));
|
|
91
|
-
await p.click('#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("Stage"))');
|
|
92
|
-
} else {
|
|
93
|
-
await p.click('#czViewer [data-cz-vw="more"]'); await until(() => p.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu')));
|
|
94
|
-
await p.click(`#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${(await onPage(p)) ? 'Move to a stage' : LABEL[view]}"))`);
|
|
95
|
-
}
|
|
96
|
-
return until(() => p.evaluate((a) => !!document.querySelector(a[0] + ` [data-hi-v="${a[1]}"]`), [V, view])); };
|
|
97
|
-
const moreLabels = (p) => p.evaluate(async () => { const b = document.querySelector('#czViewer [data-cz-vw="more"]'); if (!b) return []; b.click(); await new Promise((r) => setTimeout(r, 50)); const m = document.querySelector('#czViewer .cz-vw-menu'); const out = m ? [...m.querySelectorAll('[role="menuitem"] span:first-of-type')].map((x) => x.textContent) : []; b.click(); return out; });
|
|
98
|
-
// the initiative's page first (its list row opens it again when something else is shown), then the view asked for
|
|
99
|
-
const overview = async (p, view = 'stage') => {
|
|
100
|
-
if (!(await p.evaluate((v) => !!document.querySelector(v + ' [data-hi-v="page"]'), V))) {
|
|
101
|
-
if (!(await p.evaluate(() => { const b = document.querySelector('#hmList [data-hm-sel="i:self-serve-v2"]'); return !!b && !!b.offsetParent; }))) await p.click('#hmNeeds');
|
|
102
|
-
await p.click('#hmList [data-hm-sel="i:self-serve-v2"]');
|
|
103
|
-
}
|
|
104
|
-
const s = await until(() => p.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);
|
|
105
|
-
if (s !== 'ok') return !!s;
|
|
106
|
-
if (view && view !== 'tasks') await show(p, view);
|
|
107
|
-
return true; };
|
|
108
|
-
const writes = (X) => X.posts.filter((x) => WRITES.test(x.path));
|
|
109
|
-
|
|
110
|
-
const A = await open(), p = A.page;
|
|
111
|
-
ok('0 Home opens the initiative\'s page in the Viewer; the list stays the list, with its row selected (HbCDesk)', A.up && await p.evaluate(() => new URLSearchParams(location.search).get('ini') === 'self-serve-v2' && !!document.querySelector('#czViewer .iv-mc') && !document.querySelector('#hmList .iv-mc') && document.querySelector('#hmList [data-hm-sel="i:self-serve-v2"]').getAttribute('aria-current') === 'true'));
|
|
112
|
-
|
|
113
|
-
/* I1 place */
|
|
114
|
-
{
|
|
115
|
-
const R = await open({ url: '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1' });
|
|
116
|
-
const u = new URL(R.page.url());
|
|
117
|
-
ok('I1 the old initiative link lands on Home with this initiative, its workspace and board kept', R.up && u.pathname === '/premium.html' && u.searchParams.get('ini') === 'self-serve-v2' && u.searchParams.get('ws') === 'w1' && u.searchParams.get('board') === 'w1', R.page.url());
|
|
118
|
-
await R.ctx.close();
|
|
119
|
-
}
|
|
120
|
-
ok('I1 the console is not linked from Home', await p.evaluate(() => ![...document.querySelectorAll('a[href]')].some((a) => /console(\.html)?/.test(a.getAttribute('href')))));
|
|
121
|
-
// Home shows only the rows with a call (home-nav-rows-with-a-call): "N more" opens the board's other initiatives in place
|
|
122
|
-
await p.evaluate(() => document.querySelectorAll('#hmList .hv-fold[aria-expanded="false"]').forEach((b) => b.click()));
|
|
123
|
-
await until(() => p.evaluate(() => !!document.querySelector('#hmList [data-hm-sel="i:partner-rate-limits"]')));
|
|
124
|
-
const sib = await p.evaluate(() => [...document.querySelectorAll('#hmList [data-hm-sel^="i:"]')].map((b) => b.dataset.hmSel));
|
|
125
|
-
ok('I1 the list keeps the board\'s other initiatives beside the open one', ['i:self-serve-v2', 'i:partner-rate-limits'].every((k) => sib.includes(k)), JSON.stringify(sib));
|
|
126
|
-
await p.click('#hmList [data-hm-sel="i:partner-rate-limits"]');
|
|
127
|
-
{ const u = new URL(p.url()); ok('I1 another initiative\'s name opens its page on the same board', await until(() => p.evaluate(() => new URLSearchParams(location.search).get('ini') === 'partner-rate-limits' && document.querySelector('#czVwTitle').textContent.trim() === 'Partner API rate limits')) && u.searchParams.get('ws') === 'w1' && u.searchParams.get('board') === 'w1', p.url()); }
|
|
128
|
-
await p.goBack();
|
|
129
|
-
ok('I1 the browser\'s Back closes the page and leads back to all work', await until(() => p.evaluate(() => !new URLSearchParams(location.search).get('ini') && !document.querySelector('#czViewer:not([hidden])') && !document.querySelector('#hmList [aria-current="true"][data-hm-sel^="i:"]'))), p.url());
|
|
130
|
-
await p.evaluate(() => { window.__noReload = 1; });
|
|
131
|
-
await p.click('#hmList [data-hm-prodopen]');
|
|
132
|
-
ok('I1 a product heading\'s name opens the product\'s one page in the Viewer with its goals and its Reports tab, and its own chat (HbCProduct, batch 21 item 2)', await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); return !!v && /Product/.test((v.querySelector('.cz-vw-kind') || {}).textContent || '') && !!v.querySelector('section.hi-pg[aria-label="Goals"]') && !!v.querySelector('[data-pv="tab"][data-k="reports"]') && /^Message PMOS about /.test(document.querySelector('#hmIn').placeholder) && !!document.querySelector('#hmList .hv-prg.sel [data-hm-prodopen]'); })));
|
|
133
|
-
if (await p.isVisible('#czFab')) await p.click('#czFab'); await p.click('#czMenu a[aria-current="page"]');
|
|
134
|
-
ok('I1 Menu > Today closes the page and clears the selection, without a reload', await until(() => p.evaluate(() => window.__noReload === 1 && !document.querySelector('#czViewer:not([hidden])') && !document.querySelector('#hmList .sel, #hmList [aria-current="true"]') && /^Ask or tell PMOS anything$/.test(document.querySelector('#hmIn').placeholder)))); // chief-of-staff C1: Home's own chat
|
|
135
|
-
await p.goto(BASE + '/premium.html?ini=self-serve-v2&ws=w1&board=w1&theme=light'); await ready(p);
|
|
136
|
-
|
|
137
|
-
/* I3 header and the ONE view (batch 6 items 1 and 3: the Board's panel draws the same; stage-card-test.js holds the stage card's behaviour) */
|
|
138
|
-
await until(() => p.evaluate(() => !!document.querySelector('#czViewer .iv-tel [data-iv-tj] svg')), 15000);
|
|
139
|
-
const card = await p.evaluate(() => { const c = document.querySelector('#czViewer .iv-mc'), iv = document.querySelector('#czViewer .iv'); const q = (s, r = c) => ((r.querySelector(s) || {}).textContent || '').replace(/\s+/g, ' ').trim(), d = (s) => ((document.querySelector(s) || {}).textContent || '').trim();
|
|
140
|
-
return { kind: d('#czViewer .cz-vw-kind'), title: d('#czVwTitle'), stage: q('.iv-tel-t .iv-shn b'), segs: c.querySelectorAll('.mi-svg .mi-pt').length, now: c.querySelectorAll('.mi-svg .mi-pt:is(.nw, .late, .hold)').length, tail: (c.querySelector('.iv-gx .iv-scgo') || { getAttribute: () => '' }).getAttribute('aria-label') || '', ms: !!c.querySelector('.iv-gx .iv-scgo[data-ms]'),
|
|
141
|
-
pri: iv.querySelectorAll('[data-iv-primary]').length, cta: !!iv.querySelector('[data-hm-cta]'), tasks: q('.iv-th', iv), empty: !!iv.querySelector('.iv-empty'), secs: [...iv.querySelectorAll('.iv-ws b')].map((b) => b.textContent), meta: q('.iv-meta', iv) }; });
|
|
142
|
-
ok('I3 the page\'s header names the initiative, its workflow and its anchor (D99)', card.title === 'Self-serve onboarding v2' && /^Product feature · \S/.test(card.kind), JSON.stringify(card));
|
|
143
|
-
ok('I3 the card shows the stage the workflow engine derives, its stages drawn as the trajectory\'s colours with the current one marked', card.stage === 'Build' && card.segs >= 2 && card.now >= 1, JSON.stringify(card));
|
|
144
|
-
ok('I1 the summary leads with at most one primary; the card holds no step list; Tasks is the WBS by stage', card.pri <= 1 && !card.cta && /^Tasks/.test(card.tasks) && (card.secs.length > 0 || card.empty) && !/pull request|builder agent/i.test(card.secs.join(' ')), JSON.stringify(card));
|
|
145
|
-
ok('I1 the card\'s → names the next stage', /^Next: ◆ Deliver/.test(card.tail), JSON.stringify(card));
|
|
146
|
-
ok('I3 Deliver is a milestone: the next stage carries the ◆ mark (Agreed design AgInitAgents)', card.ms, JSON.stringify(card));
|
|
147
|
-
ok('I1 the card wrote nothing on its own', writes(A).length === 0, JSON.stringify(writes(A)));
|
|
148
|
-
|
|
149
|
-
/* I7 documents: the page's Documents is a fold row with the count; a press drills into them all (OvIniA) */
|
|
150
|
-
ok('I7 the page holds Documents with its count; the list holds no Files or documents group', await until(() => p.evaluate((v) => { const g = document.querySelector(v + ' [data-iv-docs]'); return !!g && /^Documents ?\d+$/.test(g.textContent.replace(/\s+/g, ' ').trim()) && !document.querySelector('#hmList section.hm-g[aria-label="Files"], #hmList [data-iv-docs]'); }, V)));
|
|
151
|
-
await p.click(`${V} [data-iv-docs]`);
|
|
152
|
-
await until(() => p.evaluate((v) => !!document.querySelector(v + ' [data-ov-open="planning/prd/self-serve-v2-prd.md"]'), V), 15000);
|
|
153
|
-
await p.click(`${V} [data-ov-open="planning/prd/self-serve-v2-prd.md"]`);
|
|
154
|
-
ok('I7 a file opens as its page in the Viewer, not a dialog', await until(() => p.evaluate((v) => !!document.querySelector(v + ' .obody.vw[data-vw="doc:planning/prd/self-serve-v2-prd.md"]') && !(document.querySelector('#dlg') && !!document.querySelector('#dlg.on')), V), 15000));
|
|
155
|
-
|
|
156
|
-
/* I4 the Overview */
|
|
157
|
-
const i4 = await overview(p, null) && await until(() => p.evaluate((v) => !!document.querySelector(v + ' [data-hi-v="page"] .iv-th [data-iv-add]') && !document.querySelector(v + ' [data-hi-view]') && !document.querySelector(v + ' .hx-wait'), V));
|
|
158
|
-
ok('I4 the page holds the Tasks with its +, and no All tasks switch (batch 11 item 20), and no Waiting for design marker', !!i4);
|
|
159
|
-
ok('I4 the card has no Overview tile: the chat box on the page talks about the initiative (stage card D)', await p.evaluate((v) => !document.querySelector(v + ' .iv [data-hm-ov]') && /^Message PMOS about Self-serve onboarding v2/.test(document.querySelector('#hmIn').placeholder), V));
|
|
160
|
-
const pm = await moreLabels(p);
|
|
161
|
-
// batch 16 item 5c (FmI1Menu): seven entries at most, Delete last; the rest sits on what it changes (stage-card-test.js holds the stage chip)
|
|
162
|
-
ok('I4 the page\'s ⋯ is the short menu: Split, Merge, Program, Open on the Board, Copy, The record, then Delete last (FmI1Menu)', ['Open on the Board', 'Copy', 'The record', 'Delete'].every((l) => pm.includes(l)) && pm.length <= 7 && pm[pm.length - 1] === 'Delete' && !['Move to a stage', 'Moves on by itself', 'Add a stakeholder', 'Put on hold', 'Cancel the initiative', 'Rename', 'All tasks'].some((l) => pm.includes(l)), JSON.stringify(pm));
|
|
163
|
-
await show(p, 'stage');
|
|
164
|
-
const st = await p.evaluate((v) => { const o = document.querySelector(v); return { moves: [...o.querySelectorAll('[data-ov-move]')].map((b) => b.dataset.ovMove), cur: (o.querySelector('[data-ov-move][aria-pressed="true"]') || {}).textContent, life: [...o.querySelectorAll('[data-ov-life]')].map((b) => b.dataset.ovLife) }; }, V);
|
|
165
|
-
await show(p, 'docs');
|
|
166
|
-
const ov = await p.evaluate((v) => { const o = document.querySelector(v); return { docs: [...o.querySelectorAll('[data-ov-doc]')].map((d) => d.dataset.ovDoc).sort(), draft: [...o.querySelectorAll('[data-ov-draft], [data-czs-act^="draft:"], [data-ov-none]')].map((b) => b.dataset.ovDraft || b.dataset.ovNone || b.dataset.czsAct.slice(6)).sort(), pri: ((o.querySelector('.czs-pri[data-czs-act^="draft:"]') || {}).dataset || {}).czsAct || '', drafting: [...o.querySelectorAll('[data-ov-doc]')].filter((d) => /Drafting/.test(d.textContent)).map((d) => d.dataset.ovDoc), dread: [...o.querySelectorAll('[data-ov-dread]')].map((b) => b.dataset.ovDread), sum: (o.querySelector('[data-ov-dsum]') || {}).textContent || '' }; }, V);
|
|
167
|
-
const M = mk();
|
|
168
|
-
ok('I4 the Stage view lists the board\'s stages with the current one pressed, and the lifecycle presses', JSON.stringify(st.moves) === JSON.stringify(M.acts.stages) && st.cur === 'Build' && st.life.join() === 'on-hold', JSON.stringify(st)); // Cancel merged into Won't do (batch 16 item 5c)
|
|
169
|
-
ok('I7 the core documents are the non-technical ones, with the engine\'s summary', JSON.stringify(ov.docs) === JSON.stringify(M.docs.rows.filter((d) => !d.tech).map((d) => d.key).sort()) && ov.sum === M.docs.cap, JSON.stringify(ov));
|
|
170
|
-
ok('I7 a document not started offers Draft it (the summary\'s one primary drafts the first, the rest offer it from their row); a running one says Drafting and has no press; a draft offers Read', /^draft:(problem|research)$/.test(ov.pri) && [...new Set(ov.draft)].filter((k) => k === 'problem' || k === 'research').sort().join() === 'problem,research' && ov.drafting.join() === 'launch' && ov.dread.length === M.docs.rows.filter((d) => !d.tech && d.st === 'draft' && d.path && d.slot).length, JSON.stringify(ov));
|
|
171
|
-
|
|
172
|
-
/* I10 presses */
|
|
173
|
-
const mint = await T.nonce(BASE);
|
|
174
|
-
const settle = async (fn) => { const c = A.calls(); await fn(); await until(() => A.calls() > c, 10000); await sleep(500); }; // a press that lands reads the initiative again and draws the Overview again
|
|
175
|
-
await show(p, 'stage');
|
|
176
|
-
// a stage move asks the day it happened first (popup round 3 point 18f): Today keeps the move as it was
|
|
177
|
-
await settle(async () => { await p.click(`${V} [data-ov-move="Deliver"]`); await p.click('.hi-pop [data-sw="today"]'); });
|
|
178
|
-
const mv = await until(() => A.posts.find((x) => x.path === '/api/boards/move'));
|
|
179
|
-
ok('I10 a stage press posts the board, the initiative and the stage to the move route', mv && mv.body.ws === 'w1' && mv.body.board === 'w1' && mv.body.id === 'self-serve-v2' && mv.body.to === 'Deliver', JSON.stringify(mv && mv.body));
|
|
180
|
-
await until(() => p.evaluate((v) => !!document.querySelector(v + ' [data-ov-move]'), V));
|
|
181
|
-
await p.click(`${V} [data-ov-life="on-hold"]`);
|
|
182
|
-
ok('I10 a lifecycle press asks its reason inline before it posts', await until(() => p.evaluate((v) => !!document.querySelector(v + ' #ovWhy'), V)) && !A.posts.some((x) => x.path === '/api/lifecycle'));
|
|
183
|
-
await p.fill(`${V} #ovWhy`, 'x'); await p.click(`${V} [data-ov-life-go]`);
|
|
184
|
-
ok('I10 a reason too short is refused and nothing is posted', await until(async () => /Say why in a few words/.test(await txt(p, V + ' #ovMsg'))) && !A.posts.some((x) => x.path === '/api/lifecycle'));
|
|
185
|
-
await p.fill(`${V} #ovWhy`, 'Waiting on legal'); await settle(() => p.click(`${V} [data-ov-life-go]`));
|
|
186
|
-
const lf = await until(() => A.posts.find((x) => x.path === '/api/lifecycle'));
|
|
187
|
-
ok('I10 Record posts the state and the reason to the lifecycle route', lf && lf.body.initiative_id === 'self-serve-v2' && lf.body.state === 'on-hold' && lf.body.reason === 'Waiting on legal' && lf.body.ws === 'w1', JSON.stringify(lf && lf.body));
|
|
188
|
-
await show(p, 'tasks'); // the page's + opens the add field in Tasks (batch 11 item 20)
|
|
189
|
-
await p.click(`${V} [data-iv-add]`);
|
|
190
|
-
await until(() => p.evaluate((v) => !!document.querySelector(v + ' #ivAddTask'), V));
|
|
191
|
-
await p.press(`${V} #ivAddTask`, 'Enter'); await sleep(200);
|
|
192
|
-
ok('I6 Add with no title posts nothing', !A.posts.some((x) => x.path === '/api/boards/tasks/add'));
|
|
193
|
-
await p.fill(`${V} #ivAddTask`, 'Release plan'); await settle(() => p.press(`${V} #ivAddTask`, 'Enter'));
|
|
194
|
-
const ad = await until(() => A.posts.find((x) => x.path === '/api/task-plans/propose'));
|
|
195
|
-
// an initiative with no Live task: the page's add starts a proposal (batch 11 item 8), it never writes the board's tasks directly
|
|
196
|
-
ok('I10 Add on a page with no Live task proposes the task: the workspace, this initiative and the title', ad && ad.body.ws === 'w1' && ad.body.initiative === 'self-serve-v2' && ad.body.title === 'Release plan' && !A.posts.some((x) => x.path === '/api/boards/tasks/add'), JSON.stringify(ad && ad.body));
|
|
197
|
-
// a task's quick status on the page is covered by task-views-test.js (batch 9 item 5b); this record's page draws no task rows
|
|
198
|
-
await show(p, 'docs');
|
|
199
|
-
await until(() => p.evaluate((v) => !!document.querySelector(v + ' .czs-pri[data-czs-act^="draft:"]'), V));
|
|
200
|
-
const first = await p.evaluate((v) => document.querySelector(v + ' .czs-pri[data-czs-act^="draft:"]').dataset.czsAct.slice(6), V);
|
|
201
|
-
await settle(() => p.click(`${V} .czs-pri[data-czs-act^="draft:"]`));
|
|
202
|
-
const dr = await until(() => A.posts.find((x) => x.path === '/api/core-docs/draft'));
|
|
203
|
-
ok('I10 Draft it posts the workspace, the initiative scope and the key and nothing else', dr && Object.keys(dr.body).sort().join() === 'key,scope,ws' && dr.body.scope === 'initiative:self-serve-v2' && dr.body.key === first, JSON.stringify(dr && dr.body));
|
|
204
|
-
A.set({ status: 409, body: { ok: false, error: 'PMOS is already drafting this document.' } });
|
|
205
|
-
const other = first === 'problem' ? 'research' : 'problem';
|
|
206
|
-
await until(() => p.evaluate((a) => !!document.querySelector(a[0] + ` [data-ov-none="${a[1]}"], ` + a[0] + ` [data-czs-act="draft:${a[1]}"]`), [V, other]));
|
|
207
|
-
if (await p.evaluate((a) => !!document.querySelector(a[0] + ` [data-czs-act="draft:${a[1]}"]`), [V, other])) await p.click(`${V} [data-czs-act="draft:${other}"]`);
|
|
208
|
-
else {
|
|
209
|
-
await p.evaluate((a) => { const n = document.querySelector(a[0] + ` [data-ov-none="${a[1]}"]`); const f = n && !n.offsetParent && n.closest('.czs-sec') && n.closest('.czs-sec').querySelector('[data-czs-fold]'); if (f) f.click(); }, [V, other]); // its group is folded
|
|
210
|
-
await p.click(`${V} [data-ov-none="${other}"]`); await until(() => p.evaluate(() => !!document.querySelector('.hi-pop'))); await p.click('.hi-pop button:has-text("Draft it now")'); }
|
|
211
|
-
ok('I10 a refused press shows the route\'s reason in the Overview', await until(async () => /already drafting/.test(await txt(p, V + ' #ovMsg'))));
|
|
212
|
-
A.set({ status: 200, body: { ok: true } });
|
|
213
|
-
ok('I10 every press carried the launch nonce and no writer field', !!mint && writes(A).length >= 5 && writes(A).every((x) => x.headers['x-pmos-nonce'] === mint && !['by', 'via', 'at', 'actor', 'pm', 'nonce'].some((k) => k in x.body)), JSON.stringify(writes(A).map((x) => x.path)));
|
|
214
|
-
ok('I10 the Overview posts only to the move, lifecycle, task and draft routes', A.posts.filter((x) => /^\/api\/(boards|lifecycle|core-docs)/.test(x.path)).every((x) => WRITES.test(x.path)));
|
|
215
|
-
ok('I1 the old dialog never opened', await p.evaluate(() => { const d = document.querySelector('#dlg'); return !d || !d.classList.contains('on'); }));
|
|
216
|
-
ok('0 no page error', A.errors.length === 0, A.errors.join(' | '));
|
|
217
|
-
await A.ctx.close();
|
|
218
|
-
|
|
219
|
-
/* I2 reading and honest states */
|
|
220
|
-
{
|
|
221
|
-
let n = 0;
|
|
222
|
-
const R = await open({ answers: (c) => { n = c; return c <= 2 ? { status: 202, body: { ok: true, state: 'reading' } } : { status: 200, body: { ok: true, state: 'ready', model: mk(), as_of: Date.now() } }; } });
|
|
223
|
-
await overview(R.page);
|
|
224
|
-
ok('I2 while the initiative is read the Overview says so, then draws when the read ends', await until(() => R.page.evaluate((v) => !!document.querySelector(v + ' [data-ov-move]'), V), 20000) && n >= 3, String(n));
|
|
225
|
-
await R.ctx.close();
|
|
226
|
-
const E = await open({ answers: () => ({ status: 500, body: { ok: false, state: 'error', error: 'the board could not be read' } }) });
|
|
227
|
-
await overview(E.page);
|
|
228
|
-
ok('I2 a failed read says so in the Overview and draws no stage or task', await until(() => E.page.evaluate((v) => { const o = document.querySelector(v); return !!o && /could not be read/.test(o.textContent) && !o.querySelector('[data-ov-move], [data-ov-tkrow]'); }, V), 60000));
|
|
229
|
-
ok('I2 no page error on a failed read', E.errors.length === 0, E.errors.join(' | '));
|
|
230
|
-
await E.ctx.close();
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/* I12 floors at 390 */
|
|
234
|
-
{
|
|
235
|
-
const N = await open({ w: 390, h: 844 });
|
|
236
|
-
await everyPart(N.page);
|
|
237
|
-
await overview(N.page, null);
|
|
238
|
-
ok('I4 a phone draws no Tasks, Documents and Stage switch: the Tasks sit on the page (batch 11 item 20)', await until(() => N.page.evaluate((v) => !!document.querySelector(v + ' [data-hi-v="page"] .iv-th') && !document.querySelector(v + ' [data-hi-view]'), V)));
|
|
239
|
-
const fls = [];
|
|
240
|
-
for (const view of ['docs', 'stage']) { // the page's own floors (its Tasks too) are the page suites' (tk-tasks-test.js G4)
|
|
241
|
-
await show(N.page, view);
|
|
242
|
-
fls.push(await N.page.evaluate((a) => { const o = document.querySelector(a[0]); const small = [...o.querySelectorAll('button, select, input')].filter((b) => b.offsetParent && b.getBoundingClientRect().height < 44).map((b) => b.textContent.trim().slice(0, 24) || b.id || b.getAttribute('aria-label') || b.tagName); return { view: a[1], over: document.documentElement.scrollWidth - innerWidth, small }; }, [V, view]));
|
|
243
|
-
}
|
|
244
|
-
ok('I12 at 390 px the Overview\'s Documents and Stage have no sideways scroll and every target is 44 px', fls.every((fl) => fl.over <= 0 && fl.small.length === 0), JSON.stringify(fls));
|
|
245
|
-
ok('I12 no page error at 390 px', N.errors.length === 0, N.errors.join(' | '));
|
|
246
|
-
await N.ctx.close();
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/* the real routes against this repository */
|
|
250
|
-
{
|
|
251
|
-
const get = async (q) => { for (let i = 0; i < 60; i++) { const r = await fetch(BASE + '/api/initiative-premium' + q); const b = await r.json(); if (r.status !== 202) return { status: r.status, body: b }; await sleep(3000); } return { status: 202, body: null }; };
|
|
252
|
-
const r = await get('?id=briefing-premium-board');
|
|
253
|
-
const m = r.body && r.body.model;
|
|
254
|
-
ok('I1 the real route answers ready with this initiative\'s model', r.status === 200 && r.body.state === 'ready' && m && m.id === 'briefing-premium-board' && m.key === 'init:briefing-premium-board', JSON.stringify(r.body).slice(0, 200));
|
|
255
|
-
ok('I6 its PRD requirements are the PRD\'s own (B1 to B13) and no more', m && m.tasks.reqs >= 12 && m.tasks.rows.filter((t) => t.src === 'PRD requirement').every((t) => /^B\d+$/.test(t.ref)));
|
|
256
|
-
ok('I7 its core documents come with a scope and counts that add up', m && m.docs.scope === 'initiative:briefing-premium-board' && m.docs.counts.all === m.docs.rows.filter((d) => !d.tech).length);
|
|
257
|
-
const miss = await get('?id=no-such-initiative-xyz');
|
|
258
|
-
ok('I1 an initiative that is not on a board answers 404 with a reason', miss.status === 404 && miss.body && miss.body.ok === false && /no-such-initiative-xyz/.test(miss.body.error), JSON.stringify(miss.body));
|
|
259
|
-
const bad = await fetch(BASE + '/api/initiative-premium?id=../etc/passwd'); ok('I1 an id that is not an id is refused', bad.status === 400);
|
|
260
|
-
const post = await fetch(BASE + '/api/initiative-premium?id=x', { method: 'POST' }); ok('I10 the route answers GET only', post.status === 405);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/* I12 fidelity: the Agreed design (premium-agreed-design, Inside one initiative): Plus Jakarta Sans, the cozy card, the CTA in the solid colour, the floating
|
|
264
|
-
* menu. The colours are read from the page's own tokens, so each theme is checked against itself. */
|
|
265
|
-
for (const [w, h] of [[1440, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
266
|
-
const R = await open({ w, h, theme: th });
|
|
267
|
-
if (w <= 760) await everyPart(R.page);
|
|
268
|
-
const g = await R.page.evaluate(() => {
|
|
269
|
-
const tok = (v) => { const x = document.createElement('i'); x.style.setProperty('background-color', 'var(' + v + ')'); document.body.appendChild(x); const c = getComputedStyle(x).backgroundColor; x.remove(); return c; };
|
|
270
|
-
const cs = (s) => { const e = document.querySelector(s); return e ? getComputedStyle(e) : null; };
|
|
271
|
-
const fab = document.querySelector('#czFab'), fr = fab && fab.getBoundingClientRect(), rl = document.querySelector('#czMenu.ev-rail');
|
|
272
|
-
const c = document.querySelector('#czViewer .iv-tel').getBoundingClientRect();
|
|
273
|
-
return { font: cs('body').fontFamily, cta: (cs('#czViewer .iv-go') || {}).backgroundColor, ctaAlt: !document.querySelector('#czViewer .iv-go'), solid: tok('--cz-solid'), blue: tok('--cz-blue'), well: tok('--cz-well'), card: tok('--cz-card'), box: cs('#czViewer .iv-mc').backgroundColor, rad: parseFloat(cs(innerWidth <= 760 ? '#czViewer .iv-tel' : '#czViewer .iv-mc').borderTopLeftRadius), fab: fr ? [Math.round(fr.width), Math.round(fr.height)] : null, rail: rl ? Math.round(rl.getBoundingClientRect().width) : 0, over: document.documentElement.scrollWidth - innerWidth, cardW: Math.round(c.width) };
|
|
274
|
-
});
|
|
275
|
-
const d = [];
|
|
276
|
-
if (!/^"?Plus Jakarta Sans/.test(g.font)) d.push('font ' + g.font);
|
|
277
|
-
if (!g.ctaAlt && ![g.solid, g.blue].includes(g.cta)) d.push('cta ' + g.cta + ' want ' + g.solid + ' or ' + g.blue);
|
|
278
|
-
if (![g.well, g.card].includes(g.box) && !/rgba/.test(g.box)) d.push('card box ' + g.box);
|
|
279
|
-
// a phone has no wrapper card (batch 23 item 5, canvas PmA): the mission is the first card there
|
|
280
|
-
if (g.rad < 12) d.push('card radius ' + g.rad);
|
|
281
|
-
// on a phone the initiative's page is the Viewer, full screen over the list: the floating menu waits under it (HbCPhone)
|
|
282
|
-
if (w > 760 && (!g.rail || g.rail !== 72)) d.push('rail ' + JSON.stringify(g.rail)); // a desktop: the rail of places, 72 px (slice 1)
|
|
283
|
-
if (g.over > 0) d.push('sideways scroll ' + g.over);
|
|
284
|
-
ok(`I12 the initiative follows the Agreed design at ${w} px, ${th}: Plus Jakarta Sans, the cozy card, the CTA, the floating menu`, d.length === 0, d.join(' ; '));
|
|
285
|
-
ok(`I12 no page error at ${w} px, ${th}`, R.errors.length === 0, R.errors.join(' | '));
|
|
286
|
-
await R.ctx.close();
|
|
287
|
-
}
|
|
288
|
-
return finish();
|
|
289
|
-
})().catch((e) => { console.error(e); finish(1); });
|