create-pmos 0.405.0 → 0.407.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 -30
- 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/briefing-premium-adddoc-test.js +4 -3
- package/workspace/briefing-premium-doc-edit-test.js +3 -5
- package/workspace/briefing-premium-initiative-test.js +46 -27
- package/workspace/changelog.json +24 -0
- package/workspace/guide/home.md +21 -4
- package/workspace/guide/programs.md +1 -0
- package/workspace/lib/engine/boards.js +2 -1
- package/workspace/lib/initiative-writer.js +45 -1
- package/workspace/lib/routes-boards.js +13 -0
- package/workspace/lib/routes-initiatives.js +12 -0
- 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 +4 -1
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +4 -6
- package/workspace/premium-vw-item-test.js +1 -1
- package/workspace/premium-vw-jira-test.js +2 -2
- package/workspace/public/pm/bd-ini-panel.js +2 -2
- package/workspace/public/pm/bd-prog-panel.js +15 -5
- package/workspace/public/pm/cozy-home.css +5 -0
- package/workspace/public/pm/cozy-nav.js +4 -0
- package/workspace/public/pm/cozy-today.css +2 -0
- package/workspace/public/pm/cozy-viewer.js +75 -10
- package/workspace/public/pm/cozy-vw-shell.css +20 -1
- package/workspace/public/pm/home-app.js +135 -61
- package/workspace/public/pm/home-ini.css +14 -0
- package/workspace/public/pm/home-ini.js +98 -81
- package/workspace/public/pm/home-task.js +5 -2
- package/workspace/public/pm/home-today.js +7 -5
- package/workspace/public/pm/premium-board.js +21 -2
- package/workspace/public/pm/premium-viewer.js +1 -1
- package/workspace/public/pm/premium-vw-item.js +1 -0
- package/workspace/public/pm/rename-press.js +81 -0
- package/workspace/public/premium.html +1 -1
- package/workspace/rename-test.js +166 -0
- package/workspace/test-lists/rename.json +9 -0
- package/workspace/tk-tasks-test.js +2 -3
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* rename-test.js — tap the title to rename a program, an initiative or a task (testing feedback 2026-10-24; canvas RnATask, RnAIni,
|
|
4
|
+
* RnAProg, RnASaved, RnAPhone). Serves the real Board page from the real server; GET /api/board-premium answers the Project Ascent
|
|
5
|
+
* product (fixtures/board-premium-facts.js programFacts, one row given a Jira epic), GET /api/programs its programs, and every write
|
|
6
|
+
* is captured, not written.
|
|
7
|
+
* F the field: a tap makes the title one field with a check; Esc cancels; an empty name saves nothing; the same name saves nothing
|
|
8
|
+
* I an initiative: Enter writes POST /api/initiatives/rename with its id; the panel and the list show the new name at once; the toast
|
|
9
|
+
* says Renamed with Undo, and Undo sends the old name; the Jira box is there only for a row with an epic, off by default, and when
|
|
10
|
+
* ticked Home's chat opens on the initiative with the request typed, not sent
|
|
11
|
+
* P a program: the field holds the name only (not "· goal"); the save resends the whole charter with its id, so no new program is made
|
|
12
|
+
* E a refusal keeps the field open with the reason
|
|
13
|
+
* S on a phone the field fills the header */
|
|
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: 'rename' });
|
|
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 sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
23
|
+
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); } };
|
|
24
|
+
const results = [];
|
|
25
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
26
|
+
let srv = null; let browser = null;
|
|
27
|
+
const finish = async (code) => {
|
|
28
|
+
if (browser) await browser.close().catch(() => {});
|
|
29
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
30
|
+
T.killTmux();
|
|
31
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
32
|
+
console.log(`\n${results.length - bad}/${results.length} rename assertions passed`);
|
|
33
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
34
|
+
};
|
|
35
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
36
|
+
|
|
37
|
+
(async () => {
|
|
38
|
+
const exe = process.env.PMOS_CHROME || findBrowser();
|
|
39
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
40
|
+
let chromium;
|
|
41
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
42
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
43
|
+
await T.waitForServer(BASE);
|
|
44
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
45
|
+
|
|
46
|
+
const model = () => { const m = BP.build(F.programFacts('idpf')); const r = m.rows.find((x) => x.id === 'descope-parity'); if (r) r.epics = ['IDPF-12']; return m; };
|
|
47
|
+
const open = async ({ w = 1440, h = 900, qs = '?ws=idpf&focus=descope-parity', refuse = false } = {}) => {
|
|
48
|
+
const c = await browser.newContext({ viewport: { width: w, height: h } });
|
|
49
|
+
const page = await c.newPage();
|
|
50
|
+
const errors = [], posts = [];
|
|
51
|
+
page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
|
|
52
|
+
const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
|
|
53
|
+
await page.route('**/api/board-premium*', (r) => json(r, { ok: true, state: 'ready', model: model(), as_of: Date.now() }));
|
|
54
|
+
await page.route('**/api/programs', (r) => json(r, { ok: true, programs: F.programs() }));
|
|
55
|
+
await page.route('**/api/boards/anchors*', (r) => json(r, { ok: true, anchors: [] }));
|
|
56
|
+
await page.route('**/api/insights-premium*', (r) => json(r, { ok: true, model: { goals: [] } }));
|
|
57
|
+
await page.route('**/api/boards/items*', (r) => json(r, { ok: true, items: [] }));
|
|
58
|
+
await page.route('**/api/board-trail*', (r) => json(r, { ok: false, error: 'not in this check' }, 500));
|
|
59
|
+
const capture = (r) => {
|
|
60
|
+
const rq = r.request(), body = JSON.parse(rq.postData() || '{}'), p = new URL(rq.url()).pathname;
|
|
61
|
+
posts.push({ path: p, body });
|
|
62
|
+
if (refuse) return json(r, { ok: false, error: 'the record could not be written — nothing was saved' }, 500);
|
|
63
|
+
if (p === '/api/initiatives/rename') return json(r, { ok: true, id: body.id, title: body.title, from: posts.filter((x) => x.path === p).length > 1 ? 'Descope feature parity · v2' : 'Descope feature parity' });
|
|
64
|
+
return json(r, { ok: true });
|
|
65
|
+
};
|
|
66
|
+
await page.route('**/api/initiatives/rename', capture);
|
|
67
|
+
await page.route('**/api/programs/*', capture);
|
|
68
|
+
await page.goto(BASE + '/premium-board.html' + qs);
|
|
69
|
+
return { page, ctx: c, errors, posts };
|
|
70
|
+
};
|
|
71
|
+
const head = (p) => p.evaluate(() => { const v = document.querySelector('#czViewer'); if (!v || v.hidden) return null; const i = v.querySelector('.cz-vw-ren input');
|
|
72
|
+
return { title: (v.querySelector('.cz-vw-title') || {}).textContent || '', field: i ? i.value : null, check: !!v.querySelector('.cz-vw-ren .cz-vw-sv'), jira: (v.querySelector('.cz-vw-jt') || {}).textContent || '',
|
|
73
|
+
jiraOn: !!(v.querySelector('.cz-vw-jt input') || {}).checked, err: (v.querySelector('.cz-vw-rnerr') || {}).textContent || '', press: !!v.querySelector('[data-cz-vw-rn]'), pencil: !!v.querySelector('[aria-label*="pencil" i], [data-cz-vw="edit"]') }; });
|
|
74
|
+
|
|
75
|
+
/* ── an initiative on the Board (RnAIni) ── */
|
|
76
|
+
const D = await open();
|
|
77
|
+
const p = D.page;
|
|
78
|
+
let h = await until(() => head(p).then((x) => (x && /Descope/.test(x.title) ? x : null)));
|
|
79
|
+
ok('F the initiative\'s title is the rename press: no pencil button, a text cursor on hover', h && h.press && !h.pencil
|
|
80
|
+
&& await p.evaluate(() => getComputedStyle(document.querySelector('#czViewer [data-cz-vw-rn]')).cursor) === 'text', JSON.stringify(h));
|
|
81
|
+
await p.click('#czViewer [data-cz-vw-rn]');
|
|
82
|
+
h = await head(p);
|
|
83
|
+
ok('F a tap makes it one field with the name and a check; the focus is in it', h.field === 'Descope feature parity' && h.check && await p.evaluate(() => document.activeElement && document.activeElement.closest('.cz-vw-ren') !== null), JSON.stringify(h));
|
|
84
|
+
ok('I the initiative has a Jira epic, so the box is there, off by default, naming it', /Rename the Jira epic too/.test(h.jira) && /IDPF-12/.test(h.jira) && !h.jiraOn, JSON.stringify(h));
|
|
85
|
+
await p.keyboard.press('Escape');
|
|
86
|
+
h = await head(p);
|
|
87
|
+
ok('F Esc cancels: the title is back, the Viewer stays open, nothing is written', h && h.field === null && /Descope feature parity/.test(h.title) && D.posts.length === 0, JSON.stringify([h, D.posts]));
|
|
88
|
+
await p.click('#czViewer [data-cz-vw-rn]');
|
|
89
|
+
await p.fill('#czViewer .cz-vw-ren input', ' ');
|
|
90
|
+
await p.keyboard.press('Enter');
|
|
91
|
+
h = await head(p);
|
|
92
|
+
ok('F an empty name saves nothing: the field stays', h.field !== null && D.posts.length === 0, JSON.stringify([h, D.posts]));
|
|
93
|
+
await p.fill('#czViewer .cz-vw-ren input', 'Descope feature parity');
|
|
94
|
+
await p.keyboard.press('Enter');
|
|
95
|
+
h = await head(p);
|
|
96
|
+
ok('F the same name saves nothing and closes the field', h.field === null && D.posts.length === 0, JSON.stringify([h, D.posts]));
|
|
97
|
+
await p.click('#czViewer [data-cz-vw-rn]');
|
|
98
|
+
await p.fill('#czViewer .cz-vw-ren input', 'Descope feature parity · v2');
|
|
99
|
+
await p.keyboard.press('Enter');
|
|
100
|
+
h = await until(() => head(p).then((x) => (x && x.field === null ? x : null)));
|
|
101
|
+
const post = D.posts.find((x) => x.path === '/api/initiatives/rename');
|
|
102
|
+
ok('I Enter writes the rename with the initiative\'s id and the new name', post && post.body.id === 'descope-parity' && post.body.title === 'Descope feature parity · v2' && post.body.ws === 'idpf', JSON.stringify(D.posts));
|
|
103
|
+
ok('I the panel shows the new name at once', h && h.title === 'Descope feature parity · v2', JSON.stringify(h));
|
|
104
|
+
const row = await until(() => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-key]')].map((x) => x.textContent).some((t) => /Descope feature parity · v2/.test(t))));
|
|
105
|
+
ok('I the Board list shows the new name too', row);
|
|
106
|
+
const tst = await until(() => p.evaluate(() => { const t = document.querySelector('#bdToast'); return t && !t.hidden ? t.textContent : ''; }));
|
|
107
|
+
ok('I the toast says Renamed, with Undo', /^Renamed/.test(tst) && /Undo/.test(tst), tst + ' | ' + D.errors.join(' | '));
|
|
108
|
+
await p.click('#bdToast .bd-undo');
|
|
109
|
+
await until(() => D.posts.filter((x) => x.path === '/api/initiatives/rename').length === 2);
|
|
110
|
+
const undo = D.posts.filter((x) => x.path === '/api/initiatives/rename')[1];
|
|
111
|
+
h = await until(() => head(p).then((x) => (x && x.title === 'Descope feature parity' ? x : null)));
|
|
112
|
+
ok('I Undo sends the old name through the same route, and the panel shows it again', undo && undo.body.title === 'Descope feature parity' && h, JSON.stringify([undo, h]));
|
|
113
|
+
|
|
114
|
+
// the Jira box, ticked: Home's chat about the initiative, with the request typed for the PM to send
|
|
115
|
+
await p.click('#czViewer [data-cz-vw-rn]');
|
|
116
|
+
await p.fill('#czViewer .cz-vw-ren input', 'Descope parity');
|
|
117
|
+
await p.check('#czViewer .cz-vw-jt input');
|
|
118
|
+
await Promise.all([p.waitForURL(/\/premium\.html\?/, { timeout: 15000 }).catch(() => null), p.click('#czViewer .cz-vw-sv')]);
|
|
119
|
+
const u = new URL(p.url());
|
|
120
|
+
ok('I with the Jira box ticked, Home opens the initiative\'s chat with the request typed, not sent', u.pathname === '/premium.html' && u.searchParams.get('about') === 'init:descope-parity'
|
|
121
|
+
&& u.searchParams.get('say') === 'Rename the Jira epic IDPF-12 to "Descope parity".', u.href);
|
|
122
|
+
ok('I a row with no Jira epic has no Jira box', await (async () => {
|
|
123
|
+
const X = await open({ qs: '?ws=idpf&focus=usage-billing' });
|
|
124
|
+
await until(() => head(X.page).then((x) => (x && /Usage-based billing/.test(x.title) ? x : null)));
|
|
125
|
+
await X.page.click('#czViewer [data-cz-vw-rn]');
|
|
126
|
+
const y = await head(X.page); await X.ctx.close(); return y && y.field === 'Usage-based billing' && y.jira === '';
|
|
127
|
+
})());
|
|
128
|
+
ok('I no page error', D.errors.length === 0, D.errors.join(' | '));
|
|
129
|
+
await D.ctx.close();
|
|
130
|
+
|
|
131
|
+
/* ── a refusal (E) ── */
|
|
132
|
+
const E = await open({ refuse: true });
|
|
133
|
+
await until(() => head(E.page).then((x) => (x && /Descope/.test(x.title) ? x : null)));
|
|
134
|
+
await E.page.click('#czViewer [data-cz-vw-rn]');
|
|
135
|
+
await E.page.fill('#czViewer .cz-vw-ren input', 'New name');
|
|
136
|
+
await E.page.keyboard.press('Enter');
|
|
137
|
+
h = await until(() => head(E.page).then((x) => (x && x.err ? x : null)));
|
|
138
|
+
ok('E a refusal keeps the field open, with the name typed and the reason', h && h.field === 'New name' && /nothing was saved/.test(h.err), JSON.stringify(h));
|
|
139
|
+
await E.ctx.close();
|
|
140
|
+
|
|
141
|
+
/* ── a program (RnAProg) ── */
|
|
142
|
+
const G = await open({ qs: '?ws=idpf&program=project-ascent' });
|
|
143
|
+
h = await until(() => head(G.page).then((x) => (x && /Project Ascent/.test(x.title) ? x : null)));
|
|
144
|
+
await G.page.click('#czViewer [data-cz-vw-rn]');
|
|
145
|
+
h = await head(G.page);
|
|
146
|
+
ok('P the field holds the program\'s name only, not "· goal"; a program has no Jira box', h.field === 'Project Ascent' && h.jira === '', JSON.stringify(h));
|
|
147
|
+
await G.page.fill('#czViewer .cz-vw-ren input', 'Ascent');
|
|
148
|
+
await G.page.keyboard.press('Enter');
|
|
149
|
+
const sv = await until(() => G.posts.find((x) => x.path === '/api/programs/save'));
|
|
150
|
+
const pr = F.programs().find((x) => x.id === 'project-ascent');
|
|
151
|
+
ok('P the save resends the whole charter with its id: a new title never makes a new program', sv && sv.body.program.id === 'project-ascent' && sv.body.program.title === 'Ascent' && sv.body.ws === 'idpf'
|
|
152
|
+
&& sv.body.program.goal === pr.goal && sv.body.program.owner === pr.owner && sv.body.program.target === pr.target && sv.body.program.milestones.length === pr.milestones.length, JSON.stringify(sv));
|
|
153
|
+
ok('P no page error', G.errors.length === 0, G.errors.join(' | '));
|
|
154
|
+
await G.ctx.close();
|
|
155
|
+
|
|
156
|
+
/* ── a phone (RnAPhone) ── */
|
|
157
|
+
const S = await open({ w: 390, h: 844 });
|
|
158
|
+
await until(() => head(S.page).then((x) => (x && /Descope/.test(x.title) ? x : null)));
|
|
159
|
+
const rnH = await S.page.evaluate(() => document.querySelector('#czViewer [data-cz-vw-rn]').getBoundingClientRect().height);
|
|
160
|
+
ok('S on a phone the title press is a 44 px target', rnH >= 44, String(rnH));
|
|
161
|
+
await S.page.click('#czViewer [data-cz-vw-rn]');
|
|
162
|
+
const box = await S.page.evaluate(() => { const f = document.querySelector('#czViewer .cz-vw-ren'); const r = f.getBoundingClientRect(); return { w: r.width, h: r.height, vw: innerWidth }; });
|
|
163
|
+
ok('S on a phone the field fills the header, 44 px high', box.w > box.vw * 0.6 && box.h >= 44, JSON.stringify(box));
|
|
164
|
+
await S.ctx.close();
|
|
165
|
+
finish();
|
|
166
|
+
})();
|
|
@@ -87,8 +87,7 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
87
87
|
};
|
|
88
88
|
const V = '#czViewer:not([hidden])';
|
|
89
89
|
const tasks = async (p) => {
|
|
90
|
-
|
|
91
|
-
await p.click('.hm-card [data-hm-ov]');
|
|
90
|
+
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 + ' .hi-pgh [data-hi-addtask]', { timeout: 30000 }); })(p); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */ await p.click('#czViewer .hi-pgh [data-hi-addtask]'); /* the initiative's page (canvas HbC): its + drills into Tasks */
|
|
92
91
|
return until(() => p.evaluate((v) => !!document.querySelector(v + ' .tk-g .tk-row'), V), 30000);
|
|
93
92
|
};
|
|
94
93
|
const shot = async (p, name) => { if (!SHOTS) return; fs.mkdirSync(SHOTS, { recursive: true }); await sleep(250); await p.screenshot({ path: path.join(SHOTS, name) }); };
|
|
@@ -191,7 +190,7 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
191
190
|
/* the PM chose another grouping: it stays */
|
|
192
191
|
{
|
|
193
192
|
const E = await open({ layout: { by: 'mine', picked: true, names: ['Design'] } }), e = E.page;
|
|
194
|
-
await e.click('.
|
|
193
|
+
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 + ' .hi-pgh [data-hi-addtask]', { timeout: 30000 }); })(e); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */ await e.click('#czViewer .hi-pgh [data-hi-addtask]'); /* the initiative's page (canvas HbC): its + drills into Tasks */
|
|
195
194
|
ok('T1 a grouping the PM chose wins over the Epic default', await until(() => e.evaluate((v) => !!document.querySelector(v + ' .hi-tg') && !document.querySelector(v + ' .tk-row'), V)));
|
|
196
195
|
await E.ctx.close();
|
|
197
196
|
}
|