create-pmos 0.421.0 → 0.423.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/anchor-resolve.js +93 -15
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +87 -3
- package/workspace/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-board-test.js +13 -11
- package/workspace/briefing-premium-initiative-test.js +30 -38
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/report-api/draft.json +2 -1
- package/workspace/guide/briefing-premium.md +2 -1
- package/workspace/guide/home.md +14 -4
- package/workspace/guide/programs.md +5 -3
- package/workspace/guide/workflows.md +5 -1
- package/workspace/home-other-product-test.js +55 -0
- package/workspace/ini-workflow-test.js +4 -4
- package/workspace/lib/board-premium.js +21 -6
- package/workspace/lib/custom-docs.js +65 -3
- package/workspace/lib/doc-live-root.js +37 -0
- package/workspace/lib/engine/anchor-resolve.js +93 -15
- package/workspace/lib/engine/boards.js +30 -2
- package/workspace/lib/engine/intake.js +1 -1
- package/workspace/lib/hold-spans.js +24 -10
- package/workspace/lib/initiative-writer.js +63 -1
- package/workspace/lib/kg.js +1 -1
- package/workspace/lib/plan-items.js +36 -5
- package/workspace/lib/programs.js +11 -3
- package/workspace/lib/report-draft.js +3 -0
- package/workspace/lib/route-modules.js +2 -0
- package/workspace/lib/routes-board-premium.js +28 -0
- package/workspace/lib/routes-boards.js +92 -13
- package/workspace/lib/routes-doc-sheet.js +29 -1
- package/workspace/lib/routes-initiatives.js +12 -0
- package/workspace/lib/routes-programs.js +44 -5
- package/workspace/lib/routes-task-links.js +329 -0
- package/workspace/lib/routes-task-plans.js +333 -0
- package/workspace/lib/split-merge-suggest.js +162 -0
- package/workspace/lib/split-merge.js +379 -0
- package/workspace/lib/task-cli.js +73 -13
- package/workspace/lib/task-items.js +15 -3
- package/workspace/lib/task-links.js +422 -0
- package/workspace/lib/task-plans.js +232 -0
- package/workspace/lib/vendor/scripts/anchor-resolve.js +93 -15
- package/workspace/lib/vendor/scripts/intake.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +2 -2
- package/workspace/premium-core-doc-issue-test.js +2 -2
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +26 -3
- package/workspace/premium-vw-item-test.js +3 -3
- package/workspace/premium-vw-jira-test.js +6 -6
- package/workspace/product-lane-test.js +165 -0
- package/workspace/program-leave-test.js +203 -0
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-acts.js +5 -2
- package/workspace/public/pm/bd-ini-panel.js +32 -9
- package/workspace/public/pm/bd-prog-panel.js +22 -7
- package/workspace/public/pm/bd-prog.js +6 -1
- package/workspace/public/pm/bd-span.js +234 -30
- package/workspace/public/pm/bd-views.js +3 -2
- package/workspace/public/pm/cozy-board.css +90 -0
- package/workspace/public/pm/cozy-home.css +3 -0
- package/workspace/public/pm/doc-follow.js +36 -0
- package/workspace/public/pm/home-app.js +62 -14
- package/workspace/public/pm/home-ini-model.js +0 -34
- package/workspace/public/pm/home-ini.js +81 -204
- package/workspace/public/pm/home-list.js +2 -2
- package/workspace/public/pm/home-today.js +3 -1
- package/workspace/public/pm/ini-groups.js +228 -0
- package/workspace/public/pm/ini-links.js +561 -0
- package/workspace/public/pm/ini-tasks.js +131 -30
- package/workspace/public/pm/ini-versions.js +348 -0
- package/workspace/public/pm/ini-view-model.js +113 -43
- package/workspace/public/pm/ini-view.css +341 -18
- package/workspace/public/pm/ini-view.js +153 -38
- package/workspace/public/pm/premium-board.js +160 -21
- package/workspace/public/pm/premium-report-read.js +20 -1
- package/workspace/public/pm/premium-shell.js +29 -4
- package/workspace/public/pm/premium-vw-doc.js +46 -11
- package/workspace/public/pm/prog-move.js +69 -0
- package/workspace/public/pm/split-merge.css +77 -0
- package/workspace/public/pm/split-merge.js +265 -0
- package/workspace/public/pm/stage-line.js +414 -0
- package/workspace/public/pm/task-card.css +3 -0
- package/workspace/public/pm/task-card.js +15 -6
- package/workspace/public/pm/wf-page.css +2 -0
- package/workspace/public/pm/wf-page.js +2 -0
- package/workspace/public/pm/wf-stage.js +2 -1
- package/workspace/server.js +15 -1
- package/workspace/split-merge-ui-test.js +175 -0
- package/workspace/stage-card-test.js +12 -11
- package/workspace/task-card-test.js +3 -2
- package/workspace/task-delete-test.js +126 -0
- package/workspace/task-links-test.js +227 -0
- package/workspace/task-milestones-test.js +176 -0
- package/workspace/task-plans-test.js +181 -0
- package/workspace/task-views-test.js +3 -3
- package/workspace/test-lists/bd-ini-panel.json +8 -2
- package/workspace/test-lists/product-lane.json +6 -0
- package/workspace/test-lists/program-leave.json +6 -0
- package/workspace/test-lists/split-merge.json +15 -0
- package/workspace/test-lists/task-delete.json +5 -0
- package/workspace/test-lists/task-links.json +6 -0
- package/workspace/test-lists/task-milestones.json +6 -0
- package/workspace/test-lists/task-plans.json +6 -0
- package/workspace/test-lists/viewer-live-file.json +9 -0
- package/workspace/timeline-holds-test.js +61 -4
- package/workspace/tk-tasks-test.js +173 -57
- package/workspace/workflows-setup-test.js +4 -3
|
@@ -71,8 +71,8 @@ const TICKETS = {
|
|
|
71
71
|
const model = (sprints) => BP.build(F.facts({ sprints }));
|
|
72
72
|
const IMODEL = IP.build(IF.facts());
|
|
73
73
|
// Home's initiative layout (premium-agreed-design): the card's Overview has the Sprint press; the Viewer shows one item at a time
|
|
74
|
-
const viaMore = async (pg, label) => { await pg.click('#czViewer:not([hidden]) [data-cz-vw="more"]'); await until(() => pg.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); await pg.click(
|
|
75
|
-
const overview = async (pg) => { await (async (g) => { const P = '#czViewer:not([hidden]) [data-hi-v="page"]', r = '#hmList [data-hm-sel^="i:"][aria-current="true"]'; for (let i = 0; i < 4 && !(await g.$(P)) && (await g.$('#czViewer:not([hidden]) [data-cz-vw="back"]')); i++) { await g.click('#czViewer [data-cz-vw="back"]'); await g.waitForTimeout(150); } if (await g.$(P)) return; if (await g.$(r)) await g.click(r); else await g.reload(); await g.waitForSelector(P + ' .iv', { timeout: 30000 }); })(pg); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */
|
|
74
|
+
const viaMore = async (pg, label) => { const it = (l) => `#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${l}"))`, more = async () => { await pg.click('#czViewer:not([hidden]) [data-cz-vw="more"]'); await until(() => pg.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); }; await more(); for (let i = 0; i < 20 && !(await pg.$(it(label))) && !(await pg.$(it('Move to a stage'))); i++) { await pg.keyboard.press('Escape'); await pg.waitForTimeout(250); await more(); } if (!(await pg.$(it(label))) && (await pg.$(it('Move to a stage')))) { await pg.click(it('Move to a stage')); await until(() => pg.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v="stage"]'))); if (label === 'Stage') return; await more(); } await pg.click(it(label)); }; // the page's ⋯ holds Move to a stage; the Stage view's ⋯ holds Documents, Open the full record and Sprint (batch 11 item 20)
|
|
75
|
+
const overview = async (pg) => { await (async (g) => { const P = '#czViewer:not([hidden]) [data-hi-v="page"]', r = '#hmList [data-hm-sel^="i:"][aria-current="true"]'; for (let i = 0; i < 4 && !(await g.$(P)) && (await g.$('#czViewer:not([hidden]) [data-cz-vw="back"]')); i++) { await g.click('#czViewer [data-cz-vw="back"]'); await g.waitForTimeout(150); } if (await g.$(P)) return; if (await g.$(r)) await g.click(r); else await g.reload(); await g.waitForSelector(P + ' .iv', { timeout: 30000 }); })(pg); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */ /* the page holds the Tasks (batch 11 item 20) */ return until(() => pg.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v]'))); };
|
|
76
76
|
const openSprint = async (pg) => { if (!(await pg.$('#czViewer:not([hidden]) [data-hi-v]'))) await overview(pg); /* open() already showed the Overview */ await viaMore(pg, 'Sprint'); };
|
|
77
77
|
const open = async ({ w = 1280, h = 900, theme = 'light', sprints = SPRINTS, tickets = TICKETS } = {}) => {
|
|
78
78
|
const ctx = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: theme });
|
|
@@ -139,7 +139,7 @@ const TICKETS = {
|
|
|
139
139
|
await p.evaluate(() => { const f = document.querySelector('#czViewer [data-czs-fold="links"]'); if (f && f.getAttribute('aria-expanded') !== 'true') f.click(); }); // the one ticket Viewer's Linked fold (tk-view.js) opens first
|
|
140
140
|
await p.click('#czViewer [data-tkv-link="PMOS-152"]');
|
|
141
141
|
ok('K6 a linked ticket opens in its own tab', !!(await until(async () => { const t = await paneText(p, 'jira:PMOS-152'); return t && /StatusIn Progress/.test(t) && /depends onPMOS-142/.test(t) && !/Sprint/.test(t.split('Jira owns')[0]); /* its own facts; no sprint row when it is in none (zero is silence) */ })));
|
|
142
|
-
await (async (g) => { const P = '#czViewer:not([hidden]) [data-hi-v="page"]', r = '#hmList [data-hm-sel^="i:"][aria-current="true"]'; for (let i = 0; i < 4 && !(await g.$(P)) && (await g.$('#czViewer:not([hidden]) [data-cz-vw="back"]')); i++) { await g.click('#czViewer [data-cz-vw="back"]'); await g.waitForTimeout(150); } if (await g.$(P)) return; if (await g.$(r)) await g.click(r); else await g.reload(); await g.waitForSelector(P + ' .iv', { timeout: 30000 }); })(p); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */
|
|
142
|
+
await (async (g) => { const P = '#czViewer:not([hidden]) [data-hi-v="page"]', r = '#hmList [data-hm-sel^="i:"][aria-current="true"]'; for (let i = 0; i < 4 && !(await g.$(P)) && (await g.$('#czViewer:not([hidden]) [data-cz-vw="back"]')); i++) { await g.click('#czViewer [data-cz-vw="back"]'); await g.waitForTimeout(150); } if (await g.$(P)) return; if (await g.$(r)) await g.click(r); else await g.reload(); await g.waitForSelector(P + ' .iv', { timeout: 30000 }); })(p); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */ /* the page holds the Tasks (batch 11 item 20) */
|
|
143
143
|
const k7 = await until(() => p.evaluate((t0) => { const m = document.querySelector('#czViewer:not([hidden]) .cz-vw-body'); return m && m.textContent === t0 ? m.textContent : null; }, mainTxt));
|
|
144
144
|
ok('K7 the Overview comes back with its own facts, as before', !!k7, await p.evaluate(() => ((document.querySelector('#czViewer .cz-vw-body') || {}).textContent || '').slice(0, 300)));
|
|
145
145
|
ok('K8 the views read the two Jira routes only, and wrote nothing', A.posts.filter((x) => !/thread|note|seen/.test(x)).length === 0 && A.reads.every((r) => /^\/api\/(jira\/tickets|boards\/sprints)\?/.test(r)) && A.reads.some((r) => /jira\/tickets\?.*initiative=self-serve-v2/.test(r)), JSON.stringify([A.posts, A.reads]));
|
|
@@ -179,9 +179,9 @@ const TICKETS = {
|
|
|
179
179
|
/* I the initiative (Home's layout, reached by the Board's expand link) loads the ticket view for its Jira tasks; a Jira task's Open press opens its ticket */
|
|
180
180
|
{
|
|
181
181
|
const I = await open();
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
ok('I2 a Jira
|
|
182
|
+
// batch 11 item 20: the page's Tasks draw the stage's Jira tickets; a ticket press opens its ticket in the Viewer (the old All tasks panel is gone)
|
|
183
|
+
await I.page.click('#czViewer [data-iv-ticket="PMOS-142"]');
|
|
184
|
+
ok('I2 a Jira ticket in the page\'s Tasks opens its ticket in the Viewer', !!(await until(async () => /^jira:PMOS-142$/.test(String(await curId(I.page))))), JSON.stringify(await curId(I.page)));
|
|
185
185
|
await I.page.goto(BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1');
|
|
186
186
|
ok('I1 the initiative loads the Jira view module without a page error', !!(await until(() => I.page.evaluate(() => !!window.__premiumVwJira))) && I.errors.length === 0, I.errors.join(' | '));
|
|
187
187
|
await I.ctx.close();
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* product-lane-test.js — milestones on the product lane (feedback batch 11 item 17; canvas In development, row "Milestones on the product lane":
|
|
4
|
+
* PlmA1Board, PlmA2Folded, PlmA3Phone, sticky plmRules). Serves the real page from the real server; GET /api/board-premium answers All products,
|
|
5
|
+
* two products built by lib/board-premium.js from rows and work items that carry the ◇ flag. The page's clock is the fixture's (17 Oct 2026).
|
|
6
|
+
* L the lane: the product's head row carries every milestone of its initiatives (the ◇ tasks and each row's end ◇), the same ◇ (filled done,
|
|
7
|
+
* orange late), close ones merged into a counted ◇ with the range under it, a thin line from the first start to the last end
|
|
8
|
+
* H hover on a single ◇ names the milestone and its initiative
|
|
9
|
+
* P pressing a counted ◇ lists its milestones with their initiatives; a line opens that initiative
|
|
10
|
+
* F folded, the lane is the same; the head shows the count
|
|
11
|
+
* S Quarter puts a date under each ◇, 5 yr none
|
|
12
|
+
* Q the phone: ◇ only, no dates; a tap on the lane opens a sheet with the product's milestones in date order
|
|
13
|
+
* SHOTS_17=<dir>: the Board, the counted ◇'s list, folded and the phone sheet, into <dir>. */
|
|
14
|
+
const path = require('path');
|
|
15
|
+
const { spawn } = require('child_process');
|
|
16
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
17
|
+
const T = require('./test-run').configure({ name: 'product-lane' });
|
|
18
|
+
const BP = require('./lib/board-premium.js');
|
|
19
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
20
|
+
|
|
21
|
+
const BASE = T.BASE;
|
|
22
|
+
const results = [];
|
|
23
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
24
|
+
let srv = null; let browser = null;
|
|
25
|
+
const finish = async (code) => {
|
|
26
|
+
if (browser) await browser.close().catch(() => {});
|
|
27
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
28
|
+
T.killTmux();
|
|
29
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
30
|
+
console.log(`\n${results.length - bad}/${results.length} product-lane assertions passed`);
|
|
31
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
32
|
+
};
|
|
33
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
34
|
+
|
|
35
|
+
const ROWS = [
|
|
36
|
+
F.row('scarlet', 'Scarlet — ST What’s The News', { owner: 'Wawan', stage: 'Build', start: '2026-11-02', end: '2027-03-31', progress: 30 }),
|
|
37
|
+
F.row('passkey', 'Passkey sign-in', { owner: 'Lee', start: '2026-09-15', end: '2027-02-26', progress: 45 }),
|
|
38
|
+
F.row('recovery', 'Recovery codes', { owner: 'Dara', start: '2026-12-01', end: '2027-04-30', progress: 10 }),
|
|
39
|
+
F.row('email-otp', 'Email OTP', { start: '2026-11-10', end: '2027-06-30', progress: 5 }),
|
|
40
|
+
];
|
|
41
|
+
const PRODUCT = { scarlet: 'pmos-scarlet', passkey: 'pmos-scarlet', recovery: 'pmos-idpf', 'email-otp': 'pmos-idpf' };
|
|
42
|
+
const it = (ini, uid, title, o) => ({ uid, key: '', kind: 'Task', src: 'pmos', title, status: 'To do', owner: 'Wawan', ini, start: null, end: null, ref: uid, board: 'w1', milestone: true, ...o });
|
|
43
|
+
const ITEMS = [
|
|
44
|
+
it('scarlet', 'task-pilot', 'Pilot with 2 newsrooms', { status: 'Done', start: '2026-11-02', end: '2026-12-11', section: 'build' }),
|
|
45
|
+
it('scarlet', 'task-feat', 'Feature delivered', { start: '2027-01-18', end: '2027-01-29', section: 'deliver' }),
|
|
46
|
+
it('scarlet', 'task-kpi', 'KPI evaluated', { start: '2027-03-22', end: '2027-03-31', section: 'evaluate' }),
|
|
47
|
+
it('passkey', 'task-late', 'Design review', { start: '2026-10-01', end: '2026-10-16' }),
|
|
48
|
+
it('passkey', 'task-pk2', 'Security sign-off', { end: '2026-12-18' }),
|
|
49
|
+
it('recovery', 'task-c1', 'Codes live', { end: '2027-03-02' }),
|
|
50
|
+
it('recovery', 'task-c2', 'Support FAQ live', { end: '2027-03-06' }),
|
|
51
|
+
];
|
|
52
|
+
/** All products: the two products' rows on one board (pm/bd-prog.js groupsOf draws a head per product). */
|
|
53
|
+
function model() {
|
|
54
|
+
const rows = ROWS.map((r) => ({ ...r }));
|
|
55
|
+
const m = BP.build(F.facts({ rows, total: rows.length, columns: [], items: ITEMS.map((x) => ({ ...x })) }));
|
|
56
|
+
m.board.all = true;
|
|
57
|
+
const put = (r) => { const k = String(r.id || r.key || '').replace(/^board:/, ''); if (PRODUCT[k]) r.product = PRODUCT[k]; };
|
|
58
|
+
(m.rows || []).forEach(put); ((m.initiatives && m.initiatives.list && m.initiatives.list.rows) || []).forEach(put);
|
|
59
|
+
return m;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
(async () => {
|
|
63
|
+
const exe = findBrowser();
|
|
64
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
65
|
+
let chromium;
|
|
66
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
67
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
68
|
+
await T.waitForServer(BASE);
|
|
69
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
70
|
+
|
|
71
|
+
/** The Board on the timeline, All products. o: { w, h, span, phone, fold } */
|
|
72
|
+
const open = async (o = {}) => {
|
|
73
|
+
const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 }, hasTouch: !!o.phone, isMobile: !!o.phone });
|
|
74
|
+
const page = await ctx.newPage();
|
|
75
|
+
const errors = [];
|
|
76
|
+
page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
|
|
77
|
+
await page.clock.setFixedTime(new Date(F.NOW));
|
|
78
|
+
const M = model();
|
|
79
|
+
await page.route('**/api/board-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: M, as_of: Date.now() }) }));
|
|
80
|
+
await page.route('**/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs: [] }) }));
|
|
81
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'not in this check' }) }));
|
|
82
|
+
await page.addInitScript(([s]) => { try { if (!sessionStorage.getItem('set')) { sessionStorage.setItem('set', '1'); for (const [k, v] of Object.entries(s)) localStorage.setItem(k, v); } } catch { /* none */ } },
|
|
83
|
+
[{ 'pmos.board.view': 'time', 'pmos.board.pview': 'time', 'pmos.board.span': o.span || 'year', 'pmos.board.fold': JSON.stringify(o.fold || []) }]);
|
|
84
|
+
await page.goto(BASE + '/premium-board.html?ws=w1&board=w1');
|
|
85
|
+
await page.waitForSelector('#ibBody .tg-lane', { timeout: 15000 });
|
|
86
|
+
await page.waitForTimeout(400);
|
|
87
|
+
return { ctx, page, errors };
|
|
88
|
+
};
|
|
89
|
+
const shots = process.env.SHOTS_17;
|
|
90
|
+
const shot = async (p, name) => { if (shots) await p.screenshot({ path: path.join(shots, name + '.png') }); };
|
|
91
|
+
const laneOf = (p, key) => p.evaluate((k) => {
|
|
92
|
+
const r = document.querySelector(`#ibBody .tg-lane[data-lane="${k}"]`); if (!r) return null;
|
|
93
|
+
return {
|
|
94
|
+
name: (r.querySelector('.bd-prdb') || {}).textContent || '',
|
|
95
|
+
n: (r.querySelector('.bd-prdb .n') || {}).textContent || '',
|
|
96
|
+
span: r.querySelectorAll('.tg-span').length,
|
|
97
|
+
tm: [...r.querySelectorAll('.tg-tm')].map((x) => x.className + '|' + x.getAttribute('title')),
|
|
98
|
+
tmc: [...r.querySelectorAll('.tg-tmc')].map((x) => x.className + '|' + x.textContent),
|
|
99
|
+
tml: [...r.querySelectorAll('.tg-tml')].map((x) => x.textContent),
|
|
100
|
+
};
|
|
101
|
+
}, key);
|
|
102
|
+
|
|
103
|
+
/* L H P — desktop, Year */
|
|
104
|
+
{
|
|
105
|
+
const { ctx, page: p, errors } = await open();
|
|
106
|
+
const a = await laneOf(p, 'p:pmos-scarlet'), b = await laneOf(p, 'p:pmos-idpf');
|
|
107
|
+
ok('L each product\'s head row is a lane: its name cell with the fold, its track with a thin line', a && b && /pmos-scarlet/.test(a.name) && a.span >= 1 && b.span >= 1, JSON.stringify({ a, b }));
|
|
108
|
+
ok('L the lane rolls up the ◇ tasks and each end ◇ of its initiatives; Dec 11 and Dec 18 merge into one counted ◇',
|
|
109
|
+
a && a.tm.length === 4 && a.tmc.length === 1 && /^tg-tmc dn|^tg-tmc/.test(a.tmc[0]) && a.tmc[0].endsWith('|2') && a.tml.join() === 'Oct 16,Dec 11–18,Jan 29,Feb 26,Mar 31', JSON.stringify(a));
|
|
110
|
+
ok('L the same ◇: late is orange, the Evaluate task IS the end ◇ (said once), a plain end ◇ is named Deliver',
|
|
111
|
+
a && /^tg-tm late\|Design review · Passkey sign-in · Oct 16 · late$/.test(a.tm[0]) && a.tm.some((x) => /KPI evaluated · Scarlet/.test(x)) && a.tm.some((x) => /^tg-tm\|Deliver · Passkey sign-in · Feb 26$/.test(x)) && !a.tm.some((x) => /Committed/.test(x)), JSON.stringify(a && a.tm));
|
|
112
|
+
ok('H a single ◇\'s hover names the milestone and its initiative', a && a.tm.some((x) => x.endsWith('|Feature delivered · Scarlet — ST What’s The News · Jan 29')), JSON.stringify(a && a.tm));
|
|
113
|
+
ok('L the other product\'s lane: Mar 2 and Mar 6 merge; Apr 30 and Jun 30 are the ends', b && b.tmc.length === 1 && b.tml.join() === 'Mar 2–6,Apr 30,Jun 30', JSON.stringify(b));
|
|
114
|
+
const lg = await p.evaluate(() => (document.querySelector('.tg-lgd') || {}).textContent || '');
|
|
115
|
+
ok('L the legend gets no new entry', !/lane|product/i.test(lg), lg);
|
|
116
|
+
await shot(p, 'lane-board-1440');
|
|
117
|
+
await p.click('#ibBody .tg-lane[data-lane="p:pmos-scarlet"] .tg-tmc');
|
|
118
|
+
const list = await p.evaluate(() => { const m = document.querySelector('.tg-msp'); return m ? [...m.querySelectorAll('[data-ms-ini]')].map((x) => x.textContent) : null; });
|
|
119
|
+
ok('P the counted ◇ lists its milestones: name, initiative, date', list && list.join('|') === 'Pilot with 2 newsroomsScarlet — ST What’s The NewsDec 11|Security sign-offPasskey sign-inDec 18', JSON.stringify(list));
|
|
120
|
+
await shot(p, 'lane-list-1440');
|
|
121
|
+
await p.click('.tg-msp [data-ms-ini="board:passkey"]');
|
|
122
|
+
await p.waitForTimeout(400);
|
|
123
|
+
ok('P a line opens its initiative', await p.evaluate(() => !document.querySelector('.tg-msp') && !!document.querySelector('#ibBody [data-row="board:passkey"].sel')));
|
|
124
|
+
ok('the Board threw nothing', !errors.length, errors.join('\n'));
|
|
125
|
+
await ctx.close();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* F — folded */
|
|
129
|
+
{
|
|
130
|
+
const { ctx, page: p } = await open({ fold: ['p:pmos-scarlet', 'p:pmos-idpf'] });
|
|
131
|
+
const a = await laneOf(p, 'p:pmos-scarlet');
|
|
132
|
+
const rows = await p.evaluate(() => document.querySelectorAll('#ibBody .tg-r[data-row]').length);
|
|
133
|
+
ok('F folded, the lane looks the same and the head shows the count', a && a.n === '2' && a.tm.length === 4 && a.tmc.length === 1 && rows === 0, JSON.stringify({ a, rows }));
|
|
134
|
+
await shot(p, 'lane-folded-1440');
|
|
135
|
+
await ctx.close();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* S — Quarter and 5 yr */
|
|
139
|
+
{
|
|
140
|
+
const { ctx, page: p } = await open({ span: 'quarter' });
|
|
141
|
+
const a = await laneOf(p, 'p:pmos-scarlet');
|
|
142
|
+
ok('S Quarter puts a date under every ◇ in view', a && a.tml.length >= 4 && a.tml.every((x) => /^[A-Z][a-z]{2} \d/.test(x)), JSON.stringify(a && a.tml));
|
|
143
|
+
await ctx.close();
|
|
144
|
+
const { ctx: c5, page: p5 } = await open({ span: 'y5' });
|
|
145
|
+
const a5 = await laneOf(p5, 'p:pmos-scarlet');
|
|
146
|
+
ok('S 5 yr draws the ◇s with no dates', a5 && !a5.tml.length && (a5.tm.length + a5.tmc.length) >= 1, JSON.stringify(a5));
|
|
147
|
+
await c5.close();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Q — the phone */
|
|
151
|
+
{
|
|
152
|
+
const { ctx, page: p, errors } = await open({ w: 390, h: 844, phone: true });
|
|
153
|
+
const a = await p.evaluate(() => { const r = document.querySelector('#ibBody .tgq-r.tg-lane[data-lane="p:pmos-scarlet"]'); return r ? { marks: r.querySelectorAll('.tg-tm, .tg-tmc').length, dates: r.querySelectorAll('.tg-tml').length, btn: r.querySelectorAll('.tg-p button').length } : null; });
|
|
154
|
+
ok('Q the phone draws the lane\'s ◇s with no dates', a && a.marks >= 1 && a.dates === 0 && a.btn === 0, JSON.stringify(a));
|
|
155
|
+
await p.evaluate(() => { const t = document.querySelector('#ibBody .tgq-r.tg-lane[data-lane="p:pmos-scarlet"] > .tg-p'); t.click(); });
|
|
156
|
+
await p.waitForTimeout(200);
|
|
157
|
+
const sh = await p.evaluate(() => { const m = document.querySelector('.tg-msp.sh'); return m ? { h: (m.querySelector('.h') || {}).textContent, lines: [...m.querySelectorAll('[data-ms-ini]')].map((x) => x.querySelector('span').firstChild.textContent + '|' + x.querySelector('.k').textContent) } : null; });
|
|
158
|
+
ok('Q a tap on the lane opens a sheet with the product\'s milestones in date order',
|
|
159
|
+
sh && sh.h === 'pmos-scarlet' && sh.lines.join() === 'Design review|Oct 16,Pilot with 2 newsrooms|Dec 11,Security sign-off|Dec 18,Feature delivered|Jan 29,Deliver|Feb 26,KPI evaluated|Mar 31', JSON.stringify(sh));
|
|
160
|
+
await shot(p, 'lane-phone-390');
|
|
161
|
+
ok('the phone threw nothing', !errors.length, errors.join('\n'));
|
|
162
|
+
await ctx.close();
|
|
163
|
+
}
|
|
164
|
+
finish();
|
|
165
|
+
})();
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* program-leave-test.js — move an initiative out of its program, or to another, on the Board and on Home (feedback batch 11 item 2, option A
|
|
4
|
+
* agreed 2026-10-26; canvas LpA1More, LpA2Other, LpA3Done, LpA4Phone, LpA5PhoneDone). Serves the real pages from the real server. The program
|
|
5
|
+
* routes are answered here by lib/routes-programs.js itself, over two temp workspaces seeded with Project Ascent's ledgers
|
|
6
|
+
* (fixtures/program-ascent.js) and a second program, Partner identity, so a reload reads back what the press wrote.
|
|
7
|
+
* B Board: ⋯ of an initiative in the program holds Move out of it and Move to another program (no Turn into a program); Move out is one press,
|
|
8
|
+
* the toast says where it went and the milestone it left, with Undo; the row shows under its product, still selected; Undo puts it back in
|
|
9
|
+
* its place; Move to another program lists the other program with its count; a phone's ⋯ holds the same items
|
|
10
|
+
* H Home: the initiative page's ⋯ holds the same two items; an initiative in no program keeps Turn into a program and has neither */
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const os = require('os');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { Readable } = require('stream');
|
|
15
|
+
const { spawn } = require('child_process');
|
|
16
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
17
|
+
const T = require('./test-run').configure({ name: 'program-leave' });
|
|
18
|
+
const BP = require('./lib/board-premium.js');
|
|
19
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
20
|
+
const B = require('./lib/briefing-premium.js');
|
|
21
|
+
const HF = require('./fixtures/briefing-premium-facts.js');
|
|
22
|
+
const A = require('./fixtures/program-ascent.js');
|
|
23
|
+
const IP = require('./lib/initiative-premium.js');
|
|
24
|
+
const IF = require('./fixtures/initiative-premium-facts.js');
|
|
25
|
+
const R = require('./lib/routes-programs.js');
|
|
26
|
+
const P = require('./lib/programs.js');
|
|
27
|
+
|
|
28
|
+
const BASE = T.BASE;
|
|
29
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
30
|
+
const until = async (fn, ms = 8000, 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); } };
|
|
31
|
+
const results = [];
|
|
32
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
33
|
+
let srv = null; let browser = null; let root = null;
|
|
34
|
+
const finish = async (code) => {
|
|
35
|
+
if (browser) await browser.close().catch(() => {});
|
|
36
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
37
|
+
T.killTmux();
|
|
38
|
+
if (root) fs.rmSync(root, { recursive: true, force: true });
|
|
39
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
40
|
+
console.log(`\n${results.length - bad}/${results.length} program-leave assertions passed`);
|
|
41
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
42
|
+
};
|
|
43
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
44
|
+
|
|
45
|
+
/* the program routes, over temp workspaces: seed() writes the fixture's ledgers again before each page */
|
|
46
|
+
root = fs.mkdtempSync(path.join(os.tmpdir(), 'program-leave-'));
|
|
47
|
+
const W = { idpf: { id: 'idpf', root: path.join(root, 'idpf') }, microsites: { id: 'microsites', root: path.join(root, 'microsites') } };
|
|
48
|
+
const stateOf = (w) => { const d = path.join(w.root, 'pmos', 'state'); fs.mkdirSync(d, { recursive: true }); return d; };
|
|
49
|
+
const rctx = { getWs: (id) => (id == null ? W.idpf : W[id] || null), workspaceList: () => Object.values(W), stateDirFor: (w) => stateOf(w),
|
|
50
|
+
json: (res, obj, code) => { res.code = code || 200; res.body = obj; },
|
|
51
|
+
readJson: async (req) => { try { return { ok: true, body: JSON.parse(req.raw || '{}') }; } catch { return { ok: false }; } } };
|
|
52
|
+
function seed() {
|
|
53
|
+
for (const { ws, lines } of A.ledgers()) {
|
|
54
|
+
const extra = ws === 'idpf' ? [P.validProgram({ title: 'Partner identity' }), { kind: 'member', program: 'partner-identity', initiative: 'usage-billing' }] : [];
|
|
55
|
+
fs.writeFileSync(path.join(stateOf(W[ws]), 'programs.jsonl'), [...lines, ...extra].map((l) => JSON.stringify(l)).join('\n') + '\n');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const posts = [];
|
|
59
|
+
const routePrograms = async (page) => {
|
|
60
|
+
await page.route('**/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs: R.all(rctx) }) }));
|
|
61
|
+
await page.route('**/api/programs/*', async (r) => {
|
|
62
|
+
const url = new URL(r.request().url()), raw = r.request().postData() || '';
|
|
63
|
+
posts.push({ path: url.pathname, body: JSON.parse(raw || '{}') });
|
|
64
|
+
const req = Object.assign(Readable.from([]), { method: 'POST', headers: { origin: 'http://127.0.0.1:1', host: '127.0.0.1:1' }, raw });
|
|
65
|
+
const res = {};
|
|
66
|
+
await R.handle(req, res, new URL('http://127.0.0.1:1' + url.pathname), rctx);
|
|
67
|
+
r.fulfill({ status: res.code || 200, contentType: 'application/json', body: JSON.stringify(res.body) });
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const members = () => (R.all(rctx).find((p) => p.id === 'project-ascent') || { members: [] }).members.map((m) => m.initiative);
|
|
71
|
+
const waitsOf = (id) => ((R.all(rctx).find((p) => p.id === 'project-ascent') || { milestones: [] }).milestones.find((m) => m.id === id) || {}).waits || [];
|
|
72
|
+
|
|
73
|
+
(async () => {
|
|
74
|
+
const exe = findBrowser();
|
|
75
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
76
|
+
let chromium;
|
|
77
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
78
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
79
|
+
await T.waitForServer(BASE);
|
|
80
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
81
|
+
|
|
82
|
+
const board = async (o = {}) => {
|
|
83
|
+
seed();
|
|
84
|
+
const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 } });
|
|
85
|
+
const page = await ctx.newPage();
|
|
86
|
+
const errors = [];
|
|
87
|
+
page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
|
|
88
|
+
await page.clock.setFixedTime(new Date(F.NOW));
|
|
89
|
+
await page.route('**/api/board-premium*', (r) => { const q = new URL(r.request().url()).searchParams; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.programFacts(q.get('ws') || 'idpf')), as_of: Date.now() }) }); });
|
|
90
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'not in this check' }) }));
|
|
91
|
+
await routePrograms(page);
|
|
92
|
+
await page.addInitScript(() => { try { if (!sessionStorage.getItem('set')) { sessionStorage.setItem('set', '1'); localStorage.setItem('pmos.board.view', 'track'); localStorage.setItem('pmos.board.pview', 'track'); localStorage.setItem('pmos.board.grouping', 'program'); } } catch { /* none */ } });
|
|
93
|
+
await page.goto(BASE + '/premium-board.html?ws=idpf&board=idpf');
|
|
94
|
+
await page.waitForSelector('#ibBody [data-key]', { timeout: 15000 });
|
|
95
|
+
await page.waitForTimeout(700);
|
|
96
|
+
return { ctx, page, errors };
|
|
97
|
+
};
|
|
98
|
+
const menu = async (p) => { await p.click('#czViewer [data-cz-vw="more"]'); await p.waitForTimeout(80); return p.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.textContent.trim())); };
|
|
99
|
+
const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list] [data-po-id]')].map((r) => r.dataset.poId));
|
|
100
|
+
const toast = (p) => p.evaluate(() => { const t = document.querySelector('#bdToast'); return t && !t.hidden ? t.textContent : ''; });
|
|
101
|
+
|
|
102
|
+
/* B — the Board's initiative panel */
|
|
103
|
+
{
|
|
104
|
+
const { ctx, page: p, errors } = await board();
|
|
105
|
+
await p.click('#ibBody .bt-kid .bt-nm >> text=Legacy IdP sunset');
|
|
106
|
+
await p.waitForSelector('#czViewer:not([hidden])');
|
|
107
|
+
const m = await menu(p);
|
|
108
|
+
ok('B ⋯ of an initiative in a program: Move out of it and Move to another program, after the plan dates; no Turn into a program',
|
|
109
|
+
m.includes('Move out of Project Ascent') && m.some((x) => /^Move to another program/.test(x)) && !m.includes('Turn into a program') && m.indexOf('Move out of Project Ascent') > m.indexOf('Change the plan dates'), JSON.stringify(m));
|
|
110
|
+
ok('B the two items carry their icons', await p.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].filter((b) => /^Move (out|to another)/.test(b.textContent.trim())).every((b) => !!b.querySelector('svg'))));
|
|
111
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-more.png' });
|
|
112
|
+
const n0 = posts.length;
|
|
113
|
+
await p.click('.cz-vw-menu [role="menuitem"] >> text=Move out of Project Ascent');
|
|
114
|
+
await until(async () => !(await kids(p)).includes('legacy-idp-sunset'));
|
|
115
|
+
const t = await toast(p);
|
|
116
|
+
ok('B Move out is one press: one leave, no confirm; the toast says where it went and the milestone it left, with Undo',
|
|
117
|
+
posts.length === n0 + 1 && posts[n0].body.leave === true && /Moved out of Project Ascent · now under IDPF · off 1 milestone/.test(t) && /Undo/.test(t), JSON.stringify({ t, posts: posts.slice(n0) }));
|
|
118
|
+
ok('B the program no longer has it, and Legacy IdP off no longer waits on it', !members().includes('legacy-idp-sunset') && !waitsOf('legacy-idp-off').includes('legacy-idp-sunset'), JSON.stringify({ m: members(), w: waitsOf('legacy-idp-off') }));
|
|
119
|
+
const after = await until(() => p.evaluate(() => { const r = [...document.querySelectorAll('#ibBody [data-key]')].find((x) => /Legacy IdP sunset/.test(x.textContent) && !x.closest('[data-po-list]')); const v = document.querySelector('#czViewer'); return r ? { sel: r.classList.contains('sel') || !!r.querySelector('.sel'), open: !!v && !v.hidden && /Legacy IdP sunset/.test(v.textContent) } : null; }));
|
|
120
|
+
ok('B the row shows under its product, and the panel stays on it', !!after && after.open, JSON.stringify(after));
|
|
121
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-done.png' });
|
|
122
|
+
await p.click('#bdToast .bd-undo');
|
|
123
|
+
await until(async () => (await kids(p)).includes('legacy-idp-sunset'));
|
|
124
|
+
ok('B Undo rejoins it with the milestone back, in its old place', members().includes('legacy-idp-sunset') && waitsOf('legacy-idp-off').includes('legacy-idp-sunset') && (await kids(p)).includes('legacy-idp-sunset') && posts[posts.length - 1].body.back.length === 1, JSON.stringify({ k: await kids(p), last: posts[posts.length - 1] }));
|
|
125
|
+
// Move to another program
|
|
126
|
+
await p.click('#ibBody .bt-kid .bt-nm >> text=Legacy IdP sunset');
|
|
127
|
+
await p.waitForSelector('#czViewer:not([hidden])');
|
|
128
|
+
await menu(p);
|
|
129
|
+
await p.click('.cz-vw-menu [role="menuitem"] >> text=Move to another program');
|
|
130
|
+
const list = await until(() => p.evaluate(() => { const h = document.querySelector('#bdPop'); return h && !h.hidden ? [...h.querySelectorAll('[data-pm-to]')].map((b) => b.textContent.trim()) : null; }));
|
|
131
|
+
ok('B Move to another program lists the other open program, with its count', !!list && list.length === 1 && /Partner identity/.test(list[0]) && /1 initiative/.test(list[0]), JSON.stringify(list));
|
|
132
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-other.png' });
|
|
133
|
+
await p.click('#bdPop [data-pm-to="0"]');
|
|
134
|
+
await until(async () => !(await kids(p)).includes('legacy-idp-sunset'));
|
|
135
|
+
ok('B the move lands in Partner identity; the toast says so with Undo', /Moved to Partner identity · off 1 milestone/.test(await toast(p)) && (R.all(rctx).find((x) => x.id === 'partner-identity').members.some((m) => m.initiative === 'legacy-idp-sunset')), await toast(p));
|
|
136
|
+
await p.click('#bdToast .bd-undo');
|
|
137
|
+
await until(() => members().includes('legacy-idp-sunset'));
|
|
138
|
+
ok('B Undo of a move to another program brings it back to Project Ascent', members().includes('legacy-idp-sunset') && !R.all(rctx).find((x) => x.id === 'partner-identity').members.some((m) => m.initiative === 'legacy-idp-sunset'));
|
|
139
|
+
ok('B no page error', !errors.length, errors.join(' | '));
|
|
140
|
+
await ctx.close();
|
|
141
|
+
}
|
|
142
|
+
{
|
|
143
|
+
const { ctx, page: p, errors } = await board({ w: 390, h: 844 });
|
|
144
|
+
const row = p.locator('#ibBody .bt-nm >> text=Legacy IdP sunset').first();
|
|
145
|
+
await row.click();
|
|
146
|
+
await p.waitForSelector('#czViewer:not([hidden])');
|
|
147
|
+
const m = await menu(p);
|
|
148
|
+
ok('B phone: the ⋯ sheet holds the same two items', m.includes('Move out of Project Ascent') && m.some((x) => /^Move to another program/.test(x)), JSON.stringify(m));
|
|
149
|
+
await p.click('.cz-vw-menu [role="menuitem"] >> text=Move out of Project Ascent');
|
|
150
|
+
const t = await until(() => toast(p));
|
|
151
|
+
ok('B phone: the toast is short: where it is now and the milestone it left', /^Now under IDPF · off 1 milestone/.test(t), t);
|
|
152
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-phone-done.png' });
|
|
153
|
+
ok('B phone: no page error', !errors.length, errors.join(' | '));
|
|
154
|
+
await ctx.close();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* H — Home's initiative page */
|
|
158
|
+
const home = async () => {
|
|
159
|
+
seed();
|
|
160
|
+
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
|
|
161
|
+
const page = await ctx.newPage();
|
|
162
|
+
const errors = [];
|
|
163
|
+
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
164
|
+
const json = (body) => (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(body) });
|
|
165
|
+
await page.route(/\/api\/briefing-premium(\?.*)?$/, json({ ok: true, state: 'ready', model: B.build(HF.facts()), as_of: Date.now() }));
|
|
166
|
+
await page.route('**/api/briefing-premium/thread**', json({ ok: true, turns: [], working: false }));
|
|
167
|
+
await page.route('**/api/board-premium*', (r) => { const q = new URL(r.request().url()).searchParams; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.programFacts(q.get('ws') || 'idpf')), as_of: Date.now() }) }); });
|
|
168
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'not in this check' }) }));
|
|
169
|
+
// the initiative's own read (its page's ⋯ needs it): the fixture's model, named after the initiative asked for
|
|
170
|
+
await page.route('**/api/initiative-premium*', (r) => { const id = new URL(r.request().url()).searchParams.get('id') || ''; const m = IP.build(IF.facts()); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: { ...m, id, title: id }, as_of: Date.now() }) }); });
|
|
171
|
+
await routePrograms(page);
|
|
172
|
+
const am = new Date(); am.setHours(10, 0, 0, 0); await page.clock.setFixedTime(am);
|
|
173
|
+
await page.goto(BASE + '/premium.html?theme=light');
|
|
174
|
+
await until(() => page.evaluate(() => !!document.querySelector('#hmList .hv-g.prg [data-po-id]')), 20000);
|
|
175
|
+
return { ctx, page, errors };
|
|
176
|
+
};
|
|
177
|
+
{
|
|
178
|
+
const { ctx, page: p, errors } = await home();
|
|
179
|
+
const goPage = async (id) => {
|
|
180
|
+
await p.goto(BASE + '/premium.html?theme=light&ini=' + id);
|
|
181
|
+
return until(() => p.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && !!v.querySelector('[data-cz-vw="more"]'); }), 15000);
|
|
182
|
+
};
|
|
183
|
+
ok('H the initiative page opens', await goPage('legacy-idp-sunset'));
|
|
184
|
+
const m = await menu(p);
|
|
185
|
+
ok('H the page\'s ⋯ holds Move out of Project Ascent and Move to another program; no Turn into a program', m.includes('Move out of Project Ascent') && m.some((x) => /^Move to another program/.test(x)) && !m.includes('Turn into a program'), JSON.stringify(m));
|
|
186
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/home-more.png' });
|
|
187
|
+
await p.click('.cz-vw-menu [role="menuitem"] >> text=Move to another program');
|
|
188
|
+
const list = await until(() => p.evaluate(() => { const h = document.querySelector('.hi-pop.menu'); return h ? [...h.querySelectorAll('[data-hi-mi]')].map((b) => b.textContent.trim()) : null; }));
|
|
189
|
+
ok('H Move to another program lists Partner identity', !!list && list.length === 1 && /Partner identity/.test(list[0]), JSON.stringify(list));
|
|
190
|
+
await p.keyboard.press('Escape');
|
|
191
|
+
await menu(p);
|
|
192
|
+
await p.click('.cz-vw-menu [role="menuitem"] >> text=Move out of Project Ascent');
|
|
193
|
+
const t = await until(() => p.evaluate(() => { const el = document.querySelector('#toast'); return el && el.classList.contains('on') ? el.textContent : ''; }));
|
|
194
|
+
ok('H Move out: the toast says where it went, with Undo; the program lets it go', /Moved out of Project Ascent · now under .+ · off 1 milestone/.test(t) && /Undo/.test(t) && !members().includes('legacy-idp-sunset'), t);
|
|
195
|
+
await p.click('#toast .undo');
|
|
196
|
+
await until(() => members().includes('legacy-idp-sunset'));
|
|
197
|
+
ok('H Undo puts it back, with the milestone', members().includes('legacy-idp-sunset') && waitsOf('legacy-idp-off').includes('legacy-idp-sunset'));
|
|
198
|
+
ok('H an initiative in no program keeps Turn into a program and has no Move items', await goPage('eshop-inline-login') && await (async () => { const m2 = await menu(p); return m2.includes('Turn into a program') && !m2.some((x) => /^Move (out|to another)/.test(x)); })());
|
|
199
|
+
ok('H no page error', !errors.length, errors.join(' | '));
|
|
200
|
+
await ctx.close();
|
|
201
|
+
}
|
|
202
|
+
finish();
|
|
203
|
+
})();
|
|
@@ -118,7 +118,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
118
118
|
await fold(p, 'tree');
|
|
119
119
|
await until(() => p.evaluate(() => !!document.querySelector('#czViewer button.pp-open[data-ini="descope-parity"]')));
|
|
120
120
|
await p.click('#czViewer button.pp-open[data-ini="descope-parity"]');
|
|
121
|
-
const ip = await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer'); if (!v || v.hidden || !/Initiative/.test(v.getAttribute('aria-label') || '')) return null; return { t: v.querySelector('.cz-vw-title').textContent, peek: !document.querySelector('#peek'), stg: v.querySelectorAll('.iv-
|
|
121
|
+
const ip = await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer'); if (!v || v.hidden || !/Initiative/.test(v.getAttribute('aria-label') || '')) return null; return { t: v.querySelector('.cz-vw-title').textContent, peek: !document.querySelector('#peek'), stg: new Set([...v.querySelectorAll('.iv-tl .iv-tlp')].map((x) => x.dataset.ivStage)).size + v.querySelectorAll('.iv-tl .iv-tl-sk').length }; }));
|
|
122
122
|
ok('O an initiative in the tree opens the Board\'s initiative in the same shell, with its eight steps (XvABoard)', !!ip && ip.t === 'Descope feature parity' && ip.peek && ip.stg === 8, JSON.stringify(ip));
|
|
123
123
|
await p.keyboard.press('Escape');
|
|
124
124
|
await until(() => p.evaluate(() => document.querySelector('#czViewer').hidden));
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* and its text (GET /api/doc). Add a document POST /api/custom-docs/add; Draft it POST /api/core-docs/draft.
|
|
17
17
|
* Metrics, Notifications the board's measures (GET /api/board-metrics-premium) and what waits on you here
|
|
18
18
|
* Nothing here invents a value: what a record does not hold is not drawn. */
|
|
19
|
+
import { followDoc } from './doc-follow.js';
|
|
19
20
|
import { pmPost } from './http.js';
|
|
20
21
|
import { $, $$, esc } from './premium-shell.js';
|
|
21
22
|
import * as Pop from './bd-pop.js';
|
|
@@ -297,8 +298,10 @@ async function openDocPanel(id, from) {
|
|
|
297
298
|
A.redraw();
|
|
298
299
|
if (x.path) {
|
|
299
300
|
if (!meta) { await A.loadDocMeta([{ path: x.path, ws: x.ws }]); const m2 = A.docMeta(x.path, x.ws), w = $('#dlogW'); if (w && docOpen === id) w.outerHTML = m2 && m2.log ? `<p class="bd-lbl">Edit log</p>${m2.log.map((l) => `<div class="bd-trow sm">${V.avatar(l.by, 'b')}<span class="bd-push0">${esc(l.subject)}</span><span class="bd-amut">${esc(l.at)}</span></div>`).join('')}` : '<p class="bd-amut">No edit is in the git history yet.</p>'; }
|
|
300
|
-
|
|
301
|
-
const el = $('#cdText');
|
|
301
|
+
// the text follows the file: a chat's edit shows within a few seconds, uncommitted, from the initiative's worktree (pm/doc-follow.js)
|
|
302
|
+
const shown = () => { const el = $('#cdText'); return !!el && el.isConnected && docOpen === id; };
|
|
303
|
+
followDoc({ ws: x.ws || M().board.ws || '', ini: x.src === 'ini' && x.ini ? x.ini.id : '', path: x.path, alive: shown,
|
|
304
|
+
onText: (t) => { const el = $('#cdText'); if (el && docOpen === id) el.textContent = t == null ? x.path + ' could not be read.' : t; } });
|
|
302
305
|
}
|
|
303
306
|
}
|
|
304
307
|
/** A board document by its key; with All products, by its key and its product's workspace (two products can hold the same key). */
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* questions, usual(track) the usual days in the step, rowOf(key), pageHref(r), askHref(r, q), refreshJira(), send(r) the
|
|
6
6
|
* Send to Jira sheet, acts(r, btn) the row actions popover, grillOpen(r, btn), onShow(key, from) / onHide() so the page
|
|
7
7
|
* marks the row the item came from, programOf(r) the program it is in or null, openProgram(id, btn), turnProgram(r)
|
|
8
|
-
* "Turn into a program",
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* "Turn into a program", moveItems(r) Move out of its program and Move to another (pm/prog-move.js), smItems(r) and
|
|
9
|
+
* smPress(r, act, btn) Split into a new initiative and Merge into (pm/split-merge.js), openIniId(id) a row by its record id, setTask(r, uid, state) a task's state, setDates(r, uid, { start?, due? }) its days (the Tasks
|
|
10
|
+
* views' quick changes, batch 9 item 5b), removeTask(r, uid) the status picker's trash (batch 11 item 16), addTask(r, title) a new task (POST /api/boards/tasks/add),
|
|
11
|
+
* openTask(r, task) the task's own editor, hold(r, i, btn) a hold's menu (the stage card's ⏸, batch 11 item 21), viewDoc(path), reload() a new read of the Board and toast(text, undo?) (planned
|
|
12
|
+
* versus actual, pm/ini-versions.js) }
|
|
11
13
|
* openIni(r, from) the initiative: the ONE view (pm/ini-view.js from pm/ini-view-model.js, feedback batch 6 item 1; canvas OvIniA), the
|
|
12
14
|
* same as Home's initiative page: the summary card, the stage card with its dates line (it replaced the Plan card, item 3),
|
|
13
15
|
* Tasks as the WBS, then Documents and Linked. What the Board adds under them: drafted tickets and the PRD drift.
|
|
@@ -20,6 +22,7 @@ import * as VW from './cozy-viewer.js';
|
|
|
20
22
|
import { esc } from './premium-shell.js';
|
|
21
23
|
import { lr, copyText } from './cozy-xv.js';
|
|
22
24
|
import { iniView } from './ini-view-model.js';
|
|
25
|
+
import { rowFor } from './ini-versions.js'; // planned versus actual (batch 11 item 8): Live or the draft the PM shows, with the plan line
|
|
23
26
|
import { viewHtml, wireView } from './ini-view.js';
|
|
24
27
|
import * as TV from './tk-view.js';
|
|
25
28
|
|
|
@@ -27,6 +30,7 @@ let O = null;
|
|
|
27
30
|
let cur = null; // { key, tk } the initiative shown, and its ticket while the drill-in is shown
|
|
28
31
|
let adding = null; // the key of the initiative whose inline Add a task is open
|
|
29
32
|
let addTo = ''; // the stage a task added there finishes (the Board's Next cell: "Add what finishes <stage>")
|
|
33
|
+
let addDates = null; // the start and due a task added there takes (a gap's + on the timeline, batch 11 item 13)
|
|
30
34
|
const TI = (r) => (r && r.trail) || null;
|
|
31
35
|
const tkState = (k) => (k.blocked ? 'Blocked' + (k.reason ? ' by ' + k.reason.replace(/^Waiting on /i, '') : '') : k.status || 'To do');
|
|
32
36
|
const jiraAt = () => { const J = (O.M() && O.M().jira) || {}; return J.readAt ? 'Jira · ' + O.ago(J.readAt) : ''; };
|
|
@@ -35,7 +39,7 @@ const jiraAt = () => { const J = (O.M() && O.M().jira) || {}; return J.readAt ?
|
|
|
35
39
|
/** The view's model for a row: the same function Home's page calls, with what only the Board's model holds (its eight steps, its day). */
|
|
36
40
|
export function viewOf(r) {
|
|
37
41
|
const M = O.M() || {}, p = O.programOf ? O.programOf(r) : null, u = O.usual ? O.usual(r.track || {}) : null;
|
|
38
|
-
return iniView(r, { steps: M.steps || [], today: M.today, usual: u, grill: r.id ? O.grill(r.id) : null, program: p ? { id: p.id, title: p.title } : null, jiraAt: jiraAt() });
|
|
42
|
+
return iniView(rowFor(r), { steps: M.steps || [], today: M.today, usual: u, grill: r.id ? O.grill(r.id) : null, program: p ? { id: p.id, title: p.title } : null, jiraAt: jiraAt() });
|
|
39
43
|
}
|
|
40
44
|
function draftedHtml(d, g) {
|
|
41
45
|
return d.slice(0, 8).map((x) => lr({ mk: x.waiting ? 'you' : '', title: (x.id ? `<em>${esc(x.id)}</em> ` : '') + esc(x.summary || ''), sub: 'not in Jira' })).join('')
|
|
@@ -61,6 +65,11 @@ function iniMore(r) {
|
|
|
61
65
|
if (r.id) more.push({ label: 'Change the plan dates', on: () => location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)) });
|
|
62
66
|
// P7 (program-hierarchy PRD): an initiative in no program can become one; the chat cannot, because every program write is a page press
|
|
63
67
|
if (r.id && O.turnProgram && !(O.programOf && O.programOf(r))) more.push({ label: 'Turn into a program', on: () => O.turnProgram(r) });
|
|
68
|
+
// an initiative in a program can move out of it, or to another one (feedback batch 11 item 2, canvas LpA1More, LpA2Other; pm/prog-move.js)
|
|
69
|
+
const mv = r.id && O.moveItems ? O.moveItems(r) : [];
|
|
70
|
+
// split it into a new initiative, or merge it into another, above the program moves (batch 11 item 14, canvas XsmA1Menu; pm/split-merge.js)
|
|
71
|
+
const sm = r.id && O.smItems ? O.smItems(r) : [];
|
|
72
|
+
if (sm.length || mv.length) more.push({ sep: true }, ...sm, ...mv);
|
|
64
73
|
if ((O.M() || {}).jira) more.push({ sep: true }, { label: 'Read Jira again', on: () => O.refreshJira() });
|
|
65
74
|
more.push({ sep: true });
|
|
66
75
|
if (r.id) more.push({ label: 'Copy link', on: () => copyText(new URL(O.pageHref(r), location.href).href, 'Link copied.') });
|
|
@@ -77,22 +86,33 @@ function iniText(r) {
|
|
|
77
86
|
return lines.join('\n');
|
|
78
87
|
}
|
|
79
88
|
function iniBody(r) {
|
|
80
|
-
|
|
89
|
+
const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10);
|
|
90
|
+
return viewHtml(viewOf(r), { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold, tail: VW.czSections(boardSections(r), { key: 'board' }) });
|
|
81
91
|
}
|
|
82
92
|
/** Presses inside the shown item: the view's own (pm/ini-view.js), a ticket's drill-in, the PRD-change question. A [data-doc] goes to the page's handler. */
|
|
83
93
|
function wire(body, key) {
|
|
84
94
|
const redraw = () => { const r = O.rowOf(key); if (!r || (cur && cur.tk)) return; const top = body.scrollTop; body.innerHTML = iniBody(r); body.scrollTop = top; };
|
|
85
95
|
wireView(body, {
|
|
96
|
+
// planned versus actual (batch 11 item 8, pm/ini-versions.js): where a draft's writes go, the read after Make live, the toast with Undo
|
|
97
|
+
where: () => { const r = O.rowOf(key), M = O.M() || {}; return { ws: (r && r.ws) || (M.board && M.board.ws), board: (r && r.boardId) || (M.board && M.board.id) }; },
|
|
98
|
+
reload: () => (O.reload ? O.reload() : null),
|
|
99
|
+
toast: (m, undo) => (O.toast ? O.toast(m, undo) : null),
|
|
86
100
|
check: (uid, b) => { const r = O.rowOf(key), k = r && (r.tasks || []).find((x) => x.uid === uid); if (r && O.setTask) O.setTask(r, uid, k && k.status === 'Done' ? 'To do' : 'Done'); },
|
|
87
101
|
// the quick changes (batch 9 item 5b): the status caret, the date press and a Timeline or Kanban drag, each with Undo in the toast
|
|
88
102
|
status: (uid, state) => { const r = O.rowOf(key); if (r && O.setTask) O.setTask(r, uid, state); },
|
|
89
103
|
dates: (uid, patch) => { const r = O.rowOf(key); if (r && O.setDates) O.setDates(r, uid, patch); },
|
|
104
|
+
// the ◇ in the status picker (batch 11 item 3): a task made a milestone, or made a plain task again, with Undo
|
|
105
|
+
milestone: (uid, on) => { const r = O.rowOf(key); if (r && O.setDates) O.setDates(r, uid, { milestone: !!on }); },
|
|
106
|
+
// the trash in the status picker (batch 11 item 16): Delete, with Undo in the toast
|
|
107
|
+
...(O.removeTask ? { remove: (uid) => { const r = O.rowOf(key); if (r) O.removeTask(r, uid); } } : {}),
|
|
90
108
|
openTicket: (tk) => { const r = O.rowOf(key), k = r && ((r.track && r.track.tickets) || []).find((x) => x.key === tk); if (k) openTicket(r, k); },
|
|
91
109
|
// a task's title opens the one task editor (task-card.js) as a drill-in: ← comes back to the initiative (batch 9 item 5a)
|
|
92
110
|
openTask: (uid) => { const r = O.rowOf(key), k = r && (r.tasks || []).find((x) => x.uid === uid); if (k && O.openTask) { VW.drill(); O.openTask(r, k); } },
|
|
93
|
-
add: () => { adding = key; redraw(); const f = body.querySelector('#ivAddTask'); if (f) f.focus(); },
|
|
94
|
-
|
|
95
|
-
|
|
111
|
+
add: (b, dates) => { adding = key; if (dates && dates.start) addDates = dates; redraw(); const f = body.querySelector('#ivAddTask'); if (f) f.focus(); },
|
|
112
|
+
// the stage card's ⏸ or calendar on a hold (batch 11 item 21): the Board's own hold menu (bd-acts.js)
|
|
113
|
+
hold: (i, b) => { const r = O.rowOf(key); if (r && O.hold) O.hold(r, i, b); },
|
|
114
|
+
addCancel: () => { adding = null; addTo = ''; addDates = null; redraw(); },
|
|
115
|
+
addTask: async (title, inp) => { const r = O.rowOf(key); if (!r || !O.addTask) return; inp.disabled = true; const ok = await O.addTask(r, title, addTo, addDates); inp.disabled = false; if (ok) { inp.value = ''; inp.focus(); } },
|
|
96
116
|
primary: (act, b) => {
|
|
97
117
|
const r = O.rowOf(key); if (!r) return;
|
|
98
118
|
if (act === 'grill') O.grillOpen(r, b);
|
|
@@ -101,6 +121,9 @@ function wire(body, key) {
|
|
|
101
121
|
else if (act === 'page' && r.id) location.assign(O.pageHref(r));
|
|
102
122
|
},
|
|
103
123
|
program: (id, b) => { if (O.openProgram) O.openProgram(id, b); },
|
|
124
|
+
// Claude's split or merge card (batch 11 item 14): ✕ Not now, ✎ Change it first, ✓ as suggested; the merged summary's link opens the one that stays
|
|
125
|
+
sm: (act, b) => { const r = O.rowOf(key); if (r && O.smPress) O.smPress(r, act, b); },
|
|
126
|
+
openIni: (id) => { if (O.openIniId) O.openIniId(id); },
|
|
104
127
|
doc: (path) => O.viewDoc(path),
|
|
105
128
|
redraw,
|
|
106
129
|
});
|
|
@@ -117,7 +140,7 @@ function wire(body, key) {
|
|
|
117
140
|
export const vidOf = (r) => (r.id ? String(r.id) : 'bd:' + r.key);
|
|
118
141
|
export function openIni(r, from, o = {}) {
|
|
119
142
|
if (!O || !r || !r.track) return;
|
|
120
|
-
adding = o.addTo != null ? r.key : null; addTo = o.addTo || '';
|
|
143
|
+
adding = o.addTo != null ? r.key : null; addTo = o.addTo || ''; addDates = o.addDates || null;
|
|
121
144
|
// a row with no record id has no chat of its own: its question goes to the board's chat
|
|
122
145
|
VW.open({ kind: 'Initiative', title: r.title, icon: 'flag', id: vidOf(r), url: r.id ? O.pageHref(r) : '', full: true,
|
|
123
146
|
discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: iniMore(r), rename: O.rename ? O.rename(r) : null,
|