create-pmos 0.396.0 → 0.398.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/nine-stages.js +49 -20
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +103 -74
- package/workspace/briefing-premium-board-test.js +316 -154
- package/workspace/briefing-premium-calendar-2-test.js +135 -195
- package/workspace/briefing-premium-calendar-3-test.js +143 -413
- package/workspace/briefing-premium-calendar-test.js +86 -185
- package/workspace/briefing-premium-doc-edit-test.js +95 -83
- package/workspace/briefing-premium-initiative-test.js +166 -294
- package/workspace/briefing-premium-insights-test.js +351 -214
- package/workspace/briefing-premium-metrics-test.js +53 -118
- package/workspace/briefing-premium-products-test.js +40 -27
- package/workspace/briefing-premium-sources-test.js +91 -52
- package/workspace/briefing-premium-test.js +150 -633
- package/workspace/briefing-premium-work-test.js +88 -269
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/board-premium-facts.js +2 -1
- package/workspace/fixtures/board-premium-jira.js +28 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/initiative-premium-facts.js +2 -1
- package/workspace/fixtures/initiatives-api/list.json +30 -42
- package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
- package/workspace/fixtures/initiatives-api/sheet.json +10 -14
- package/workspace/fixtures/insights-premium-facts.js +11 -2
- package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +47 -0
- package/workspace/guide/index.md +2 -0
- package/workspace/guide/lifecycle.md +51 -0
- package/workspace/home-shot.js +38 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-premium.js +160 -3
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/engine/boards.js +15 -14
- package/workspace/lib/engine/nine-stages.js +49 -20
- package/workspace/lib/engine/signals/detectors.js +13 -11
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +126 -1
- package/workspace/lib/insights-records.js +101 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-board-premium.js +3 -2
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-initiatives.js +1 -1
- package/workspace/lib/routes-insights-premium.js +19 -3
- package/workspace/lib/routes-insights-records.js +129 -0
- package/workspace/lib/routes-notes.js +1 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/transcript-steps.js +123 -0
- package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
- package/workspace/lib/viewer-meeting.js +205 -0
- package/workspace/lib/viewer-report.js +89 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-agreed-viewer-shots.js +76 -0
- package/workspace/premium-board-actions-test.js +85 -73
- package/workspace/premium-briefing-depth-test.js +66 -53
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +35 -36
- package/workspace/premium-chat-context-test.js +22 -19
- package/workspace/premium-chat-goal-view-test.js +28 -26
- package/workspace/premium-chat-notes-test.js +29 -33
- package/workspace/premium-chat-report-tab-test.js +35 -25
- package/workspace/premium-chat-term-test.js +16 -14
- package/workspace/premium-chat-viewer-test.js +60 -53
- package/workspace/premium-core-doc-issue-test.js +50 -41
- package/workspace/premium-html-viewer-test.js +17 -18
- package/workspace/premium-phone-card-test.js +8 -2
- package/workspace/premium-phone-room-test.js +42 -31
- package/workspace/premium-report-read-test.js +115 -197
- package/workspace/premium-viewer-download-test.js +19 -22
- package/workspace/premium-viewer-flicker-test.js +11 -16
- package/workspace/premium-viewer-share-test.js +6 -9
- package/workspace/premium-viewer-test.js +41 -60
- package/workspace/premium-vw-backlog-test.js +53 -31
- package/workspace/premium-vw-cal-test.js +82 -123
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +12 -11
- package/workspace/premium-vw-item-test.js +50 -48
- package/workspace/premium-vw-jira-test.js +55 -26
- package/workspace/premium-vw-meet-test.js +118 -187
- package/workspace/premium-vw-notes-test.js +85 -107
- package/workspace/premium-vw-rec-test.js +72 -193
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +63 -51
- package/workspace/public/pm/bd-acts.js +305 -0
- package/workspace/public/pm/bd-span.js +224 -0
- package/workspace/public/pm/bd-stages.js +47 -0
- package/workspace/public/pm/c3-doc-sheet.js +1 -1
- package/workspace/public/pm/c3-md.js +3 -395
- package/workspace/public/pm/c3-phone-detail.js +1 -1
- package/workspace/public/pm/c3-phone-model.js +3 -68
- package/workspace/public/pm/chat-term.js +3 -3
- package/workspace/public/pm/cozy-board.css +640 -0
- package/workspace/public/pm/cozy-home.css +580 -0
- package/workspace/public/pm/cozy-home.js +172 -0
- package/workspace/public/pm/cozy-initiative.css +138 -0
- package/workspace/public/pm/cozy-insights.css +421 -0
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +65 -0
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-viewer.css +143 -0
- package/workspace/public/pm/cozy-viewer.js +144 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +254 -0
- package/workspace/public/pm/home-adddoc.js +48 -0
- package/workspace/public/pm/home-app.js +905 -0
- package/workspace/public/pm/home-around.js +515 -0
- package/workspace/public/pm/home-chat.js +459 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-more.js +249 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-work.js +519 -0
- package/workspace/public/pm/lifecycle-lens-model.js +45 -27
- package/workspace/public/pm/lifecycle-lens.js +22 -11
- package/workspace/public/pm/phone-moment.js +69 -0
- package/workspace/public/pm/pm-work-view.js +1 -1
- package/workspace/public/pm/premium-attach.js +4 -0
- package/workspace/public/pm/premium-board.js +544 -253
- package/workspace/public/pm/premium-brief.js +1 -1
- package/workspace/public/pm/premium-chart-tab.js +110 -62
- package/workspace/public/pm/premium-chat.js +17 -10
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +25 -21
- package/workspace/public/pm/premium-initiative-head.js +138 -0
- package/workspace/public/pm/premium-initiative.js +28 -4
- package/workspace/public/pm/premium-insights.js +950 -440
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-notes.js +1 -1
- package/workspace/public/pm/premium-report-frame.css +20 -0
- package/workspace/public/pm/premium-report-read.js +509 -480
- package/workspace/public/pm/premium-report-tab.js +87 -63
- package/workspace/public/pm/premium-shell.js +107 -124
- package/workspace/public/pm/premium-viewer.js +27 -1
- package/workspace/public/pm/premium-vw-cal.js +187 -48
- package/workspace/public/pm/premium-vw-doc.css +6 -0
- package/workspace/public/pm/premium-vw-doc.js +40 -2
- package/workspace/public/pm/premium-vw-file.js +2 -2
- package/workspace/public/pm/premium-vw-jira-model.js +22 -5
- package/workspace/public/pm/premium-vw-jira.css +11 -0
- package/workspace/public/pm/premium-vw-jira.js +11 -4
- package/workspace/public/pm/premium-vw-meet.js +6 -83
- package/workspace/public/pm/premium-vw-mtg.js +731 -0
- package/workspace/public/pm/premium-vw-notes.js +56 -69
- package/workspace/public/pm/premium-vw-open.js +35 -0
- package/workspace/public/pm/premium-vw-page.js +16 -0
- package/workspace/public/pm/premium-vw-rec.js +11 -215
- package/workspace/public/pm/premium-vw-slides.css +5 -0
- package/workspace/public/pm/premium-vw-slides.js +44 -8
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +57 -64
- package/workspace/public/premium-chat.html +7 -33
- package/workspace/public/premium-initiative.html +8 -41
- package/workspace/public/premium-insights.html +63 -62
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium-work.html +6 -72
- package/workspace/public/premium.html +21 -66
- package/workspace/public/vendor/nunito-var.woff2 +0 -0
- package/workspace/server.js +25 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/premium-agreed-viewer.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/third-party/README.md +1 -0
- package/workspace/public/pm/premium-work.js +0 -719
- package/workspace/public/pm/premium.js +0 -1133
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
/* briefing-premium-insights-test.js — the premium Insights page (initiative briefing-premium-insights; planning/prd/briefing-premium-insights-prd.md I1 to I11).
|
|
4
4
|
* Serves the real page from the real server. Most checks answer GET /api/insights-premium with the model lib/insights-premium.js builds from a fixture
|
|
5
|
-
* (fixtures/insights-premium-facts.js); the last blocks read a scratch repository's KR metric
|
|
6
|
-
*
|
|
5
|
+
* (fixtures/insights-premium-facts.js), and GET /api/board-metrics-premium with a stand-in; the last blocks read a scratch repository's KR metric
|
|
6
|
+
* records through the real routes.
|
|
7
|
+
* Re-pointed for premium-agreed-design (planning/prd/premium-agreed-design-prd.md N1, N2, G1, G2): the page is drawn to the Agreed design's frames
|
|
8
|
+
* (AgInsGoals, AgInsPeriod, AgInsNewGoal, AgInsNewDash, AgInsChart, AgInsOutcomes, AgInsVerdict, AgInsLibrary, AgInsPhone). The old charts card,
|
|
9
|
+
* the About footer, the goal dialog, the Library composer and the links to the Chat page are gone; a part the design does not draw opens the
|
|
10
|
+
* "Waiting for design" card in the Viewer. The intent of each old block is kept:
|
|
11
|
+
* N nav · B the bar · G goals, period, budgets, trends, filter, phone · D New dashboard, Edit chart, pin · O Outcomes and the verdict ·
|
|
12
|
+
* L Library and the reader · W New goal · I empty, failed, floors, fidelity · E the real routes
|
|
13
|
+
* Every wait polls the page; no fixed sleep stands in for a state, except the short settles after a press. */
|
|
7
14
|
const fs = require('fs');
|
|
8
15
|
const os = require('os');
|
|
9
16
|
const path = require('path');
|
|
10
17
|
const { spawn } = require('child_process');
|
|
11
18
|
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
-
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
13
|
-
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
14
19
|
const T = require('./test-run').configure({ name: 'briefing-premium-insights' });
|
|
15
20
|
const IP = require('./lib/insights-premium.js');
|
|
16
21
|
const F = require('./fixtures/insights-premium-facts.js');
|
|
@@ -31,8 +36,12 @@ const finish = async (code) => {
|
|
|
31
36
|
};
|
|
32
37
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
33
38
|
|
|
34
|
-
const
|
|
35
|
-
const
|
|
39
|
+
const BUDGETS = [{ id: 'docs', covers: 'documentation upkeep', cap: 0.2 }, { id: 'ops', covers: 'pipelines and deploys', cap: 0.1 }]; // as parseBudgets reads planning/okrs/health-budgets.md
|
|
40
|
+
const mk = (o) => IP.build(F.facts(Object.assign({ pinned: 'all', budgets: BUDGETS }, o))); // All goals pinned, so Goals opens on every goal
|
|
41
|
+
/* the Board's measures, as GET /api/board-metrics-premium answers them: two with a series, one to look at, one the engine has not derived */
|
|
42
|
+
const BMR = { ok: true, state: 'ready', model: { tiles: [
|
|
43
|
+
{ key: 'corrections', value: '2.6', ser: [3.1, 2.9, 2.6] }, { key: 'merges', value: '174', ser: [150, 160, 174] },
|
|
44
|
+
{ key: 'blocked', value: '2', ser: [1, 1, 2], look: true }, { key: 'idle', absent: 'Not read' }] } };
|
|
36
45
|
|
|
37
46
|
(async () => {
|
|
38
47
|
const exe = findBrowser();
|
|
@@ -43,221 +52,343 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
43
52
|
await T.waitForServer(BASE);
|
|
44
53
|
browser = await chromium.launch({ executablePath: exe });
|
|
45
54
|
|
|
46
|
-
const open = async ({ w =
|
|
55
|
+
const open = async ({ w = 1440, h = 900, theme = 'light', model = mk(), answers = null, bm = BMR, q = '' } = {}) => {
|
|
47
56
|
const ctx = await browser.newContext({ viewport: { width: w, height: h } });
|
|
48
57
|
const page = await ctx.newPage();
|
|
49
|
-
let current = model, calls = 0; const errors = [], posts = [];
|
|
58
|
+
let current = model, calls = 0; const errors = [], posts = [];
|
|
50
59
|
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
51
60
|
page.on('request', (rq) => { if (rq.method() !== 'GET') posts.push(rq.method() + ' ' + new URL(rq.url()).pathname); });
|
|
52
61
|
await page.route('**/api/insights-premium*', (r) => { calls++; if (answers) { const a = answers(calls); return r.fulfill({ status: a.status, contentType: 'application/json', body: JSON.stringify(a.body) }); } return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: current, as_of: 1 }) }); });
|
|
53
|
-
await page.route('**/api/
|
|
54
|
-
await page.goto(BASE + '/premium-insights.html?theme=' + theme);
|
|
55
|
-
const up = await until(() => page.evaluate(() => document.querySelectorAll('#
|
|
56
|
-
return { ctx, page, errors, posts, up, calls: () => calls, setModel: (m) => { current = m; }
|
|
62
|
+
await page.route('**/api/board-metrics-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(bm) }));
|
|
63
|
+
await page.goto(BASE + '/premium-insights.html?theme=' + theme + q);
|
|
64
|
+
const up = await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0 || /could not be read/.test(document.querySelector('#brief').textContent) || !!document.querySelector('#goalTbl .ins-empty')), 20000);
|
|
65
|
+
return { ctx, page, errors, posts, up, calls: () => calls, setModel: (m) => { current = m; } };
|
|
57
66
|
};
|
|
67
|
+
/* the Viewer card (pm/cozy-viewer.js): its title, and the feature its "Waiting for design" card names */
|
|
68
|
+
const vw = (pg) => pg.evaluate(() => { const v = document.querySelector('#czViewer'); if (!v || v.hidden) return null; const ph = v.querySelector('[data-cz-placeholder]'); return { title: (v.querySelector('.cz-vw-title') || {}).textContent || '', wait: ph ? ph.dataset.czPlaceholder : null, text: v.querySelector('.cz-vw-body').textContent }; });
|
|
69
|
+
const vwClose = async (pg) => { await pg.evaluate(() => window.czViewer && window.czViewer.close()); await until(() => pg.evaluate(() => { const v = document.querySelector('#czViewer'); return !v || v.hidden; })); };
|
|
58
70
|
|
|
59
71
|
const A = await open();
|
|
60
|
-
ok('0 the page draws the
|
|
72
|
+
ok('0 the page draws the goals', A.up);
|
|
61
73
|
if (!A.up) return finish(1);
|
|
62
|
-
const p = A.page
|
|
63
|
-
const txt = (s) =>
|
|
74
|
+
const p = A.page;
|
|
75
|
+
const txt = (s, pg = p) => pg.evaluate((q) => (document.querySelector(q) || {}).textContent || '', s);
|
|
64
76
|
|
|
65
|
-
/*
|
|
66
|
-
const
|
|
67
|
-
ok('
|
|
68
|
-
{ await p.click('#
|
|
77
|
+
/* N: the place menu, no page header, nothing old */
|
|
78
|
+
const nav = await p.evaluate(() => ({ fabs: document.querySelectorAll('#czFab').length, label: document.querySelector('#czFab').getAttribute('aria-label'), rail: document.querySelector('nav.rail') ? getComputedStyle(document.querySelector('nav.rail')).display : 'gone', name: document.querySelector('#prodName').textContent, boards: document.querySelectorAll('#prodMenu [data-board]').length }));
|
|
79
|
+
ok('N1 one floating place menu replaces the rail (gone from the page), it says you are in Insights, and the product picker names the board', nav.fabs === 1 && nav.label === 'Open the menu. You are in Insights' && nav.rail === 'gone' && nav.name === 'pmos' && nav.boards === 1, JSON.stringify(nav));
|
|
80
|
+
{ await p.click('#czFab'); const mn = await p.evaluate(() => ({ open: !document.querySelector('#czMenu').hidden, links: [...document.querySelectorAll('#czMenu a')].map((a) => a.textContent + '=' + a.getAttribute('href')), cur: (document.querySelector('#czMenu [aria-current="page"]') || {}).textContent })); await p.keyboard.press('Escape');
|
|
81
|
+
ok('N1 the menu opens Home, Board and Insights, marks Insights, and Escape closes it', mn.open && mn.links.join() === 'Home=/premium.html,Board=/premium-board.html,Insights=/premium-insights.html' && mn.cur === 'Insights' && await p.evaluate(() => document.querySelector('#czMenu').hidden), JSON.stringify(mn)); }
|
|
82
|
+
{ const hd = await p.evaluate(() => { const b = document.querySelector('#insBar').getBoundingClientRect(), m = document.querySelector('main.ins').getBoundingClientRect(); return { bar: Math.round(b.top), main: Math.round(m.top), tabs: [...document.querySelectorAll('.ins-tabs [role="tab"]')].map((t) => t.textContent.replace(/\s+\d+$/, '').trim() + ':' + t.getAttribute('aria-selected')).join(), h1: [...document.querySelectorAll('h1')].filter((h) => h.getBoundingClientRect().height > 2).length }; });
|
|
83
|
+
ok('N2 no page header: the panel starts at the top with one bar, and its tabs are Goals (open), Outcomes and Library', hd.main <= 20 && hd.bar - hd.main <= 24 && hd.h1 === 0 && hd.tabs === 'Goals:true,Outcomes:false,Library:false', JSON.stringify(hd)); }
|
|
84
|
+
ok('N1 nothing on the page links to the console or the Chat page (premium-agreed-design)', await p.evaluate(() => !document.querySelector('#toConsole, a[href*="console.html"], a[href*="premium-chat"]')));
|
|
85
|
+
ok('N2 the old parts are gone: no charts card, no About footer, no help button, no bell, no Library composer', await p.evaluate(() => !document.querySelector('#dashBody, #cDash, #foot, #helpB, #helpPop, .tb-bell, [data-tb="bell"], #repAsk, #repAskIn, #repFold, #listNew, #snap')));
|
|
69
86
|
ok('I1 the page is served at /premium-insights and /premium-insights.html', (await fetch(BASE + '/premium-insights')).status === 200 && (await fetch(BASE + '/premium-insights.html')).status === 200);
|
|
70
|
-
for (const [go, re] of [['
|
|
71
|
-
const r2 = await open(); await r2.page.locator(
|
|
72
|
-
ok(`
|
|
87
|
+
for (const [go, re] of [['Home', /\/premium\.html$/], ['Board', /\/premium-board\.html$/]]) {
|
|
88
|
+
const r2 = await open(); await r2.page.click('#czFab'); await r2.page.locator('#czMenu a', { hasText: go }).click();
|
|
89
|
+
ok(`N1 the menu's ${go} opens its premium page`, await until(() => re.test(r2.page.url()), 5000), r2.page.url());
|
|
73
90
|
await r2.ctx.close();
|
|
74
91
|
}
|
|
75
|
-
{ const r2 = await open(); const before = r2.page.url(); await r2.page.locator('.rail [data-go="rep"]').click(); await sleep(300); ok('I1 the Insights button opens nothing else: it is the page already', r2.page.url() === before); await r2.ctx.close(); }
|
|
76
92
|
|
|
77
|
-
/*
|
|
78
|
-
const ch = await p.evaluate(() => ({ n: document.querySelectorAll('#dashBody .mch').length, tiles: [...document.querySelectorAll('#dashBody .mch')].map((t) => ({ lab: t.querySelector('.mlab').firstChild.textContent, chip: t.querySelector('.mchip').textContent, val: t.querySelector('.mval').textContent, cap: t.querySelector('.mwk').textContent, tg: !!t.querySelector('.tg'), foot: t.querySelector('.mfoot').textContent, pts: t.querySelector('.ln2').getAttribute('d').split('L').length, off: t.classList.contains('off') })) }));
|
|
79
|
-
ok('I3 one chart for each KR metric with two or more readings, with its latest value, chip and target', ch.n === 3 && ch.tiles[0].lab === 'Partner activation' && ch.tiles[0].val === '28%' && ch.tiles[0].chip === 'Behind its line' && /target 50%/.test(ch.tiles[0].cap) && ch.tiles[0].tg && ch.tiles[1].chip === 'On its line' && !ch.tiles[1].off && ch.tiles[2].val === '9 days', JSON.stringify(ch.tiles[0]));
|
|
80
|
-
ok('I3 the line has exactly as many points as the record has readings (a gap is not filled)', ch.tiles[0].pts === 4 && ch.tiles[1].pts === 4);
|
|
81
|
-
ok('I3 the foot names the first and last date and says the dashed line is the target', /1 Jul/.test(ch.tiles[0].foot) && /15 Oct/.test(ch.tiles[0].foot) && /dashed line is the target/.test(ch.tiles[0].foot), ch.tiles[0].foot);
|
|
93
|
+
/* B: the bar is the design's: + with three items, a filter by objective, owner, type and lane, ⋯ with Sources, Export and About */
|
|
82
94
|
{
|
|
83
|
-
|
|
84
|
-
ok('
|
|
95
|
+
await p.click('#newB'); const nw = await p.evaluate(() => [...document.querySelectorAll('#newMenu [data-new]')].map((b) => b.dataset.new).join()); await p.keyboard.press('Escape');
|
|
96
|
+
ok('B1 + offers New goal, New dashboard and New chart', nw === 'goal,dash,chart', nw);
|
|
97
|
+
await p.click('#filtB'); const fl = await p.evaluate(() => ({ heads: [...document.querySelectorAll('#filtMenu .ins-mh')].map((h) => h.textContent).join(), owners: [...document.querySelectorAll('#filtMenu [data-fk="owner"]')].map((b) => b.dataset.fv).join(), lanes: [...document.querySelectorAll('#filtMenu [data-fk="lane"]')].map((b) => b.dataset.fv).join(), label: document.querySelector('#filtB').getAttribute('aria-label') }));
|
|
98
|
+
await p.keyboard.press('Escape');
|
|
99
|
+
ok('B1 the filter is by objective, owner, type and lane; owners and lanes come from the work that moves the goals', fl.heads === 'Objective,Owner,Type,Lane' && fl.owners === 'Dara,Lee,Mira' && fl.lanes === 'feature' && /owner/.test(fl.label) && /lane/.test(fl.label), JSON.stringify(fl));
|
|
100
|
+
await p.click('#moreB'); const mo = await p.evaluate(() => [...document.querySelectorAll('#moreMenu [data-more]')].map((b) => b.dataset.more + ':' + (b.disabled ? 'off' : 'on')).join()); await p.click('#moreMenu [data-more="about"]');
|
|
101
|
+
const ab = await until(() => vw(p));
|
|
102
|
+
ok('B1 ⋯ holds Sources, Export and About these numbers; About opens in the Viewer card', mo === 'sources:on,export:on,about:on' && ab && ab.title === 'About these numbers' && /straight line through the last four readings/.test(ab.text), JSON.stringify([mo, ab]));
|
|
103
|
+
await vwClose(p);
|
|
104
|
+
await p.click('#moreB'); await p.click('#moreMenu [data-more="sources"]'); const so = await until(() => vw(p));
|
|
105
|
+
ok('B1 Sources says what the page reads: the KR metric records, the budget registry and the page\'s own records', so && so.title === 'Sources' && /kr-metrics\.jsonl/.test(so.text) && /health-budgets\.md/.test(so.text) && /insights-records\.jsonl/.test(so.text), JSON.stringify(so));
|
|
106
|
+
await vwClose(p);
|
|
107
|
+
{ const R = await open(), q = R.page; await q.route('**/api/insights-records/export*', (r) => r.fulfill({ status: 200, contentType: 'text/csv', headers: { 'Content-Disposition': 'attachment; filename="insights-goals.csv"' }, body: 'id\n' }));
|
|
108
|
+
const [rq] = await Promise.all([q.waitForRequest(/\/api\/insights-records\/export/), (async () => { await q.click('#moreB'); await q.click('#moreMenu [data-more="export"]'); })()]);
|
|
109
|
+
const u = new URL(rq.url());
|
|
110
|
+
ok('B1 Export asks the export route for this workspace\'s goals as CSV', u.searchParams.get('ws') === 'w1' && u.searchParams.get('board') === 'w1', u.search); await R.ctx.close(); }
|
|
111
|
+
await vwClose(p);
|
|
112
|
+
await p.click('#findB'); await p.fill('#findIn', 'uptime'); await sleep(150);
|
|
113
|
+
const fd = await p.evaluate(() => [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => r.dataset.goal).join());
|
|
114
|
+
await p.click('#findX'); await sleep(100);
|
|
115
|
+
ok('B1 Find narrows the goals as you type, and its close shows every goal again', fd === 'krm-up' && (await p.evaluate(() => document.querySelectorAll('#goalTbl [data-goal]').length)) === 5, fd);
|
|
85
116
|
}
|
|
86
|
-
|
|
117
|
+
|
|
118
|
+
/* G1 the Goals table */
|
|
119
|
+
{ const g = await p.evaluate(() => { const r = [...document.querySelectorAll('#goalTbl .ins-grp')].map((x) => x.textContent.replace(/\s+/g, ' ').trim()), a = document.querySelector('#goalTbl [data-goal="krm-act"]'); return { groups: r, title: a.querySelector('.nm b').textContent, type: a.querySelector('.ins-type').textContent, sub: a.querySelector('.ins-sub').textContent, val: a.querySelector('.val b').textContent, of: a.querySelector('.val .note').textContent, today: !!a.querySelector('.ins-bar1 .today'), spark: !!a.querySelector('svg.ins-spark .pj'), pace: a.querySelector('.pace').textContent, moves: [...a.querySelectorAll('.ins-ini')].map((m) => m.querySelector('.n').textContent + ':' + m.querySelectorAll('.ins-trk i').length + ':' + [...m.querySelectorAll('.ins-trk i')].findIndex((i) => i.classList.contains('c')) + ':' + m.querySelectorAll('.ins-trk i.m').length + ':' + ((m.querySelector('.cz-pill') || {}).textContent || '')) }; });
|
|
120
|
+
ok('G1 goals are grouped by objective, then Health budgets, then Delivery trends', g.groups.length === 4 && /^Objective 1 · Growth Q4 2026/.test(g.groups[0]) && /3 of 3 behind/.test(g.groups[0]) && /^Objective 2 · Reliability/.test(g.groups[1]) && /^Health budgets always on, judged every week/.test(g.groups[2]) && /^Delivery trends/.test(g.groups[3]), JSON.stringify(g.groups));
|
|
121
|
+
ok('G1 a goal row has its type, direction and start, value of target with the today mark, the so-far line with its pace, and the pace said by its date', g.title === 'Partner activation' && g.type === 'Percentage' && g.sub === 'up is better · from 20% on Jul 1' && g.val === '28%' && g.of === 'of 50%' && g.today && g.spark && /^≈34% by Dec 31/.test(g.pace) && /16 pts short at this pace/.test(g.pace), JSON.stringify(g));
|
|
122
|
+
ok('G1 what moves it is on the lifecycle track with its milestones, and its pill is a delivery fact (ships soon, days over)', g.moves.join() === 'SSO for partners:8:5:2:Ships in 5 days,Self-serve onboarding v2:8:4:2:8 days over', JSON.stringify(g.moves));
|
|
123
|
+
const pills = await p.evaluate(() => Object.fromEntries([...document.querySelectorAll('#goalTbl .ins-ini')].map((m) => [m.querySelector('.n').textContent, (m.querySelector('.cz-pill') || {}).textContent || ''])));
|
|
124
|
+
ok('G1 an initiative with no owner says No owner; one that has shipped is not "days over" and never "in -N days"', pills['First call kit'] === 'No owner' && pills['Audit log export'] === 'On track' && !Object.values(pills).some((x) => /-\d/.test(x)), JSON.stringify(pills));
|
|
125
|
+
const leg = await p.evaluate(() => document.querySelector('#goalTbl .ins-th .ins-mvh').textContent.replace(/\s+/g, ' '));
|
|
126
|
+
ok('G1 the Moved by header carries the legend: skipped and milestone', /Skipped/.test(leg) && /Milestone/.test(leg), leg);
|
|
127
|
+
const nps = await p.evaluate(() => document.querySelector('#goalTbl [data-goal="krm-nps"]').textContent);
|
|
128
|
+
ok('G1 a goal with one reading draws no line and no pace: it says so', /One reading, no series yet/.test(nps) && /needs a second reading/.test(nps) && /No initiative anchors to it/.test(nps), nps);
|
|
129
|
+
const up = await txt('#goalTbl [data-goal="krm-up"] .pace');
|
|
130
|
+
ok('G1 a percentage pace never passes 100%, and a goal ahead of its time says so', /^≈100% by Dec 31/.test(up) && /ahead: 67% done, 39% of time gone/.test(up), up);
|
|
131
|
+
const ch = await txt('#goalTbl [data-goal="krm-churn"]');
|
|
132
|
+
ok('G1 a goal with no reading shows a dash and no number', /—/.test(ch) && /No reading yet/.test(ch) && /no reading yet/.test(ch) && !/\d+%\s*of/.test(ch.replace('of 2%', '')), ch);
|
|
133
|
+
}
|
|
134
|
+
/* G1 health budgets (D59): each budget of the registry, read as its share of the board's open initiatives against its cap */
|
|
87
135
|
{
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
await
|
|
92
|
-
|
|
136
|
+
const b = await p.evaluate(() => [...document.querySelectorAll('#goalTbl [data-budget]')].map((r) => ({ id: r.dataset.budget, type: r.querySelector('.ins-type').textContent, sub: r.querySelector('.ins-sub').textContent, val: r.querySelector('.val').textContent.replace(/\s+/g, ' ').trim(), pace: r.querySelector('.pace').textContent, cap: !!r.querySelector('.ins-bar1 .today'), moves: [...r.querySelectorAll('.ins-ini .n')].map((x) => x.textContent).join() })));
|
|
137
|
+
ok('G1 a health budget is a Stay within row, always on, with its cap, its share of the open initiatives and what moves it', b.length === 2 && b[0].id === 'docs' && b[0].type === 'Stay within' && b[0].sub === 'always on · cap 20% of a quarter' && b[0].val === '1 of 6 open initiatives' && /^Within its 20% cap/.test(b[0].pace) && /17% of open initiatives/.test(b[0].pace) && b[0].cap && b[0].moves === 'Docs search' && b[1].id === 'ops' && b[1].val === '0 of 6 open initiatives', JSON.stringify(b));
|
|
138
|
+
const R = await open({ model: mk({ budgets: [{ id: 'docs', covers: 'docs', cap: 0.1 }] }) });
|
|
139
|
+
ok('G1 a budget over its cap says so', /^Over its 10% cap/.test(await txt('#goalTbl [data-budget="docs"] .pace', R.page)));
|
|
140
|
+
await R.ctx.close();
|
|
141
|
+
await p.click('#goalTbl [data-budget="docs"] .nm');
|
|
142
|
+
const v = await until(() => vw(p));
|
|
143
|
+
ok('G1 a budget press opens its detail (what it covers, its cap, its reading), marked as waiting for design', v && v.title === 'docs' && v.wait === 'A health budget’s detail' && /documentation upkeep/.test(v.text) && /20% of a quarter/.test(v.text) && /1 of 6 open initiatives/.test(v.text), JSON.stringify(v));
|
|
144
|
+
await vwClose(p);
|
|
93
145
|
}
|
|
94
|
-
/*
|
|
95
|
-
const ns = await p.evaluate(() => [...document.querySelectorAll('#dashBody .ngl, #dashBody .dplist .nempty')].map((e) => e.textContent.replace(/\s+/g, ' ').trim()));
|
|
96
|
-
ok('I4 a measure with one reading or none is listed with the record\'s reason and not drawn', ns[0] === 'No series recorded · 2' && /Partner NPS.*Only one reading is recorded\. It is not drawn\./.test(ns[1]) && /Monthly churn.*No reading is recorded yet\./.test(ns[2]), JSON.stringify(ns));
|
|
97
|
-
/* I5 dashboards */
|
|
98
|
-
const tabs = await p.evaluate(() => [...document.querySelectorAll('#listRows [data-d]')].map((b) => b.querySelector('b').textContent + ':' + (b.parentElement.querySelector('[data-pin]') || { getAttribute: () => 'none' }).getAttribute('aria-pressed')));
|
|
99
|
-
ok('I5 dashboards: all measures first, then the saved ones, then the pillars the records name; the pinned one is marked, pillars cannot be pinned', tabs.join() === 'All measures:true,Weekly partner review:false,Growth:none,Reliability:none', tabs.join());
|
|
100
|
-
await p.click('#repBody [data-d="p:Reliability"]');
|
|
101
|
-
ok('I5 choosing a pillar shows only its charts and one count', (await p.evaluate(() => document.querySelectorAll('#dashBody .mch').length)) === 1 && /1 of 1.*on their line/.test(await txt('#dashBody .mhint')) && (await p.evaluate(() => document.querySelector('#dashBody .mprog').getAttribute('aria-valuenow'))) === '1');
|
|
102
|
-
await p.click('#repBody [data-d="all"]');
|
|
103
|
-
const hint = await txt('#dashBody .mhint');
|
|
104
|
-
ok('I5 the card counts the measures behind their line from the records: 1 of 3 on their line', /1 of 3 on their line\. 2 are behind it\./.test(hint.replace(/\s+/g, ' ')), hint);
|
|
105
|
-
ok('I5 the dock counts the same two', (await txt('#dN')) === '2' && /measures off their line/.test(await txt('#dLab')) && /First Time to first call/.test(await txt('#dNext')));
|
|
106
|
-
/* I6 */
|
|
107
|
-
const fd = await p.evaluate(() => [...document.querySelectorAll('.nfd li')].map((li) => li.className + ': ' + li.textContent.replace(/\s+/g, ' ').trim()));
|
|
108
|
-
ok('I6 the pinned card says what else stands out on it, with the reason and its numbers', fd.length === 2 && /^miss: Partner activation will miss its 50% target on 31 Dec at this pace\. It is at 28% and moving 0\.53 points a week/.test(fd[0]) && /^course: Partner uptime/.test(fd[1]) && /Also on this dashboard/.test(await txt('#dashBody .nfd .label')), JSON.stringify(fd));
|
|
109
|
-
ok('I6 no sentence gives a cause', !fd.some((x) => /forecast|because|caused|expected to/i.test(x)));
|
|
110
|
-
const hero = await p.evaluate(() => ({ eye: document.querySelector('#insEye').textContent, head: document.querySelector('#brief').textContent, why: document.querySelector('#insWhy').textContent, more: [...document.querySelectorAll('#insMore button')].map((b) => b.textContent), acts: [...document.querySelectorAll('#insAct button')].map((b) => b.textContent), note: document.querySelector('#insNote').textContent }));
|
|
111
|
-
ok('L1 the insight leads the page: the strongest finding, its reason, two more and the method', /2 of 3 behind their line · readings to 15 Oct/.test(hero.eye) && hero.head === 'Time to first call will miss its 3 days target on 31 Dec unless it turns.' && /Over its last 4 readings it went from 8 days to 9 days/.test(hero.why) && hero.more.length === 2 && /Partner activation will miss/.test(hero.more[0]) && hero.acts.join() === 'Ask PMOS why,See the chart' && /straight line through its last four readings/.test(hero.note), JSON.stringify(hero));
|
|
112
|
-
/* I7 dialog */
|
|
113
|
-
await p.click('#insAct [data-open]'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
|
|
114
|
-
const dl = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, eye: document.querySelector('#dEye').textContent, kv: [...document.querySelectorAll('#oMain .kv2')].map((k) => k.textContent.replace(/\s+/g, ' ')).join(' | '), path: document.querySelector('#oMain .dpath').textContent, btn: document.querySelectorAll('#oMain button').length, hold: document.querySelector('#holdWhy').textContent, sw: [...document.querySelectorAll('#oMain [role=switch]')].map((b) => b.querySelector('b').textContent + ':' + b.getAttribute('aria-checked')).join(), inert: ['.rail', 'main.stage', '#dock'].every((s) => document.querySelector(s).inert) }));
|
|
115
|
-
ok('I7 a finding opens the standard dialog: the record\'s numbers, its readings with dates, its path, and only the dashboard switch as a press', dl.title === 'Time to first call' && /real data/.test(dl.eye) && /Target3 days by 31 Dec/.test(dl.kv) && /15 Oct9 days/.test(dl.kv) && dl.path === 'planning/records/kr-metrics.jsonl' && dl.btn === 1 && dl.sw === 'Weekly partner review:true' && /Nothing here changes a record/.test(dl.hold) && dl.inert, JSON.stringify(dl));
|
|
116
|
-
ok('I7 Escape closes it and focus returns', (await p.keyboard.press('Escape'), await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')))));
|
|
117
|
-
await p.locator('#dashBody [data-open]').filter({ hasText: 'Details' }).first().click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(300);
|
|
118
|
-
ok('I6 the measure popup draws the chart in its detail panel, under its heading and lead line, as the mockup does', await p.evaluate(() => { const o = document.querySelector('#oMain'), d1 = o.querySelector('.d1'), t = o.querySelector('.pdchart .mtile, .pdchart svg, .pdchart [class*="tile"]'); return !!d1 && !!t && !!(d1.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING); }));
|
|
119
|
-
ok('I7 the Details link of a chart opens that chart\'s dialog', (await txt('#dTitle')) === 'Partner activation');
|
|
120
|
-
await p.keyboard.press('Escape'); await sleep(300);
|
|
121
|
-
/* the agent is the read-only one: a question goes to the briefing route and nothing else posts */
|
|
146
|
+
/* G1 a goal's detail and readings: a minimal form, marked as waiting for design; it adds a reading through the KR metric route */
|
|
122
147
|
{
|
|
123
|
-
const R = await open()
|
|
124
|
-
await
|
|
125
|
-
await
|
|
126
|
-
|
|
127
|
-
ok('
|
|
148
|
+
const R = await open(), q = R.page, sent = [];
|
|
149
|
+
await q.route('**/api/records/kr-metrics/reading', (r) => { sent.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
150
|
+
await q.click('#goalTbl [data-goal="krm-act"] .nm');
|
|
151
|
+
const v = await until(() => vw(q));
|
|
152
|
+
ok('G1 on All goals a goal press opens its detail and readings (not the old dialog), marked as waiting for design', v && v.title === 'Partner activation' && v.wait === 'A goal’s detail and readings' && (await q.evaluate(() => document.querySelectorAll('#czViewer .ins-rd li').length)) === 4 && await q.evaluate(() => !document.querySelector('#dlg')), JSON.stringify(v)); // re-pointed (insights fix): the page has no old dialog at all
|
|
153
|
+
await q.fill('#czViewer [data-rdf] [name="v"]', '31'); await q.click('#czViewer [data-rdf] button[type="submit"]'); await until(() => sent.length > 0, 4000);
|
|
154
|
+
ok('G1 Add a reading posts the date and the number to the KR metric reading route', sent.length === 1 && sent[0].rid === 'krm-act' && sent[0].value === 31 && sent[0].at === '2026-10-18' && sent[0].ws === 'w1', JSON.stringify(sent));
|
|
128
155
|
await R.ctx.close();
|
|
129
156
|
}
|
|
130
|
-
/*
|
|
131
|
-
await (async (pg, sel) => { if (await pg.locator('#listSeg').isHidden()) await pg.click('#listF'); await pg.click(sel); })(p, '#listSeg [data-f="rep"]'); await sleep(100);
|
|
132
|
-
const rp = await p.evaluate(() => ({ rows: [...document.querySelectorAll('#listRows [data-rpt]')].map((r) => r.querySelector('.dmn b').textContent + ' / ' + r.querySelector('.s').textContent), note: document.querySelector('#cRep .mhint').textContent, cap: document.querySelector('#repCap').textContent, setups: document.querySelectorAll('#listRows [data-setup]').length, dash: document.querySelectorAll('#listRows [data-d]').length }));
|
|
133
|
-
ok('I8 the Reports filter lists the set-up reports, then one row per report with its cycles counted (PM 2026-10-22)', rp.rows.join() === 'biweekly / 1 draft,monthly / 1 issued' && rp.setups === 1 && rp.dash === 0 && /Nothing is sent from here/.test(rp.note) && rp.cap === '7', JSON.stringify(rp));
|
|
134
|
-
await (async (pg, sel) => { if (await pg.locator('#listSeg').isHidden()) await pg.click('#listF'); await pg.click(sel); })(p, '#listSeg [data-f="all"]');
|
|
135
|
-
{ const R = await open(); await (async (pg, sel) => { if (await pg.locator('#listSeg').isHidden()) await pg.click('#listF'); await pg.click(sel); })(R.page, '#listSeg [data-f="rep"]'); await R.page.locator('#listRows [data-rpt]').first().click(); ok('I8 a report opens in the page\'s reader, not the console (premium-report-read R1)', await until(() => R.page.evaluate(() => document.querySelector('#dlg').classList.contains('rdrd') && document.querySelector('#dlg').classList.contains('on')), 5000) && /premium-insights\.html/.test(R.page.url()), R.page.url());
|
|
136
|
-
ok('I8 a draft report has Issue in the reader, so nothing sends you to the console to issue it', await until(() => R.page.evaluate(() => !!document.querySelector('#oMain [data-rr="issue"]')), 8000) && await R.page.evaluate(() => !document.querySelector('#repOpen') && !document.querySelector('#oMain a[href*="console.html"]')));
|
|
137
|
-
await R.ctx.close(); }
|
|
138
|
-
/* I9 labels */
|
|
139
|
-
ok('I9 no demo label, and the foot says what is left out', !(await p.evaluate(() => /demo/i.test(document.querySelector('main.stage').textContent))) && /Left out: any measure no record holds/.test(await txt('#foot')) && /Board measures card/.test(await txt('#foot')) && /Real data/.test(await txt('#snap')));
|
|
140
|
-
ok('I9 the page makes no write request on its own', A.posts.length === 0, A.posts.join());
|
|
141
|
-
/* I10 empty */
|
|
157
|
+
/* G1 the period (AgInsPeriod) */
|
|
142
158
|
{
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
159
|
+
const chip = await p.evaluate(() => ({ name: document.querySelector('#perName').textContent, sub: document.querySelector('#perSub').textContent }));
|
|
160
|
+
await p.click('#perChip'); const pm = await p.evaluate(() => ({ items: [...document.querySelectorAll('#perMenu [data-per]')].map((b) => b.dataset.per + ':' + b.getAttribute('aria-checked')).join(), lq: document.querySelector('#perMenu [data-per="lq"] small').textContent, note: document.querySelector('#perMenu .ins-mnote').textContent }));
|
|
161
|
+
await p.click('#perMenu [data-per="lq"]'); await sleep(150);
|
|
162
|
+
const lq = await p.evaluate(() => ({ chip: document.querySelector('#perName').textContent, rows: document.querySelectorAll('#goalTbl [data-goal]').length, n: document.querySelector('#nGoals').textContent, budgets: document.querySelectorAll('#goalTbl [data-budget]').length }));
|
|
163
|
+
ok('G1 the chip names the quarter, its dates and the day of it', chip.name === 'Q4 2026' && chip.sub === 'Oct 1 – Dec 31 · day 18 of 92', JSON.stringify(chip));
|
|
164
|
+
ok('G1 the period picker offers this quarter, last quarter (closed, with its count), this half, this year and custom, and says budgets always show', pm.items === 'q:true,lq:false,h:false,y:false,c:false' && pm.lq === 'Closed · 3 goals, none due in it' && /Health budgets have no end/.test(pm.note), JSON.stringify(pm));
|
|
165
|
+
ok('G1 last quarter keeps the goals whose time overlaps it, and the budgets', lq.chip === 'Q3 2026' && lq.rows === 3 && lq.n === '3' && lq.budgets === 2, JSON.stringify(lq));
|
|
166
|
+
await p.click('#perChip'); await p.click('#perMenu [data-per="q"]'); await sleep(100);
|
|
167
|
+
await p.click('#tabOutcomes'); const os1 = await txt('#perSub'); await p.click('#tabGoals'); const os2 = await txt('#perSub');
|
|
168
|
+
ok('G1 changing tab redraws the period chip: Outcomes says shipped or judged this quarter, Goals the day of it', os1 === 'shipped or judged this quarter' && /day 18 of 92/.test(os2), JSON.stringify([os1, os2]));
|
|
169
|
+
}
|
|
170
|
+
/* G1 the filter */
|
|
171
|
+
{
|
|
172
|
+
await p.click('#filtB'); await p.click('#filtMenu [data-fk="owner"][data-fv="Dara"]'); await p.keyboard.press('Escape'); await sleep(100);
|
|
173
|
+
const f = await p.evaluate(() => ({ rows: [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => r.dataset.goal).join(), dot: !document.querySelector('#filtDot').hidden }));
|
|
174
|
+
ok('G1 filtering by owner keeps the goals that owner\'s work moves, and the filter shows it is on', f.rows === 'krm-act,krm-up' && f.dot, JSON.stringify(f));
|
|
175
|
+
await p.click('#filtB'); await p.click('#filtMenu [data-fclr]'); await sleep(100);
|
|
176
|
+
ok('G1 Clear the filter shows every goal again', (await p.evaluate(() => document.querySelectorAll('#goalTbl [data-goal]').length)) === 5 && await p.evaluate(() => document.querySelector('#filtDot').hidden));
|
|
177
|
+
}
|
|
178
|
+
/* G1 Delivery trends: six compact tiles from the Board's measures, honest where a measure is not counted */
|
|
179
|
+
{
|
|
180
|
+
const t = await until(async () => { const x = await p.evaluate(() => [...document.querySelectorAll('#bmBody [data-tile]')].map((e) => e.dataset.tile + '=' + e.querySelector('.l').textContent + '=' + e.querySelector('.v').textContent + '=' + (e.querySelector('.s') ? e.querySelector('.s').textContent : e.querySelector('svg') ? 'line' : '') + (e.classList.contains('warn') ? '!' : ''))); return x.length === 6 && !x.some((y) => /=Reading=/.test(y)) ? x : null; }, 8000);
|
|
181
|
+
/* re-pointed (insights fix, AgInsGoals): every tile is a label, a value and its line, with no sub-text; a measure with no series has no line */
|
|
182
|
+
ok('G1 Delivery trends has six compact tiles in the design\'s order: the Board\'s measures, the late initiatives and the scope added this week', !!t && t.join('|') === 'blocked=Blocked tickets=2=line!|late=Late initiatives=1=line!|idle=Idle 30+ days=Not read=|scope=Scope added=0=line|merges=Merged a week=174=line|corrections=Corrections / 100 runs=2.6=line', JSON.stringify(t));
|
|
183
|
+
}
|
|
184
|
+
{
|
|
185
|
+
const R = await open(), q = R.page, sent = [];
|
|
186
|
+
await q.route(/\/api\/(board-metric-targets\/save|insights-records\/target)/, (r) => { sent.push([new URL(r.request().url()).pathname, JSON.parse(r.request().postData() || '{}')]); r.fulfill({ contentType: 'application/json', body: '{"ok":true,"targets":{}}' }); });
|
|
187
|
+
await q.click('#bmBody [data-tile="merges"]'); const v = await until(() => vw(q));
|
|
188
|
+
await q.fill('#czViewer [data-tgf] [name="tg"]', '150'); await q.click('#czViewer [data-tgf] button[type="submit"]'); await until(() => sent.length > 0, 4000);
|
|
189
|
+
ok('G1 a tile press opens its target, marked as waiting for design; a Board measure\'s target goes to the Board\'s target route', v && v.title === 'Merged a week' && v.wait === 'Setting a Delivery trends target' && sent[0][0] === '/api/board-metric-targets/save' && sent[0][1].key === 'merges' && sent[0][1].target === 150, JSON.stringify([v, sent]));
|
|
190
|
+
await vwClose(q); await q.click('#bmBody [data-tile="late"]'); await until(() => vw(q));
|
|
191
|
+
await q.fill('#czViewer [data-tgf] [name="tg"]', '0'); await q.click('#czViewer [data-tgf] button[type="submit"]'); await until(() => sent.length > 1, 4000);
|
|
192
|
+
ok('G1 the Late initiatives target is kept in the page\'s own records', sent[1] && sent[1][0] === '/api/insights-records/target' && sent[1][1].key === 'late' && sent[1][1].target === 0, JSON.stringify(sent));
|
|
146
193
|
await R.ctx.close();
|
|
147
|
-
const R2 = await open({ model: mk({ reportsOk: false, reports: [], missing: ['reports'] }) });
|
|
148
|
-
ok('I10 reports that could not be read are said to be unread, not empty', await R2.page.evaluate(() => /report files could not be read/.test(document.querySelector('#repBody').textContent) && /not read: reports/.test(document.querySelector('#snap').textContent)));
|
|
149
|
-
await R2.ctx.close();
|
|
150
194
|
}
|
|
151
|
-
/* I2 failed read */
|
|
152
195
|
{
|
|
153
|
-
const
|
|
154
|
-
await
|
|
155
|
-
|
|
156
|
-
ok('
|
|
157
|
-
await
|
|
196
|
+
const R = await open({ model: mk({ ins: { charts: {}, verdicts: {}, targets: { late: 0 } }, initiatives: F.INITIATIVES.map((r, i) => Object.assign({}, r, i < 2 ? { start: '2026-10-15' } : {})) }) });
|
|
197
|
+
const t = await until(async () => { const x = await R.page.evaluate(() => ['late', 'scope'].map((k) => { const e = document.querySelector(`#bmBody [data-tile="${k}"]`); return e && e.querySelector('.v').textContent + ':' + (e.getAttribute('aria-label') || '').replace(/^[^,]+, [^,]+, /, '') + ':' + e.classList.contains('warn'); })); return x[0] ? x : null; });
|
|
198
|
+
/* re-pointed (insights fix): the target is said in the tile's label and title, not as a line under the value */
|
|
199
|
+
ok('G1 Late shows its target and is marked when over it; Scope added counts the initiatives that start this week, with its line', t && t[0] === '1:late today, target 0:true' && /^2:/.test(t[1]) && await R.page.evaluate(() => !!document.querySelector('#bmBody [data-tile="scope"] svg')), JSON.stringify(t));
|
|
200
|
+
await R.ctx.close();
|
|
201
|
+
}
|
|
202
|
+
{
|
|
203
|
+
const R = await open({ bm: { ok: false, state: 'error', error: 'boom' } });
|
|
204
|
+
const t = await until(async () => { const x = await R.page.evaluate(() => [...document.querySelectorAll('#bmBody [data-tile]')].map((e) => e.querySelector('.v').textContent)); return x.length === 6 && x[0] !== 'Reading' ? x : null; }, 8000);
|
|
205
|
+
ok('G1 when the Board\'s measures cannot be read, their tiles say Not read and draw no number', !!t && t.join() === 'Not read,1,Not read,0,Not read,Not read', JSON.stringify(t));
|
|
206
|
+
await R.ctx.close();
|
|
158
207
|
}
|
|
159
208
|
|
|
160
|
-
/*
|
|
209
|
+
/* L1 the strip */
|
|
210
|
+
{ const hero = await p.evaluate(() => ({ eye: document.querySelector('#insEye').textContent, head: document.querySelector('#brief').textContent, why: document.querySelector('#insWhy').textContent, ask: document.querySelector('#askWhy').getAttribute('href') }));
|
|
211
|
+
ok('L1 the strip leads Goals: the days gone, the strongest finding and its reason; Ask why opens Home with the question', hero.eye === '18 of 92 days gone in Q4.' && hero.head === 'Time to first call will miss its 3 days target on 31 Dec unless it turns.' && /Over its last 4 readings it went from 8 days to 9 days/.test(hero.why) && /^\/premium\.html\?ws=w1&ask=insights&q=Why/.test(hero.ask), JSON.stringify(hero));
|
|
212
|
+
ok('I9 no demo label, and the page makes no write request on its own', !(await p.evaluate(() => /demo/i.test(document.querySelector('main.stage').textContent))) && A.posts.length === 0, A.posts.join());
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* D: New dashboard (AgInsNewDash), describe, the saved view, Edit chart (AgInsChart) and the pin */
|
|
161
216
|
{
|
|
162
217
|
const R = await open(), q = R.page, sent = [];
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
218
|
+
const answer = (u, b) => (/describe$/.test(u) ? { ok: true, name: 'Partner first week', question: 'Are partners getting value?', goals: ['krm-act', 'krm-up'], range: '8w', said: ['Partner activation', 'Partner uptime'] }
|
|
219
|
+
: /dashboard$/.test(u) ? { ok: true, id: 'pd-9', dashboard: { id: 'pd-9' }, pinned: b.pin ? 'pd-9' : null } : { ok: true });
|
|
220
|
+
await q.route(/\/api\/(insights-records|premium-dashboards)\//, (r) => { const u = new URL(r.request().url()).pathname, b = JSON.parse(r.request().postData() || '{}'); sent.push([u, b]); r.fulfill({ contentType: 'application/json', body: JSON.stringify(answer(u, b)) }); });
|
|
166
221
|
const last = () => sent[sent.length - 1] || [null, {}];
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
await
|
|
174
|
-
const
|
|
175
|
-
ok('
|
|
176
|
-
await q.
|
|
177
|
-
await q.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
await
|
|
183
|
-
|
|
184
|
-
await
|
|
185
|
-
const
|
|
186
|
-
ok('
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
await q.click('#
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
await
|
|
195
|
-
|
|
196
|
-
ok('
|
|
197
|
-
await q.fill('#
|
|
198
|
-
ok('
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
await q.click('#
|
|
204
|
-
ok('
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
await q.click('#
|
|
214
|
-
|
|
215
|
-
ok('
|
|
216
|
-
ok('
|
|
222
|
+
await q.click('#newB'); await q.click('#newMenu [data-new="dash"]'); await sleep(150);
|
|
223
|
+
const s0 = await q.evaluate(() => ({ side: !document.querySelector('#side').hidden, kind: document.querySelector('#side').dataset.kind, eye: document.querySelector('#sideEye').textContent, desc: document.querySelector('#ndAsk button[type="submit"]').disabled, ns: document.querySelectorAll('#sideBody .ins-ns').length }));
|
|
224
|
+
ok('D1 New dashboard opens beside Goals, with the describe box working and nothing marked "Not saved yet"', s0.side && s0.kind === 'dash' && /New dashboard/.test(s0.eye) && !s0.desc && s0.ns === 0, JSON.stringify(s0));
|
|
225
|
+
await q.fill('#ndAskIn', 'Are partners getting value? activation and uptime over 8 weeks'); await q.press('#ndAskIn', 'Enter'); await sleep(300);
|
|
226
|
+
const d1 = await q.evaluate(() => ({ name: document.querySelector('#ndName').value, qn: document.querySelector('#ndQ').value, list: [...document.querySelectorAll('#ndList [data-pk]')].map((r) => r.dataset.pk).join(), range: (document.querySelector('#sideBody [data-seg="Range"] [aria-checked="true"]') || {}).textContent, msg: document.querySelector('#ndMsg').textContent })); // re-pointed (insights fix): the describe message is under the describe box
|
|
227
|
+
ok('D1 Describe asks the describe route and fills the name, the question, the goals and the range, saying which words matched', last()[0] === '/api/insights-records/describe' && last()[1].text === 'Are partners getting value? activation and uptime over 8 weeks' && d1.name === 'Partner first week' && d1.qn === 'Are partners getting value?' && d1.list === 'krm-act,krm-up' && d1.range === '8w' && /Partner activation, Partner uptime/.test(d1.msg), JSON.stringify(d1));
|
|
228
|
+
await q.click('#goalTbl [data-goal="krm-ttfc"] .nm');
|
|
229
|
+
const s1 = await q.evaluate(() => ({ title: document.querySelector('#sideTitle').textContent, sel: [...document.querySelectorAll('#goalTbl [aria-selected="true"]')].map((r) => r.dataset.goal).join(), list: [...document.querySelectorAll('#ndList [data-pk]')].map((r) => r.dataset.pk + ':' + r.querySelectorAll('[data-v]').length + ':' + r.draggable).join(), forms: [...document.querySelectorAll('#ndList [data-pk]')[0].querySelectorAll('[data-v]')].map((b) => b.dataset.v).join(), pin: document.querySelector('#ndPin').getAttribute('aria-checked') }));
|
|
230
|
+
ok('D1 goals are picked in the table; each picked chart has its form (Line, Bars, Number, Meter) and can be dragged; the name is the title', s1.title === 'Partner first week' && s1.sel === 'krm-act,krm-ttfc,krm-up' && s1.list === 'krm-act:4:true,krm-up:4:true,krm-ttfc:4:true' && s1.forms === 'Line,Bars,Number,Meter' && s1.pin === 'false', JSON.stringify(s1));
|
|
231
|
+
await q.focus('#ndList [data-pk="krm-ttfc"]'); await q.keyboard.press('Alt+ArrowUp'); await sleep(100);
|
|
232
|
+
const ord = await q.evaluate(() => [...document.querySelectorAll('#ndList [data-pk]')].map((r) => r.dataset.pk).join());
|
|
233
|
+
await q.click('#goalTbl [data-goal="krm-act"] .nm'); // re-pointed (insights fix, AgInsNewDash has no ×): pressing a picked row again takes its chart off
|
|
234
|
+
await q.click('#ndAdd'); await q.selectOption('#ndAddSel', 'krm-churn'); await sleep(100);
|
|
235
|
+
const ord2 = await q.evaluate(() => [...document.querySelectorAll('#ndList [data-pk]')].map((r) => r.dataset.pk).join());
|
|
236
|
+
ok('D1 the order moves (Alt+Arrow, as a drag does), a chart comes off, and a goal not in view can be added', ord === 'krm-act,krm-ttfc,krm-up' && ord2 === 'krm-ttfc,krm-up,krm-churn', JSON.stringify([ord, ord2]));
|
|
237
|
+
await q.click('#ndList [data-pk="krm-up"] [data-v="Bars"]'); await q.click('#sideBody [data-seg="Range"] [data-v="26w"]');
|
|
238
|
+
await q.fill('#ndQ', ''); await q.click('#sideGo'); const need = await txt('#sideMsg', q); await q.fill('#ndQ', 'Are partners getting value?');
|
|
239
|
+
await q.click('#ndPin'); sent.length = 0; await q.click('#sideGo'); await until(() => q.evaluate(() => document.querySelector('#side').hidden), 5000);
|
|
240
|
+
const sv = sent.find((x) => /dashboard$/.test(x[0]));
|
|
241
|
+
ok('D1 the question is required; Save posts the name, the question, each goal with its form in order, the range and the pin, in one press', /question it answers/.test(need) && !!sv && sv[1].name === 'Partner first week' && sv[1].purpose === 'Are partners getting value?' && JSON.stringify(sv[1].charts) === JSON.stringify([{ goal: 'krm-ttfc', form: 'Line' }, { goal: 'krm-up', form: 'Bars' }, { goal: 'krm-churn', form: 'Line' }]) && sv[1].range === '26w' && sv[1].pin === true && sv[1].board === 'w1' && sv[1].ws === 'w1', JSON.stringify([need, sv]));
|
|
242
|
+
sent.length = 0;
|
|
243
|
+
/* the saved view and Edit chart */
|
|
244
|
+
R.setModel(mk({ ins: { charts: { w1: { 'pd-1': { 'krm-ttfc': { form: 'Bars', range: '8w', compare: '', target: false, forecast: true, note: 'Outage on Oct 1' } } } }, verdicts: {}, targets: {} } })); await q.reload(); await until(() => q.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0));
|
|
245
|
+
await q.click('#viewChip'); await q.click('#viewMenu [data-view="pd-1"]'); await sleep(150);
|
|
246
|
+
const svw = await q.evaluate(() => ({ name: document.querySelector('#viewName').textContent, rows: [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => r.dataset.goal).join(), budgets: document.querySelectorAll('#goalTbl [data-budget]').length }));
|
|
247
|
+
ok('D2 View opens a saved dashboard on Goals: its goals in its order, and no budgets (a dashboard holds goals)', svw.name === 'Weekly partner review' && svw.rows === 'krm-act,krm-ttfc' && svw.budgets === 0, JSON.stringify(svw));
|
|
248
|
+
await q.click('#goalTbl [data-goal="krm-ttfc"] .nm'); await sleep(150);
|
|
249
|
+
const ce = await q.evaluate(() => ({ kind: document.querySelector('#side').dataset.kind, eye: document.querySelector('#sideEye').textContent, title: document.querySelector('#sideTitle').textContent, goal: document.querySelector('#chGoal').value, prev: !!document.querySelector('#chPrev svg.ins-ch2'), form: (document.querySelector('#sideBody [data-seg="Form"] [aria-checked="true"]') || {}).textContent, range: (document.querySelector('#sideBody [data-seg="Range"] [aria-checked="true"]') || {}).textContent, togs: [...document.querySelectorAll('#sideBody .ins-tog')].map((b) => b.id + ':' + b.getAttribute('aria-checked')).join(), ns: document.querySelectorAll('#sideBody .ins-ns').length, cmp: document.querySelector('#chCmp').value, note: document.querySelector('#chNote').value }));
|
|
250
|
+
ok('D2 a goal press on a saved dashboard opens Edit chart with that chart\'s saved form, range, comparison, target line, forecast and note', ce.kind === 'chart' && ce.eye === 'Chart on Weekly partner review' && ce.title === 'Time to first call' && ce.goal === 'krm-ttfc' && ce.prev && ce.form === 'Bars' && ce.range === '8w' && ce.togs === 'chTgt:false,chFc:true' && ce.ns === 0 && ce.cmp === '' && ce.note === 'Outage on Oct 1', JSON.stringify(ce));
|
|
251
|
+
ok('D2 the preview is drawn in the chart\'s form', await q.evaluate(() => document.querySelectorAll('#chPrev svg.ins-ch2 rect').length > 0));
|
|
252
|
+
await q.click('#sideBody [data-seg="Form"] [data-v="Line"]'); await q.fill('#chNote', 'Better after the kit'); await q.click('#sideGo'); await until(() => q.evaluate(() => document.querySelector('#side').hidden), 5000);
|
|
253
|
+
ok('D2 Save chart posts every setting of the chart on its dashboard', last()[0] === '/api/insights-records/chart' && last()[1].dash === 'pd-1' && last()[1].goal === 'krm-ttfc' && last()[1].form === 'Line' && last()[1].range === '8w' && last()[1].compare === '' && last()[1].target === false && last()[1].forecast === true && last()[1].note === 'Better after the kit' && last()[1].add === false, JSON.stringify(last()));
|
|
254
|
+
await q.click('#goalTbl [data-goal="krm-act"] .nm'); await sleep(100); await q.selectOption('#chGoal', 'krm-up'); await q.click('#sideGo'); await until(() => q.evaluate(() => document.querySelector('#side').hidden), 5000);
|
|
255
|
+
ok('D2 Save chart with a goal not on the dashboard adds it there', last()[0] === '/api/insights-records/chart' && last()[1].goal === 'krm-up' && last()[1].add === true, JSON.stringify(last()));
|
|
256
|
+
await q.click('#goalTbl [data-goal="krm-act"] .nm'); await sleep(100); await q.click('#chMore');
|
|
257
|
+
const cm = await q.evaluate(() => [...document.querySelectorAll('#chMenu button')].map((b) => b.textContent.replace(/\s+/g, ' ') + ':' + (b.disabled ? 'off' : 'on')).join('|'));
|
|
258
|
+
await q.click('#chRemove'); await until(() => q.evaluate(() => document.querySelector('#side').hidden), 5000);
|
|
259
|
+
ok('D2 ⋯ on a chart: Remove from dashboard saves it without that goal (a dashboard holds one chart for each goal, so Duplicate is off)', /^DuplicateA dashboard holds one chart for each goal:off\|Remove from dashboard/.test(cm) && last()[0] === '/api/premium-dashboards/save' && JSON.stringify(last()[1].charts) === JSON.stringify(['krm-ttfc', 'krm-gone']), JSON.stringify([cm, last()]));
|
|
260
|
+
ok('D7 every press went to an Insights records route or the dashboard save route', R.posts.every((x) => /^POST \/api\/(insights-records\/(describe|dashboard|chart)|premium-dashboards\/save)$/.test(x)), R.posts.join());
|
|
261
|
+
await R.ctx.close();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* O: Outcomes (AgInsOutcomes) and the verdict (AgInsVerdict) */
|
|
265
|
+
{
|
|
266
|
+
const R = await open(), q = R.page, sent = [];
|
|
267
|
+
await q.route('**/api/insights-records/verdict', (r) => { sent.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
268
|
+
await q.click('#tabOutcomes');
|
|
269
|
+
const o = await q.evaluate(() => ({ cols: [...document.querySelectorAll('#outTbl .ins-th [role="columnheader"]')].map((c) => c.textContent).join('|'), groups: [...document.querySelectorAll('#outTbl .ins-grp')].map((g) => g.textContent.replace(/\s+/g, ' ').trim()), rows: [...document.querySelectorAll('#outTbl [data-ini]')].map((r) => r.dataset.ini), strip: document.querySelector('#outText').textContent, sso: document.querySelector('#outTbl [data-ini="sso-partners"]').textContent.replace(/\s+/g, ' '), audit: document.querySelector('#outTbl [data-ini="audit-log-export"]').textContent.replace(/\s+/g, ' '), decide: document.querySelectorAll('#outTbl [data-verdict]').length, decideTxt: (document.querySelector('#outTbl [data-verdict]') || {}).textContent || '', view: document.querySelector('#viewChip').offsetParent === null }));
|
|
270
|
+
ok('O1 Outcomes has the design\'s columns: shipped initiative, what it promised and what happened, guardrail and overlap, window, verdict', o.cols === 'Shipped initiative|What it promised · and what happened so far|Guardrail and overlap|Window|Verdict', o.cols);
|
|
271
|
+
ok('O1 the shipped work is grouped by what it needs: a verdict, still in its window; the strip counts the promises', o.groups.join() === 'Needs your verdict 1,In their window 2' && o.rows.join() === 'refund-reason-codes,sso-partners,audit-log-export' && /^Refund reason codes needs your verdict by Dec 31\./.test(o.strip) && /Of 3 promises this quarter, 0 are met, 2 are partly met and 2 are still in their window\./.test(o.strip) && o.decide === 1 && o.view, JSON.stringify(o));
|
|
272
|
+
ok('O1 a row says what its goal promised and what happened, the work it shares the goal with, and its window from the ship date to the promise\'s date', /Partner activation \+30 pts by Dec 31/.test(o.sso) && /\+8 pts of \+30 pts/.test(o.sso) && /Shares partner activation/.test(o.sso) && /with Self-serve onboarding v2/.test(o.sso) && /No guardrail set\./.test(o.sso) && /Judged Dec 31/.test(o.sso) && /Judged Dec 31/.test(o.audit) && /Opens Dec 31/.test(o.audit) && /Decide · due Dec 31/.test(o.decideTxt), JSON.stringify([o.sso, o.audit, o.decideTxt])); // re-pointed (insights fix): the design's window words
|
|
217
273
|
await R.ctx.close();
|
|
274
|
+
const R2 = await open({ model: mk({ goalMeta: { 'krm-up': { guardrail: 'Partner activation must not get worse' } } }) });
|
|
275
|
+
await R2.page.click('#tabOutcomes');
|
|
276
|
+
ok('O1 a guardrail is read from the readings: since Audit log export shipped, partner activation held or got worse', /Partner activation worse by 2 pts/.test(await txt('#outTbl [data-ini="audit-log-export"] .ins-guard', R2.page)), await txt('#outTbl [data-ini="audit-log-export"] .ins-guard', R2.page));
|
|
277
|
+
await R2.ctx.close();
|
|
278
|
+
const R3 = await open(), q3 = R3.page;
|
|
279
|
+
await q3.route('**/api/insights-records/verdict', (r) => { sent.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
280
|
+
await q3.click('#tabOutcomes'); await q3.click('#outTbl [data-verdict]'); await sleep(150);
|
|
281
|
+
const v = await q3.evaluate(() => { const go = document.querySelector('#sideGo'); return { kind: document.querySelector('#side').dataset.kind, title: document.querySelector('#sideTitle').textContent, opts: [...document.querySelectorAll('#sideBody .ins-opt')].map((b) => b.dataset.vd + ':' + b.getAttribute('aria-checked')).join(), go: go.textContent, off: go.disabled, note: document.querySelector('#sideNote').textContent, ev: document.querySelector('#sideBody').textContent, home: document.querySelector('#sideAct a').getAttribute('href'), board: [...document.querySelectorAll('#sideTools a')].map((a) => a.getAttribute('href')).join(' ') }; });
|
|
282
|
+
ok('O2 the verdict offers Keep, Iterate (the default) or Stop, with its evidence said from the readings, and Home and the Board one press away', v.kind === 'verdict' && v.title === 'Refund reason codes' && v.opts === 'Keep:false,Iterate:true,Stop:false' && /Evidence 0/.test(v.ev) && /No reading of Monthly churn is recorded/.test(v.ev) && /^\/premium\.html\?ws=w1&ask=verdict&q=/.test(v.home) && /premium-board\.html\?ws=w1&focus=refund-reason-codes/.test(v.board), JSON.stringify(v));
|
|
283
|
+
const u0 = q3.url(); await q3.click('#sideBody [data-vd="Keep"]'); await q3.click('#sideGo'); const need = await txt('#sideMsg', q3);
|
|
284
|
+
await q3.fill('#vdLearn', 'Codes work.'); await q3.click('#sideGo'); await until(() => sent.length > 0, 4000); await sleep(200);
|
|
285
|
+
ok('O2 Record verdict needs a learning, then records Keep with it on Insights and stays on the page (it never sends you to Home)', v.go === 'Record verdict' && !v.off && v.note === 'Records the evaluation. Nothing is sent.' && /what you learned/.test(need) && sent.length === 1 && sent[0].ini === 'refund-reason-codes' && sent[0].verdict === 'Keep' && sent[0].learned === 'Codes work.' && sent[0].goal === 'krm-churn' && sent[0].board === 'w1' && q3.url() === u0 && R3.posts.every((x) => x === 'POST /api/insights-records/verdict'), JSON.stringify([need, sent, R3.posts]));
|
|
286
|
+
await R3.ctx.close();
|
|
287
|
+
const R4 = await open({ model: mk({ ins: { charts: {}, verdicts: { w1: { 'refund-reason-codes': { verdict: 'Keep', learned: 'Codes work.', at: '2026-10-18T09:00:00Z' } } }, targets: {} } }) });
|
|
288
|
+
await R4.page.click('#tabOutcomes');
|
|
289
|
+
const dc = await R4.page.evaluate(() => ({ groups: [...document.querySelectorAll('#outTbl .ins-grp')].map((g) => g.textContent.replace(/\s+/g, ' ').trim()).join(), row: document.querySelector('#outTbl [data-ini="refund-reason-codes"]').textContent.replace(/\s+/g, ' ') }));
|
|
290
|
+
ok('O2 a recorded verdict moves the row to Decided, with Kept and what was learned, and its window says judged', /Decided this quarter 1/.test(dc.groups) && /Kept/.test(dc.row) && /Codes work\./.test(dc.row) && /Judged/.test(dc.row), JSON.stringify(dc));
|
|
291
|
+
await R4.ctx.close();
|
|
218
292
|
}
|
|
219
293
|
|
|
220
|
-
/*
|
|
294
|
+
/* L: Library (AgInsLibrary) and the report reader */
|
|
221
295
|
{
|
|
222
|
-
const R = await open(
|
|
223
|
-
await q.
|
|
224
|
-
const
|
|
225
|
-
ok('
|
|
226
|
-
ok('
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
ok('
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
await q.click('#
|
|
233
|
-
|
|
234
|
-
await q.
|
|
235
|
-
ok('
|
|
236
|
-
|
|
237
|
-
await q.click('#
|
|
238
|
-
|
|
239
|
-
ok('
|
|
296
|
+
const R = await open(), q = R.page;
|
|
297
|
+
await q.click('#tabLibrary');
|
|
298
|
+
const lb = await q.evaluate(() => ({ seg: [...document.querySelectorAll('#listSeg [data-f]')].map((b) => b.textContent.replace(/\s+/g, ' ').trim()).join(), sug: document.querySelector('#sugB').textContent, note: document.querySelector('#pLibrary .ins-lnote').textContent, heads: [...document.querySelectorAll('#repAsks .ins-lhead span')].map((s) => s.textContent).join('|'), rpt: [...document.querySelectorAll('#listRows [data-rpt]')].map((r) => r.dataset.rpt + '|' + r.querySelector('.ins-when').textContent + '|' + r.querySelector('.ins-dots + small').textContent + '|' + r.querySelector('.ins-from').textContent).join(' / '), setups: document.querySelectorAll('#listRows [data-setup]').length, asks: document.querySelectorAll('#listRows [data-ask]').length, cards: [...document.querySelectorAll('#listRows .ins-dcard')].map((c) => c.dataset.d + (c.querySelector('.ins-pinned') ? '*' : '')).join(), cap: document.querySelector('#repCap').textContent }));
|
|
299
|
+
ok('L1 Library: the All, Reports and Dashboards chips, the suggestions chip, and the note that reports are made in Home', lb.seg === 'All 9,Reports 5,Dashboards 4' && lb.sug === '1 suggestion from your work' && /Reports are made in Home/.test(lb.note) && lb.cap === '9', JSON.stringify(lb));
|
|
300
|
+
ok('L1 the reports table has the design\'s columns; a draft says "Draft ready for" its date; no schedule and no source are said, not made up', lb.heads === '|Report · audience|When|Issued · next|Built from|' && /Draft ready for Oct 14/.test(lb.rpt) && /No schedule/.test(lb.rpt) && /Not recorded/.test(lb.rpt) && lb.setups === 1 && lb.asks === 2, JSON.stringify(lb.rpt));
|
|
301
|
+
ok('L1 dashboards are cards; only the pinned one carries the pin', lb.cards === 'all*,pd-1,p:Growth,p:Reliability', lb.cards);
|
|
302
|
+
await q.click('#listSeg [data-f="dash"]'); const onlyD = await q.evaluate(() => ({ r: document.querySelectorAll('#listRows [data-rpt], #listRows [data-setup], #listRows [data-ask]').length, d: document.querySelectorAll('#listRows .ins-dcard').length })); await q.click('#listSeg [data-f="all"]');
|
|
303
|
+
ok('L1 the Dashboards chip lists only the dashboards', onlyD.r === 0 && onlyD.d === 4, JSON.stringify(onlyD));
|
|
304
|
+
const rs = []; await q.route('**/api/report-setups/*', (r) => { rs.push([new URL(r.request().url()).pathname.replace('/api/report-setups/', ''), JSON.parse(r.request().postData() || '{}')]); r.fulfill({ contentType: 'application/json', body: '{"ok":true,"drafted":{"slot":"2026-10-23","path":"planning/reports/x/2026-10-23.md"}}' }); });
|
|
305
|
+
const lastRs = () => rs[rs.length - 1] || [null, {}];
|
|
306
|
+
await q.click('#sugB'); const s1 = await until(() => vw(q));
|
|
307
|
+
ok('L2 the suggestions open what PMOS found, with why and its evidence, marked as waiting for design', s1 && s1.wait === 'What PMOS found in your work' && /Release readiness/.test(s1.text) && /3 times in 6 weeks/.test(s1.text), JSON.stringify(s1));
|
|
308
|
+
await q.click('#czViewer [data-f="f-1"] [data-fx="setup"]'); await until(() => rs.length > 0, 4000);
|
|
309
|
+
ok('L2 Set it up posts that finding to the report-setups route', lastRs()[0] === 'setup' && lastRs()[1].finding === 'f-1' && lastRs()[1].ws === 'w1', JSON.stringify(rs));
|
|
310
|
+
await vwClose(q);
|
|
311
|
+
await q.click('#listRows [data-setup]'); const s2 = await until(() => vw(q));
|
|
312
|
+
await q.click('#czViewer [data-act="pause"]'); await until(() => rs.length > 1, 4000);
|
|
313
|
+
ok('L2 a report setup opens with its schedule and next draft, marked as waiting for design; Pause posts it', s2 && s2.wait === 'A report setup' && /Every other Monday at 09:00/.test(s2.text) && lastRs()[0] === 'pause' && lastRs()[1].id === 'partner-update', JSON.stringify([s2, rs]));
|
|
314
|
+
await vwClose(q);
|
|
315
|
+
await q.click('#listRows [data-ask="a-1"]'); const s3 = await until(() => vw(q));
|
|
316
|
+
await q.click('#czViewer [data-act="change"]'); const need = await txt('#czViewer [data-msg]', q);
|
|
317
|
+
await q.fill('#czViewer [data-chg]', 'quarterly'); await q.click('#czViewer [data-act="change"]'); await until(() => rs.length > 2, 4000);
|
|
318
|
+
ok('L2 a request opens with what you asked and its proposal; Change it needs words, then posts the correction', s3 && s3.wait === 'A report request and its proposal' && /A monthly churn report for finance/.test(s3.text) && /Say what to change/.test(need) && lastRs()[0] === 'change' && lastRs()[1].id === 'a-1' && lastRs()[1].text === 'quarterly', JSON.stringify([s3, need, rs]));
|
|
319
|
+
await vwClose(q);
|
|
320
|
+
await q.click('#sugB'); await until(() => vw(q)); await q.click('#czViewer [data-askr]'); await sleep(150); /* re-pointed (insights fix): not on the Library bar; under the suggestions */ await q.fill('#czViewer [data-ask] textarea', 'A weekly risk note'); await q.click('#czViewer [data-ask] button[type="submit"]'); await until(() => rs.length > 3, 4000);
|
|
321
|
+
ok('L2 Ask for a report posts the request; nothing is set up yet', lastRs()[0] === 'ask' && lastRs()[1].text === 'A weekly risk note' && await until(() => q.evaluate(() => { const v = document.querySelector('#czViewer'); return !v || v.hidden; }), 4000), JSON.stringify(rs));
|
|
322
|
+
await vwClose(q);
|
|
323
|
+
ok('L2 every Library press went to a report-setups route', R.posts.every((x) => /^POST \/api\/report-setups\/(setup|pause|change|ask)$/.test(x)), R.posts.join());
|
|
324
|
+
await q.click('#listRows [data-d="p:Reliability"]'); await sleep(150);
|
|
325
|
+
ok('L3 a dashboard card opens Goals on that view', (await txt('#viewName', q)) === 'Reliability' && (await q.evaluate(() => document.querySelector('#tabGoals').getAttribute('aria-selected'))) === 'true' && (await q.evaluate(() => [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => r.dataset.goal).join())) === 'krm-up,krm-churn');
|
|
326
|
+
await q.click('#tabLibrary'); await q.locator('#listRows [data-rpt]').first().click();
|
|
327
|
+
ok('L4 a report opens in the page\'s reader, not the console (premium-report-read R1; re-pointed by premium-agreed-design: the reader is the report panel in the Viewer card)', await until(() => q.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) .vz-rp0')), 5000) && /premium-insights\.html/.test(q.url()), q.url());
|
|
328
|
+
ok('L4 a draft report has Issue in the reader, so nothing sends you to the console to issue it', await until(() => q.evaluate(() => !!document.querySelector('#czViewer .vz-rp0 [data-r="issue"]')), 8000) && await q.evaluate(() => !document.querySelector('#czViewer a[href*="console.html"]')));
|
|
240
329
|
await R.ctx.close();
|
|
241
330
|
const lead = { 'planning/reports/biweekly/2026-10-14.md': 'Activation slipped to 28% this fortnight.' };
|
|
242
331
|
const R2 = await open({ model: mk({ leads: lead }) });
|
|
243
|
-
const ln = await R2.page.evaluate(() => ({ dash: [...document.querySelectorAll('#listRows [data-d] .
|
|
244
|
-
ok('
|
|
332
|
+
await R2.page.click('#tabLibrary'); const ln = await R2.page.evaluate(() => ({ dash: [...document.querySelectorAll('#listRows [data-d] .ins-mini small')].map((e) => e.textContent), rep: [...document.querySelectorAll('#listRows [data-rpt] .nm small')].map((e) => e.textContent), su: document.querySelector('#listRows [data-setup] .nm small').textContent }));
|
|
333
|
+
ok('L5 each dashboard card draws its first goals, a report row quotes its file, a setup with no file says no draft is written yet', ln.dash[0] === 'Partner activation' && /^“Activation slipped to 28% this fortnight\.”/.test(ln.rep[0]) && /^No draft is written yet/.test(ln.su), JSON.stringify(ln));
|
|
245
334
|
await R2.ctx.close();
|
|
246
335
|
}
|
|
247
336
|
|
|
248
|
-
/*
|
|
249
|
-
|
|
250
|
-
const R = await open(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
await q.
|
|
254
|
-
const
|
|
255
|
-
|
|
337
|
+
/* W: New goal (AgInsNewGoal): every field the form shows is posted; the route checks it (lib/insights-goals.js goalFields, its own unit checks) */
|
|
338
|
+
{
|
|
339
|
+
const R = await open(), q = R.page, sent = [];
|
|
340
|
+
let answer = { ok: true, rid: 'krm-new' };
|
|
341
|
+
await q.route('**/api/insights-records/goal', (r) => { sent.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ status: answer.ok ? 200 : 400, contentType: 'application/json', body: JSON.stringify(answer) }); });
|
|
342
|
+
await q.click('#newB'); await q.click('#newMenu [data-new="goal"]'); await sleep(100);
|
|
343
|
+
const vis = () => q.evaluate(() => [...document.querySelectorAll('#sideBody [data-for]')].filter((x) => !x.hidden).map((x) => x.dataset.for).join('|'));
|
|
344
|
+
const f = await q.evaluate(() => ({ eye: document.querySelector('#sideEye').textContent.replace(/\s+/g, ' '), obj: document.querySelector('#ngObj').value, titleIn: !!document.querySelector('#sideTitle #ngName'), types: [...document.querySelectorAll('#sideBody [data-seg="Type"] [data-v]')].map((b) => b.dataset.v).join(), better: [...document.querySelectorAll('#sideBody [data-seg="Better is"] [data-v]')].map((b) => b.dataset.v).join(), per: [...document.querySelectorAll('#sideBody [data-seg="Period"] [data-v]')].map((b) => b.dataset.v).join(), src: document.querySelectorAll('#sideBody [data-src]').length, ns: document.querySelectorAll('#sideBody .ins-ns').length }));
|
|
345
|
+
const v0 = await vis();
|
|
346
|
+
ok('W1 New goal: the objective in the eyebrow, the name as the title, six types, better is, period, sources, owner and guardrail; nothing is marked "Not saved yet"', /^New goal · /.test(f.eye) && f.obj === 'Growth' && f.titleIn && f.types === 'Done or not,Percentage,Count,Amount,Duration,Stay within' && f.better === 'Up,Down,Exactly the target' && f.per === 'Quarter,Half,Year,Custom' && f.src === 4 && f.ns === 0 && v0 === 'measured|measured within|dated', JSON.stringify([f, v0]));
|
|
347
|
+
await q.click('#sideBody [data-seg="Type"] [data-v="Done or not"]'); const v1 = await vis();
|
|
348
|
+
await q.click('#sideBody [data-seg="Type"] [data-v="Stay within"]'); const v2 = await vis(); const lab = await txt('#sideBody [data-lab="tgt"]', q);
|
|
349
|
+
await q.click('#ngAlways'); const v3 = await vis();
|
|
350
|
+
ok('W1 the form follows the type: Done or not asks for steps and a date; Stay within for the reading now, a limit and whether it is always on', v1 === 'done|dated' && v2 === 'within|measured within|within' && lab === 'Limit' && v3 === 'within|measured within|within|dated', JSON.stringify([v1, v2, lab, v3]));
|
|
351
|
+
await q.click('#sideBody [data-seg="Type"] [data-v="Count"]');
|
|
352
|
+
await q.fill('#ngName', 'Weekly active partners'); await q.fill('#ngBase', '10'); await q.fill('#ngTgt', '40');
|
|
353
|
+
await q.click('#sideBody [data-seg="Period"] [data-v="Year"]'); await q.click('#sideBody [data-src="jira"]'); await q.fill('#ngOwner', 'Lee'); await q.selectOption('#ngGuard', { index: 1 });
|
|
354
|
+
answer = { ok: false, error: 'Up is better, so the target must be above the baseline.' }; await q.click('#sideGo'); await until(() => sent.length > 0, 4000); await sleep(150);
|
|
355
|
+
const refused = await txt('#sideMsg', q);
|
|
356
|
+
answer = { ok: true, rid: 'krm-new' }; await q.click('#sideGo'); await until(() => sent.length > 1, 4000); await sleep(200);
|
|
357
|
+
const b = sent[1] || {};
|
|
358
|
+
ok('W1 a refusal from the route is said in the panel and the panel stays open', /target must be above/.test(refused), refused);
|
|
359
|
+
ok('W1 Save posts every field: name, type, direction, numbers, date, period, objective, source, owner and guardrail', b.ws === 'w1' && b.name === 'Weekly active partners' && b.type === 'Count' && b.direction === 'Up' && b.baseline === '10' && b.target === '40' && b.due === '2026-12-31' && b.period_kind === 'Year' && b.period_label === '2026' && b.objective === 'Growth' && b.source === 'jira' && b.owner === 'Lee' && b.guardrail === 'Partner activation must not get worse' && await q.evaluate(() => document.querySelector('#side').hidden), JSON.stringify(b));
|
|
360
|
+
await q.click('#newB'); await q.click('#newMenu [data-new="goal"]'); await q.fill('#ngName', 'SOC 2 report delivered'); await q.click('#sideBody [data-seg="Type"] [data-v="Done or not"]'); await q.fill('#ngSteps', 'Scope\nEvidence\n\nAudit'); await q.click('#sideGo'); await until(() => sent.length > 2, 4000);
|
|
361
|
+
ok('W1 a Done-or-not goal posts its steps', JSON.stringify(sent[2].steps) === JSON.stringify(['Scope', 'Evidence', 'Audit']) && sent[2].type === 'Done or not', JSON.stringify(sent[2]));
|
|
362
|
+
await R.ctx.close();
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/* I10 empty and unread */
|
|
366
|
+
{
|
|
367
|
+
const R = await open({ model: mk({ outcomes: [] }) });
|
|
368
|
+
ok('I10 with no KR metric the page says there is no insight yet and draws no goal; Library still holds the report files', await R.page.evaluate(() => /No KR metric is recorded/.test(document.querySelector('#brief').textContent) && /No goal is recorded for this workspace/.test(document.querySelector('#goalTbl').textContent) && document.querySelectorAll('#goalTbl [data-goal]').length === 0 && document.querySelectorAll('#listRows [data-rpt]').length === 2 && document.querySelector('#insWhy').textContent === ''));
|
|
256
369
|
await R.ctx.close();
|
|
370
|
+
const R2 = await open({ model: mk({ reportsOk: false, reports: [], missing: ['reports'] }) });
|
|
371
|
+
await R2.page.click('#tabLibrary');
|
|
372
|
+
ok('I10 reports that could not be read are said to be unread, not empty', /report files could not be read/.test(await txt('#repBody', R2.page)));
|
|
373
|
+
await R2.ctx.close();
|
|
257
374
|
}
|
|
375
|
+
/* I2 failed read */
|
|
258
376
|
{
|
|
259
|
-
const
|
|
260
|
-
|
|
377
|
+
const c2 = await browser.newContext({ viewport: { width: 1280, height: 900 } }), p2 = await c2.newPage();
|
|
378
|
+
await p2.route('**/api/insights-premium*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, state: 'error', error: 'the KR metric records could not be read: boom' }) }));
|
|
379
|
+
await p2.goto(BASE + '/premium-insights.html');
|
|
380
|
+
ok('I2 a failed read says why and draws nothing', await until(() => p2.evaluate(() => /The reason: the KR metric records could not be read: boom/.test(document.querySelector('#brief').textContent) && document.querySelectorAll('#goalTbl [data-goal]').length === 0), 4000));
|
|
381
|
+
await c2.close();
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/* I11 the phone (AgInsPhone) and the floors */
|
|
385
|
+
for (const theme of ['light', 'dark']) {
|
|
386
|
+
const R = await open({ w: 390, h: 844, theme }), q = R.page;
|
|
387
|
+
const m = await q.evaluate(() => { const vis = (b) => !b.closest('[hidden]') && b.getBoundingClientRect().height > 0; /* re-pointed (insights fix, AgInsPhone): a control keeps the design's size and its 44 px hit area is its ::after */
|
|
388
|
+
const hit = (b) => Math.max(b.getBoundingClientRect().height, parseFloat(getComputedStyle(b, '::after').height) || 0);
|
|
389
|
+
const small = [...document.querySelectorAll('#insBar button, #askWhy, #goalCards .ins-card, #czFab')].filter((b) => vis(b) && hit(b) < 44).map((b) => (b.id || b.className) + ':' + Math.round(hit(b)));
|
|
390
|
+
return { over: document.documentElement.scrollWidth > innerWidth + 1, small, table: getComputedStyle(document.querySelector('#goalTbl')).display, cards: [...document.querySelectorAll('#goalCards .ins-card')].map((c) => c.dataset.goal + ':' + ((c.querySelector('.ins-ch .cz-pill') || {}).textContent || '')).join() }; });
|
|
391
|
+
ok(`I11 at 390 px (${theme}) the goals are cards with their status, the table is hidden, there is no sideways scroll and every control is 44 px`, !m.over && m.small.length === 0 && m.table === 'none' && m.cards === 'krm-act:Behind,krm-up:Ahead,krm-ttfc:Behind,krm-nps:Behind,krm-churn:', JSON.stringify(m));
|
|
261
392
|
await R.ctx.close();
|
|
262
393
|
}
|
|
263
394
|
|
|
@@ -271,31 +402,31 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
271
402
|
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), pg = await ctx.newPage(), errs = [];
|
|
272
403
|
pg.on('pageerror', (e) => errs.push(String(e)));
|
|
273
404
|
await pg.goto(BASE + '/premium-insights.html');
|
|
274
|
-
ok('E4 the real page says there is
|
|
405
|
+
ok('E4 the real page says there is no goal, and has no script error', await until(() => pg.evaluate(() => /No KR metric is recorded/.test(document.querySelector('#brief').textContent) && /No goal is recorded/.test(document.querySelector('#goalTbl').textContent)), 20000) && errs.length === 0, errs.join(' | '));
|
|
275
406
|
await ctx.close();
|
|
276
407
|
}
|
|
277
408
|
{
|
|
278
409
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ins-repo-'));
|
|
279
410
|
fs.mkdirSync(path.join(dir, 'planning', 'records'), { recursive: true });
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
{ id:
|
|
411
|
+
const LG = require('../scripts/trust/ledger.js'), U = (i) => LG.newId(1.7e12 + i * 1000); // the ledger is append-only by ULID
|
|
412
|
+
const L = [{ id: U(1), kind: 'add', rid: 'krm-a', fields: { metric: 'Partner activation', baseline: 20, target: 50, by: '2026-12-31', pillar: 'Growth', unit: '%' } },
|
|
413
|
+
{ id: U(2), kind: 'reading', rid: 'krm-a', fields: { at: '2026-07-01', value: 20 } }, { id: U(3), kind: 'reading', rid: 'krm-a', fields: { at: '2026-08-01', value: 24 } }, { id: U(4), kind: 'reading', rid: 'krm-a', fields: { at: '2026-10-01', value: 30 } },
|
|
414
|
+
{ id: U(5), kind: 'add', rid: 'krm-b', fields: { metric: 'Lonely', baseline: 1, target: 2, by: '2026-12-31' } }, { id: U(6), kind: 'reading', rid: 'krm-b', fields: { at: '2026-10-01', value: 1 } }];
|
|
283
415
|
fs.writeFileSync(path.join(dir, 'planning', 'records', 'kr-metrics.jsonl'), L.map((x) => JSON.stringify(x)).join('\n') + '\n');
|
|
284
416
|
const port2 = T.port(), base2 = `http://${require('./test-run').HOST}:${port2}`;
|
|
285
417
|
srv2 = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(port2), PMOS_SELF_ROOT: dir, PMOS_STATE_DIR: fs.mkdtempSync(path.join(os.tmpdir(), 'ins-state-')) }) });
|
|
286
418
|
await T.waitForServer(base2);
|
|
287
419
|
const j = await (await fetch(base2 + '/api/insights-premium')).json(); const m = j.model;
|
|
288
|
-
ok('E5 a scratch repository\'s KR metric records reach the page model: one
|
|
420
|
+
ok('E5 a scratch repository\'s KR metric records reach the page model: one series of three readings, one goal without a series', !!m && m.charts.length === 1 && m.charts[0].pts.length === 3 && m.charts[0].v === '30%' && m.noSeries.length === 1 && m.noSeries[0].why === 'Only one reading is recorded.', JSON.stringify(m && m.counts));
|
|
289
421
|
ok('E6 the real model keeps the gap: the 1 Aug to 1 Oct step is wider than 1 Jul to 1 Aug', !!m && m.charts[0].pts[2].fx - m.charts[0].pts[1].fx > 1.9 * (m.charts[0].pts[1].fx - m.charts[0].pts[0].fx));
|
|
290
422
|
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), pg = await ctx.newPage(), errs = [];
|
|
291
423
|
pg.on('pageerror', (e) => errs.push(String(e)));
|
|
292
424
|
await pg.goto(base2 + '/premium-insights.html');
|
|
293
|
-
ok('E7 the real page draws that
|
|
294
|
-
/* briefing-premium-reports against the real server: New dashboard, Save, the switch, then the ledger answers it back */
|
|
425
|
+
ok('E7 the real page draws that goal with the record\'s numbers and its line, a small count as blocks, and no script error', await until(() => pg.evaluate(() => { const r = document.querySelector('#goalTbl [data-goal="krm-a"]'); return !!r && r.querySelector('.val b').textContent === '30%' && !!r.querySelector('svg.ins-spark') && document.querySelectorAll('#goalTbl [data-goal="krm-b"] .ins-blocks i.on').length === 1 && document.querySelectorAll('#goalTbl [data-goal="krm-b"] .ins-blocks i').length === 2; }), 20000) && errs.length === 0, errs.join(' | '));
|
|
295
426
|
const H = await T.pressHeaders(base2);
|
|
296
427
|
const made = await fetch(base2 + '/api/premium-dashboards/save', { method: 'POST', headers: H, body: JSON.stringify({ ws: m.board.ws, board: m.board.id, name: 'Partner review', purpose: 'The Monday partner review.', charts: [m.charts[0].id], main: true }) }).then((x) => x.status);
|
|
297
428
|
await pg.reload();
|
|
298
|
-
ok('E8 a dashboard saved as the main one
|
|
429
|
+
ok('E8 a dashboard saved as the main one opens first on the real page: View names it and Goals holds its goal', made === 200 && await until(() => pg.evaluate(() => document.querySelector('#viewName').textContent === 'Partner review' && [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => r.dataset.goal).join() === 'krm-a'), 10000), await pg.evaluate(() => document.querySelector('#viewName').textContent));
|
|
299
430
|
const j2 = await (await fetch(base2 + '/api/insights-premium')).json(), d2 = j2.model.dashboards.find((d) => d.saved);
|
|
300
431
|
ok('E8 the model reads it back from the ledger', !!d2 && d2.name === 'Partner review' && d2.main && d2.charts.join() === m.charts[0].id, JSON.stringify(d2));
|
|
301
432
|
const body = JSON.stringify({ ws: m.board.ws, board: m.board.id, name: 'From an agent', purpose: 'x', charts: [] });
|
|
@@ -303,37 +434,43 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
303
434
|
const noNonce = await fetch(base2 + '/api/premium-dashboards/save', { method: 'POST', headers: { 'Content-Type': 'application/json', Origin: base2 }, body }).then((x) => x.status);
|
|
304
435
|
const unknown = await fetch(base2 + '/api/premium-dashboards/save', { method: 'POST', headers: H, body: JSON.stringify({ ws: m.board.ws, board: m.board.id, name: 'Other', purpose: 'x', charts: ['krm-none'] }) }).then((x) => x.status);
|
|
305
436
|
ok('E9 the real save route refuses an agent session (403), a press without the nonce (403) and a chart no record holds (400)', asAgent === 403 && noNonce === 403 && unknown === 400, [asAgent, noNonce, unknown].join());
|
|
437
|
+
/* New goal against the real route: the record lands in the scratch repository with every field the page sent */
|
|
438
|
+
await pg.click('#newB'); await pg.click('#newMenu [data-new="goal"]'); await pg.fill('#ngName', 'Weekly partners'); await pg.fill('#ngBase', '5'); await pg.fill('#ngTgt', '9');
|
|
439
|
+
await pg.click('#sideBody [data-seg="Type"] [data-v="Count"]'); await pg.fill('#ngOwner', 'Lee'); await pg.click('#sideBody [data-src="file"]'); await pg.click('#sideGo');
|
|
440
|
+
const krFile = path.join(dir, 'planning', 'records', 'kr-metrics.jsonl'), recs = () => fs.readFileSync(krFile, 'utf8').trim().split('\n').map((x) => JSON.parse(x));
|
|
441
|
+
const landed = await until(() => /Weekly partners/.test(fs.readFileSync(krFile, 'utf8')), 8000);
|
|
442
|
+
const rec = landed ? recs().find((x) => x.fields && x.fields.metric === 'Weekly partners') : null;
|
|
443
|
+
ok('E10 New goal on the real page adds a KR metric record with its type, direction, numbers, date, period, objective, owner and source, and the page draws it', !!rec && rec.fields.type === 'Count' && rec.fields.direction === 'up' && rec.fields.baseline === 5 && rec.fields.target === 9 && rec.fields.pillar === 'Growth' && rec.fields.owner === 'Lee' && rec.fields.source === 'file' && rec.fields.period.kind === 'Quarter' && /^\d{4}-\d{2}-\d{2}$/.test(rec.fields.by) && await until(() => pg.evaluate(() => [...document.querySelectorAll('#goalTbl .ins-row b')].some((b) => b.textContent === 'Weekly partners')), 8000), JSON.stringify(rec));
|
|
444
|
+
const post = (route, b, h = H) => fetch(base2 + '/api/insights-records/' + route, { method: 'POST', headers: h, body: JSON.stringify(Object.assign({ ws: m.board.ws, board: m.board.id }, b)) }).then(async (x) => ({ status: x.status, body: await x.json() }));
|
|
445
|
+
const bad1 = await post('goal', { name: 'Wrong way', type: 'Count', direction: 'Up', baseline: 9, target: 5, due: '2026-12-31' });
|
|
446
|
+
const done = await post('goal', { name: 'SOC 2 report', type: 'Done or not', due: '2026-12-15', steps: ['Scope', 'Audit'] });
|
|
447
|
+
const tick = await post('steps', { rid: done.body.rid, done: [true, false] });
|
|
448
|
+
const doneRec = recs().filter((x) => x.rid === done.body.rid);
|
|
449
|
+
ok('E11 the real goal route refuses a target on the wrong side, keeps a Done-or-not goal as its steps, and a tick writes the steps and a reading', bad1.status === 400 && /Up is better/.test(bad1.body.error) && done.status === 200 && tick.status === 200 && tick.body.done === 1 && doneRec.map((x) => x.kind).join() === 'add,edit,reading' && doneRec[1].fields.steps[0].done === true && doneRec[2].fields.value === 1, JSON.stringify([bad1, done, tick, doneRec.map((x) => x.kind)]));
|
|
450
|
+
const dsc = await post('describe', { text: 'How is partner activation doing?' });
|
|
451
|
+
const dsh = await post('dashboard', { name: 'Activation weekly', purpose: 'How is activation doing?', charts: [{ goal: 'krm-a', form: 'Bars' }], range: '8w', pin: true });
|
|
452
|
+
const chs = await post('chart', { dash: dsh.body.id, goal: 'krm-a', form: 'Number', range: '26w', compare: 'lq', target: true, forecast: true, note: 'After the kit' });
|
|
453
|
+
const vd = await post('verdict', { ini: 'nothing-shipped', verdict: 'Keep', learned: 'It held.' });
|
|
454
|
+
const tg = await post('target', { key: 'scope', target: 3 });
|
|
455
|
+
const asAgent2 = await post('verdict', { ini: 'x', verdict: 'Keep', learned: 'y' }, { ...H, 'x-pmos-session': 's1' });
|
|
456
|
+
const j3 = await (await fetch(base2 + '/api/insights-premium')).json(), m3 = j3.model;
|
|
457
|
+
ok('E12 describe reads the goals and writes nothing; the dashboard, its chart settings, the pin, a verdict and a tile target land in the ledger and come back in the model', dsc.status === 200 && dsc.body.goals.join() === 'krm-a' && dsh.status === 200 && dsh.body.pinned === dsh.body.id && chs.status === 200 && vd.status === 200 && tg.status === 200 && asAgent2.status === 403
|
|
458
|
+
&& m3.pinned === dsh.body.id && m3.chartSet[dsh.body.id]['krm-a'].form === 'Number' && m3.chartSet[dsh.body.id]['krm-a'].note === 'After the kit' && m3.trends.targets.scope === 3, JSON.stringify([dsc.body, dsh.status, chs.body, vd.status, tg.body, asAgent2.status, m3.chartSet]));
|
|
459
|
+
const csv = await fetch(base2 + '/api/insights-records/export?ws=' + m.board.ws).then(async (x) => ({ status: x.status, type: x.headers.get('content-type'), text: await x.text() }));
|
|
460
|
+
ok('E13 Export answers the goals as CSV, one row each', csv.status === 200 && /^text\/csv/.test(csv.type) && /^id,goal,objective,type/.test(csv.text) && /krm-a,Partner activation,Growth,Percentage/.test(csv.text) && /Weekly partners/.test(csv.text), csv.text.slice(0, 200));
|
|
306
461
|
await ctx.close();
|
|
307
462
|
}
|
|
308
463
|
|
|
309
|
-
/* I11 fidelity
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
320
|
-
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
321
|
-
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
|
|
322
|
-
await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="ins"]').click(); }, th);
|
|
323
|
-
await until(() => m.evaluate(() => document.querySelectorAll('#nMain .mt1').length > 0)); await sleep(900);
|
|
324
|
-
const R = await open({ w, h, theme: th }); await sleep(500);
|
|
325
|
-
const a = await grab(m, 1), c = await grab(R.page, 2), diffs = [];
|
|
326
|
-
for (const [n] of PAIRS) {
|
|
327
|
-
if (!a[n] || !c[n]) { diffs.push(n + ' missing'); continue; }
|
|
328
|
-
for (const k of Object.keys(a[n])) {
|
|
329
|
-
const geom = k === 'left' || k === 'width';
|
|
330
|
-
if (geom && (SKIP_W.includes(n) && k === 'width' || ['findtext', 'tlabel', 'chip', 'value', 'caption', 'foot', 'link', 'dot', 'finding', 'hint', 'heading', 'repcard'].includes(n) && k === 'left')) continue;
|
|
331
|
-
if (geom ? Math.abs(a[n][k] - c[n][k]) > 2 : a[n][k] !== c[n][k]) diffs.push(`${n}.${k} ${a[n][k]} | ${c[n][k]}`);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
ok(`I11 styles and geometry match the mockup at ${w} px, ${th}`, diffs.length === 0, diffs.join(' ; '));
|
|
335
|
-
await m.context().close(); await R.ctx.close();
|
|
336
|
-
}
|
|
464
|
+
/* I11 fidelity to the Agreed design (AgInsGoals, AgInsPhone): Nunito, the cozy panel, the pill tabs, the table, the strip and the six tiles */
|
|
465
|
+
for (const [w, h] of [[1440, 900], [390, 844]]) {
|
|
466
|
+
const R = await open({ w, h }); await sleep(300);
|
|
467
|
+
const f = await R.page.evaluate(() => { const cs = (s) => getComputedStyle(document.querySelector(s)); const main = cs('main.ins'), tab = cs('#tabGoals'), strip = cs('#insHero'), row = document.querySelector('#goalTbl .ins-row').getBoundingClientRect();
|
|
468
|
+
const tiles = [...document.querySelectorAll('#bmBody [data-tile]')].map((t) => t.getBoundingClientRect());
|
|
469
|
+
return { font: cs('body').fontFamily, radius: main.borderTopLeftRadius, bg: main.backgroundColor, tabBg: tab.backgroundColor, tabR: tab.borderTopLeftRadius, tabW: tab.fontWeight, stripR: strip.borderTopLeftRadius, stripBg: strip.backgroundColor, rowH: Math.round(row.height), over: document.documentElement.scrollWidth > innerWidth, fab: document.querySelector('#czFab').getBoundingClientRect().width, fabX: Math.round(document.querySelector('#czFab').getBoundingClientRect().left), tileRow: tiles.length === 6 && tiles.every((t) => Math.abs(t.top - tiles[0].top) < 2), tileH: tiles.length ? Math.round(tiles[0].height) : 0 }; });
|
|
470
|
+
const phone = w < 720;
|
|
471
|
+
ok(`I11 the page wears the Agreed design at ${w} px: Nunito, the white panel, pill tabs, the well strip, 56 px floating button`, /^Nunito/.test(f.font) && f.radius === (phone ? '0px' : '28px') && (phone || f.bg === 'rgb(255, 255, 255)') && f.tabBg === 'rgb(244, 243, 240)' && f.tabR === '999px' && f.tabW === '700' && (phone || (f.stripR === '16px' && f.stripBg === 'rgb(244, 243, 240)' && f.rowH >= 60)) && !f.over && f.fab === 56 && (phone ? f.fabX > 300 : f.fabX === 36), JSON.stringify(f));
|
|
472
|
+
if (!phone) ok('I11 at 1440 px the six Delivery trends tiles sit in one compact row', f.tileRow && f.tileH > 0 && f.tileH <= 90, JSON.stringify(f));
|
|
473
|
+
await R.ctx.close();
|
|
337
474
|
}
|
|
338
475
|
return finish();
|
|
339
476
|
})().catch((e) => { console.error(e); finish(1); });
|