create-pmos 0.397.0 → 0.399.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/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +105 -52
- package/workspace/briefing-premium-board-test.js +284 -128
- package/workspace/briefing-premium-calendar-2-test.js +135 -198
- package/workspace/briefing-premium-calendar-3-test.js +143 -418
- package/workspace/briefing-premium-calendar-test.js +85 -196
- package/workspace/briefing-premium-doc-edit-test.js +99 -83
- package/workspace/briefing-premium-initiative-test.js +175 -290
- package/workspace/briefing-premium-insights-test.js +414 -219
- package/workspace/briefing-premium-metrics-test.js +55 -97
- package/workspace/briefing-premium-products-test.js +44 -28
- package/workspace/briefing-premium-sources-test.js +70 -49
- package/workspace/briefing-premium-test.js +155 -648
- package/workspace/briefing-premium-work-test.js +88 -283
- package/workspace/changelog.json +24 -0
- package/workspace/ev-everywhere-test.js +210 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +187 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +68 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-grill.js +63 -0
- package/workspace/lib/board-premium.js +121 -24
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/initiative-layout.js +77 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +64 -15
- package/workspace/lib/insights-records.js +115 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/meeting-points.js +52 -0
- package/workspace/lib/news-for-you.js +88 -0
- package/workspace/lib/notes-series.js +29 -6
- package/workspace/lib/report-confirm.js +48 -0
- package/workspace/lib/route-modules.js +12 -0
- package/workspace/lib/routes-board-docs.js +46 -0
- package/workspace/lib/routes-board-grill.js +90 -0
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-home-review.js +108 -0
- package/workspace/lib/routes-initiative-layout.js +57 -0
- package/workspace/lib/routes-insights-premium.js +16 -4
- package/workspace/lib/routes-insights-records.js +133 -0
- package/workspace/lib/routes-meeting-points.js +37 -0
- package/workspace/lib/routes-news.js +57 -0
- package/workspace/lib/routes-notes.js +3 -1
- package/workspace/lib/routes-report-confirm.js +31 -0
- package/workspace/lib/routes-search.js +38 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/search-index.js +176 -0
- package/workspace/lib/transcript-steps.js +123 -0
- 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-board-actions-test.js +128 -82
- package/workspace/premium-briefing-depth-test.js +104 -90
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +37 -37
- package/workspace/premium-chat-context-test.js +19 -18
- package/workspace/premium-chat-goal-view-test.js +23 -23
- package/workspace/premium-chat-notes-test.js +26 -31
- package/workspace/premium-chat-report-tab-test.js +46 -28
- package/workspace/premium-chat-term-test.js +16 -16
- package/workspace/premium-chat-viewer-test.js +60 -59
- package/workspace/premium-core-doc-issue-test.js +52 -43
- package/workspace/premium-html-viewer-test.js +14 -17
- package/workspace/premium-phone-card-test.js +10 -3
- package/workspace/premium-phone-room-test.js +41 -35
- package/workspace/premium-report-read-test.js +152 -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 -33
- package/workspace/premium-vw-cal-test.js +97 -128
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +17 -10
- package/workspace/premium-vw-item-test.js +50 -49
- package/workspace/premium-vw-jira-test.js +53 -27
- package/workspace/premium-vw-meet-test.js +115 -187
- package/workspace/premium-vw-notes-test.js +88 -109
- package/workspace/premium-vw-rec-test.js +71 -194
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +61 -53
- package/workspace/public/pm/bd-acts.js +383 -0
- package/workspace/public/pm/bd-asks.js +261 -0
- package/workspace/public/pm/bd-pop.js +59 -0
- package/workspace/public/pm/bd-span.js +222 -82
- package/workspace/public/pm/bd-stages.js +25 -11
- package/workspace/public/pm/bd-views.js +169 -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 +798 -230
- package/workspace/public/pm/cozy-ev.css +228 -0
- package/workspace/public/pm/cozy-evmodel.js +106 -0
- package/workspace/public/pm/cozy-evui.js +47 -0
- package/workspace/public/pm/cozy-home.css +570 -142
- package/workspace/public/pm/cozy-home.js +5 -3
- package/workspace/public/pm/cozy-insights.css +437 -170
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +104 -29
- package/workspace/public/pm/cozy-news.js +140 -0
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-search.js +203 -0
- package/workspace/public/pm/cozy-settings.js +198 -0
- package/workspace/public/pm/cozy-sources.js +89 -0
- package/workspace/public/pm/cozy-today.css +217 -0
- package/workspace/public/pm/cozy-viewer.css +3 -3
- package/workspace/public/pm/cozy-viewer.js +145 -0
- package/workspace/public/pm/cozy-vw-mtg.css +350 -0
- package/workspace/public/pm/cozy-vw-rp.css +152 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +83 -1
- package/workspace/public/pm/home-adddoc.js +48 -0
- package/workspace/public/pm/home-app.js +1179 -0
- package/workspace/public/pm/home-around.js +413 -0
- package/workspace/public/pm/home-chat.js +512 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-dictate.js +54 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-ini-model.js +190 -0
- package/workspace/public/pm/home-ini.css +171 -0
- package/workspace/public/pm/home-ini.js +456 -0
- package/workspace/public/pm/home-list.js +276 -0
- package/workspace/public/pm/home-more.js +132 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-review.js +104 -0
- package/workspace/public/pm/home-task.js +67 -0
- package/workspace/public/pm/home-today.js +144 -0
- package/workspace/public/pm/home-work.js +547 -0
- 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 +548 -395
- package/workspace/public/pm/premium-chart-tab.js +109 -62
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +23 -21
- package/workspace/public/pm/premium-insights.js +1102 -581
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-mtg-present.js +138 -0
- package/workspace/public/pm/premium-mtg-replay.js +142 -0
- 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 +669 -476
- package/workspace/public/pm/premium-report-tab.js +116 -67
- package/workspace/public/pm/premium-shell.js +76 -123
- package/workspace/public/pm/premium-viewer.js +22 -1
- package/workspace/public/pm/premium-vw-cal.js +277 -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-meet.js +6 -83
- package/workspace/public/pm/premium-vw-mtg.js +958 -0
- package/workspace/public/pm/premium-vw-notes.js +116 -68
- 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 -218
- package/workspace/public/pm/premium-vw-slides.css +5 -0
- package/workspace/public/pm/premium-vw-slides.js +44 -8
- package/workspace/public/pm/rp-parts.js +269 -0
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +29 -70
- package/workspace/public/premium-initiative.html +8 -48
- package/workspace/public/premium-insights.html +26 -64
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium.html +18 -107
- package/workspace/r/m1.png +0 -0
- package/workspace/r/m2.png +0 -0
- package/workspace/r/m3.png +0 -0
- package/workspace/r/nl.png +0 -0
- package/workspace/server.js +18 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/initiative-layout.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
- package/workspace/test-lists/premium-uncovered-reports.json +9 -0
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/test-lists/uf-everywhere.json +15 -0
- package/workspace/test-lists/uf-home.json +9 -0
- package/workspace/test-lists/uncovered-board.json +9 -0
- package/workspace/public/pm/premium-work.js +0 -729
- package/workspace/public/pm/premium.js +0 -1146
|
@@ -2,10 +2,15 @@
|
|
|
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
|
-
*
|
|
7
|
-
* premium-agreed-design (planning/prd/premium-agreed-design-prd.md N1, N2, G1, G2): the
|
|
8
|
-
*
|
|
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. */
|
|
9
14
|
const fs = require('fs');
|
|
10
15
|
const os = require('os');
|
|
11
16
|
const path = require('path');
|
|
@@ -31,7 +36,12 @@ const finish = async (code) => {
|
|
|
31
36
|
};
|
|
32
37
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
33
38
|
|
|
34
|
-
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' }] } };
|
|
35
45
|
|
|
36
46
|
(async () => {
|
|
37
47
|
const exe = findBrowser();
|
|
@@ -42,237 +52,385 @@ const mk = (o) => IP.build(F.facts(Object.assign({ pinned: 'all' }, o))); // A
|
|
|
42
52
|
await T.waitForServer(BASE);
|
|
43
53
|
browser = await chromium.launch({ executablePath: exe });
|
|
44
54
|
|
|
45
|
-
const open = async ({ w =
|
|
55
|
+
const open = async ({ w = 1440, h = 900, theme = 'light', model = mk(), answers = null, bm = BMR, q = '' } = {}) => {
|
|
46
56
|
const ctx = await browser.newContext({ viewport: { width: w, height: h } });
|
|
47
57
|
const page = await ctx.newPage();
|
|
48
|
-
let current = model, calls = 0; const errors = [], posts = [];
|
|
58
|
+
let current = model, calls = 0; const errors = [], posts = [];
|
|
49
59
|
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
50
60
|
page.on('request', (rq) => { if (rq.method() !== 'GET') posts.push(rq.method() + ' ' + new URL(rq.url()).pathname); });
|
|
51
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 }) }); });
|
|
52
|
-
await page.route('**/api/
|
|
53
|
-
await page.goto(BASE + '/premium-insights.html?theme=' + theme);
|
|
54
|
-
const up = await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0 || /could not be read/.test(document.querySelector('#
|
|
55
|
-
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; } };
|
|
56
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; })); };
|
|
57
70
|
|
|
58
71
|
const A = await open();
|
|
59
72
|
ok('0 the page draws the goals', A.up);
|
|
60
73
|
if (!A.up) return finish(1);
|
|
61
|
-
const p = A.page
|
|
62
|
-
const txt = (s) =>
|
|
74
|
+
const p = A.page;
|
|
75
|
+
const txt = (s, pg = p) => pg.evaluate((q) => (document.querySelector(q) || {}).textContent || '', s);
|
|
63
76
|
|
|
64
|
-
/*
|
|
65
|
-
const nav = await p.evaluate(() => ({ fabs: document.querySelectorAll('#czFab').length, label: document.querySelector('#czFab').getAttribute('aria-label'), rail: getComputedStyle(document.querySelector('.rail')).display
|
|
66
|
-
ok('N1 one floating place menu replaces the rail, 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 === '
|
|
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));
|
|
67
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');
|
|
68
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)); }
|
|
69
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 }; });
|
|
70
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)); }
|
|
71
|
-
|
|
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')));
|
|
72
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);
|
|
73
87
|
for (const [go, re] of [['Home', /\/premium\.html$/], ['Board', /\/premium-board\.html$/]]) {
|
|
74
88
|
const r2 = await open(); await r2.page.click('#czFab'); await r2.page.locator('#czMenu a', { hasText: go }).click();
|
|
75
89
|
ok(`N1 the menu's ${go} opens its premium page`, await until(() => re.test(r2.page.url()), 5000), r2.page.url());
|
|
76
90
|
await r2.ctx.close();
|
|
77
91
|
}
|
|
78
|
-
{ 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, 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) }; });
|
|
79
|
-
ok('G1 goals are grouped by objective, each with its type, value of target, today mark, so-far line with its pace, and what moves it on the lifecycle track', g.groups.length === 3 && /^Objective 1 · Growth/.test(g.groups[0]) && /3 of 3 behind/.test(g.groups[0]) && /Objective 2 · Reliability/.test(g.groups[1]) && /^Delivery trends/.test(g.groups[2]) && g.title === 'Partner activation' && g.type === 'Percentage' && g.val === '28%' && g.of === 'of 50%' && g.today && g.spark && /≈33\.8% by 31 Dec/.test(g.pace) && /short at this pace/.test(g.pace) && g.moves.join() === 'SSO for partners:8:5:2,Self-serve onboarding v2:8:4:2', JSON.stringify(g));
|
|
80
|
-
const nps = await p.evaluate(() => document.querySelector('#goalTbl [data-goal="krm-nps"]').textContent);
|
|
81
|
-
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); }
|
|
82
|
-
{ await p.click('#perChip'); const pm = await p.evaluate(() => [...document.querySelectorAll('#perMenu [data-per]')].map((b) => b.dataset.per + ':' + b.getAttribute('aria-checked')).join()); await p.click('#perMenu [data-per="lq"]'); await sleep(150);
|
|
83
|
-
const lq = await p.evaluate(() => ({ chip: document.querySelector('#perName').textContent, rows: document.querySelectorAll('#goalTbl .ins-row').length, n: document.querySelector('#nGoals').textContent }));
|
|
84
|
-
ok('G1 the period picker offers this quarter, last quarter, this half, this year and custom; last quarter keeps the goals whose time overlaps it', pm === 'q:true,lq:false,h:false,y:false,c:false' && lq.chip === 'Q3 2026' && lq.rows === 3 && lq.n === '3', JSON.stringify([pm, lq]));
|
|
85
|
-
await p.click('#perChip'); await p.click('#perMenu [data-per="q"]'); await sleep(100); }
|
|
86
92
|
|
|
87
|
-
/*
|
|
88
|
-
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') })) }));
|
|
89
|
-
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]));
|
|
90
|
-
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);
|
|
91
|
-
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 */
|
|
92
94
|
{
|
|
93
|
-
|
|
94
|
-
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(), status: [...document.querySelectorAll('#filtMenu [data-fk="status"]')].map((b) => b.textContent).join(), owners: [...document.querySelectorAll('#filtMenu [data-fk="owner"]')].map((b) => b.dataset.fv).join(), kinds: [...document.querySelectorAll('#filtMenu [data-fk="kind"]')].map((b) => b.textContent).join(), chips: document.querySelectorAll('#filtMenu .cz-chip').length, label: document.querySelector('#filtB').getAttribute('aria-label') }));
|
|
98
|
+
await p.keyboard.press('Escape');
|
|
99
|
+
/* re-pointed (premium-uncovered-features, IsMenus): the filter is chips by status, owner and kind */
|
|
100
|
+
ok('B1 the filter is chips by status, owner and kind; the owners are the goals\' owners and the work that moves them', fl.heads === 'Status,Owner,Kind' && fl.status === 'Off track,On track,Hit,No readings' && fl.owners === 'Dara,Lee,Mira' && fl.kinds === 'Goals,Health budgets' && /status, owner or kind/.test(fl.label), JSON.stringify(fl));
|
|
101
|
+
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"]');
|
|
102
|
+
const ab = await until(() => vw(p));
|
|
103
|
+
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]));
|
|
104
|
+
await vwClose(p);
|
|
105
|
+
await p.click('#moreB'); await p.click('#moreMenu [data-more="sources"]'); const so = await until(() => vw(p));
|
|
106
|
+
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));
|
|
107
|
+
await vwClose(p);
|
|
108
|
+
{ 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' }));
|
|
109
|
+
const [rq] = await Promise.all([q.waitForRequest(/\/api\/insights-records\/export/), (async () => { await q.click('#moreB'); await q.click('#moreMenu [data-more="export"]'); })()]);
|
|
110
|
+
const u = new URL(rq.url());
|
|
111
|
+
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(); }
|
|
112
|
+
await vwClose(p);
|
|
113
|
+
await p.click('#findB'); await p.fill('#findIn', 'partner'); await sleep(150);
|
|
114
|
+
const fr = await p.evaluate(() => ({ heads: [...document.querySelectorAll('#findRes .ins-mh')].map((h) => h.textContent).join(), goals: [...document.querySelectorAll('#findRes [data-fo="goal"]')].map((b) => b.dataset.id).join(), mark: (document.querySelector('#findRes mark') || {}).textContent, dash: [...document.querySelectorAll('#findRes [data-fo="dash"]')].map((b) => b.dataset.id).join() }));
|
|
115
|
+
ok('B1 Find is a popover: goals, reports and dashboards that hold the words, the words marked (IsMenus)', fr.heads === 'Goals,Reports,Dashboards' && fr.goals === 'krm-act,krm-up,krm-nps' && /^partner$/i.test(fr.mark) && fr.dash === 'pd-1', JSON.stringify(fr));
|
|
116
|
+
await p.fill('#findIn', 'uptime'); await sleep(150);
|
|
117
|
+
const fd = await p.evaluate(() => [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => r.dataset.goal).join());
|
|
118
|
+
await p.click('#findX'); await sleep(100);
|
|
119
|
+
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 && await p.evaluate(() => document.querySelector('#findRow').hidden), fd);
|
|
120
|
+
await p.click('#findB'); await p.fill('#findIn', 'activation'); await sleep(100); await p.click('#findRes [data-fo="goal"]');
|
|
121
|
+
const fo = await until(() => vw(p));
|
|
122
|
+
ok('B1 a goal found opens its detail, and Find closes', fo && fo.title === 'Partner activation' && await p.evaluate(() => document.querySelector('#findRow').hidden), JSON.stringify(fo));
|
|
123
|
+
await vwClose(p);
|
|
124
|
+
await p.click('#viewChip'); const vm = await p.evaluate(() => ({ head: document.querySelector('#viewMenu .ins-mh').textContent, items: [...document.querySelectorAll('#viewMenu [data-view]')].map((b) => b.dataset.view + ((b.querySelector('.k') || {}).textContent ? ':' + b.querySelector('.k').textContent : '')).join(), nd: !!document.querySelector('#viewMenu [data-newdash]') })); await p.keyboard.press('Escape');
|
|
125
|
+
ok('B1 the Dashboard menu lists every view with the default one marked, then Delivery trends, then New dashboard (IsMenus)', vm.head === 'Dashboard' && vm.items === 'all:default,pd-1,p:Growth,p:Reliability,trends' && vm.nd, JSON.stringify(vm));
|
|
126
|
+
await p.click('#prodPick'); const pr = await p.evaluate(() => ({ head: document.querySelector('#prodMenu .ins-mh').textContent, items: [...document.querySelectorAll('#prodMenu [data-board]')].map((b) => b.textContent).join(), pf: !!document.querySelector('#prodMenu [data-portfolio]') })); await p.keyboard.press('Escape');
|
|
127
|
+
ok('B1 the product picker says Product; with one product there is no Portfolio to roll up', pr.head === 'Product' && pr.items === 'pmos' && !pr.pf, JSON.stringify(pr));
|
|
95
128
|
}
|
|
96
|
-
|
|
129
|
+
|
|
130
|
+
/* G1 the Goals table */
|
|
131
|
+
{ 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 || '')) }; });
|
|
132
|
+
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));
|
|
133
|
+
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));
|
|
134
|
+
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));
|
|
135
|
+
const pills = await p.evaluate(() => Object.fromEntries([...document.querySelectorAll('#goalTbl .ins-ini')].map((m) => [m.querySelector('.n').textContent, (m.querySelector('.cz-pill') || {}).textContent || ''])));
|
|
136
|
+
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));
|
|
137
|
+
const leg = await p.evaluate(() => document.querySelector('#goalTbl .ins-th .ins-mvh').textContent.replace(/\s+/g, ' '));
|
|
138
|
+
ok('G1 the Moved by header carries the legend: skipped and milestone', /Skipped/.test(leg) && /Milestone/.test(leg), leg);
|
|
139
|
+
const nps = await p.evaluate(() => document.querySelector('#goalTbl [data-goal="krm-nps"]').textContent);
|
|
140
|
+
ok('G1 a goal with one reading draws no line and no pace: it shows the one value and No trend yet (IsMenus)', /1 reading/.test(nps) && /No trend yet/.test(nps) && /needs a second reading/.test(nps) && /No initiative anchors to it/.test(nps), nps);
|
|
141
|
+
const up = await txt('#goalTbl [data-goal="krm-up"] .pace');
|
|
142
|
+
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);
|
|
143
|
+
const ch = await txt('#goalTbl [data-goal="krm-churn"]');
|
|
144
|
+
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);
|
|
145
|
+
}
|
|
146
|
+
/* G1 health budgets (D59): each budget of the registry, read as its share of the board's open initiatives against its cap */
|
|
97
147
|
{
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
await
|
|
102
|
-
|
|
148
|
+
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() })));
|
|
149
|
+
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));
|
|
150
|
+
const R = await open({ model: mk({ budgets: [{ id: 'docs', covers: 'docs', cap: 0.1 }] }) });
|
|
151
|
+
ok('G1 a budget over its cap says so', /^Over its 10% cap/.test(await txt('#goalTbl [data-budget="docs"] .pace', R.page)));
|
|
152
|
+
await R.ctx.close();
|
|
153
|
+
await p.click('#goalTbl [data-budget="docs"] .nm');
|
|
154
|
+
const v = await until(() => vw(p));
|
|
155
|
+
ok('G1 a budget press opens its detail in the goal\'s frame: its reading, its cap, what it covers (IsGoal)', v && v.title === 'docs' && !v.wait && /documentation upkeep/.test(v.text) && /cap 20% of a quarter/.test(v.text) && /1 of 6 open on the Board/.test(v.text), JSON.stringify(v));
|
|
156
|
+
await p.click('#czViewer [data-bt="moved"]'); await sleep(100);
|
|
157
|
+
ok('G1 its Moved by tab lists the work anchored to it', /Docs search/.test(await txt('#czViewer .ins-gb')));
|
|
158
|
+
await vwClose(p);
|
|
103
159
|
}
|
|
104
|
-
/*
|
|
105
|
-
|
|
106
|
-
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));
|
|
107
|
-
/* I5 dashboards */
|
|
108
|
-
await p.click('#tabLibrary');
|
|
109
|
-
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')));
|
|
110
|
-
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 goals:true,Weekly partner review:false,Growth:none,Reliability:none', tabs.join());
|
|
111
|
-
await p.click('#repBody [data-d="p:Reliability"]');
|
|
112
|
-
ok('I5 choosing a pillar opens Goals on that view: only its goals and 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 txt('#dashCap')) === '1 of 1 on their line' && (await p.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length)) === 2 && (await txt('#viewName')) === 'Reliability');
|
|
113
|
-
await p.click('#tabLibrary');
|
|
114
|
-
await p.click('#repBody [data-d="all"]');
|
|
115
|
-
const hint = await txt('#dashBody .mhint');
|
|
116
|
-
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);
|
|
117
|
-
ok('I5 the strip and the Goals tab count the same goals', (await txt('#nGoals')) === '5' && /18 of 92 days gone in Q4 2026\./.test(await txt('#insEye')));
|
|
118
|
-
/* I6 */
|
|
119
|
-
const fd = await p.evaluate(() => [...document.querySelectorAll('.nfd li')].map((li) => li.className + ': ' + li.textContent.replace(/\s+/g, ' ').trim()));
|
|
120
|
-
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));
|
|
121
|
-
ok('I6 no sentence gives a cause', !fd.some((x) => /forecast|because|caused|expected to/i.test(x)));
|
|
122
|
-
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), ask: document.querySelector('#askWhy').getAttribute('href') }));
|
|
123
|
-
ok('L1 the strip leads Goals: the days gone, the strongest finding and its reason; Ask why opens Home with the question', /days gone in Q4 2026/.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 && /^\/premium\.html\?ws=w1&ask=insights&q=Why/.test(hero.ask), JSON.stringify(hero));
|
|
124
|
-
/* I7 dialog */
|
|
125
|
-
await p.click('#tabGoals'); await p.click('#goalTbl [data-goal="krm-ttfc"] .nm'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
|
|
126
|
-
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: ['main.stage'].every((s) => document.querySelector(s).inert) }));
|
|
127
|
-
ok('I7 a goal row 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));
|
|
128
|
-
ok('I7 Escape closes it and focus returns', (await p.keyboard.press('Escape'), await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')))));
|
|
129
|
-
await p.locator('#dashBody [data-open]').filter({ hasText: 'Details' }).first().click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(300);
|
|
130
|
-
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); }));
|
|
131
|
-
ok('I7 the Details link of a chart opens that chart\'s dialog', (await txt('#dTitle')) === 'Partner activation');
|
|
132
|
-
await p.keyboard.press('Escape'); await sleep(300);
|
|
133
|
-
/* the agent is the read-only one: a question goes to the briefing route and nothing else posts */
|
|
160
|
+
/* G1 a goal's detail (IsGoal): Readings with the chart, its target and the ship date of the work that moves it; the readings; Add a reading through
|
|
161
|
+
* the KR metric route; Moved by; On your dashboards, whose switch saves that dashboard */
|
|
134
162
|
{
|
|
135
|
-
const R = await open()
|
|
136
|
-
await
|
|
137
|
-
await
|
|
138
|
-
await
|
|
139
|
-
|
|
163
|
+
const R = await open(), q = R.page, sent = [], saved = [];
|
|
164
|
+
await q.route('**/api/records/kr-metrics/reading', (r) => { sent.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
165
|
+
await q.route('**/api/premium-dashboards/save', (r) => { saved.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
166
|
+
await q.click('#goalTbl [data-goal="krm-act"] .nm');
|
|
167
|
+
const v = await until(() => vw(q));
|
|
168
|
+
const d = await q.evaluate(() => ({ kind: (document.querySelector('#czViewer .cz-vw-kind') || {}).textContent, tabs: [...document.querySelectorAll('#czViewer .ins-vtab')].map((t) => t.textContent + ':' + t.getAttribute('aria-selected')).join(), edit: !!document.querySelector('#czViewer [data-gx="chart"]'), sub: document.querySelector('#czViewer .ins-gsub').textContent, tg: (document.querySelector('#czViewer .ins-gch .tgl') || {}).textContent, ship: (document.querySelector('#czViewer .ins-gch .shipl') || {}).textContent, pts: document.querySelectorAll('#czViewer .ins-gch .pt').length, rows: document.querySelectorAll('#czViewer .ins-rd3').length, all: (document.querySelector('#czViewer [data-gx="all"]') || {}).textContent, moved: (document.querySelector('#czViewer [data-gx="moved"]') || {}).textContent, sw: [...document.querySelectorAll('#czViewer [data-gx="dash"]')].map((b) => b.getAttribute('aria-label') + ':' + b.getAttribute('aria-checked')).join(), dlg: !!document.querySelector('#dlg') }));
|
|
169
|
+
ok('G1 on All goals a goal press opens its detail: Readings and Moved by, Edit chart, the now and target line, and no "Waiting for design" (IsGoal)', v && v.title === 'Partner activation' && !v.wait && /^Goal · KR 1\.1/.test(d.kind) && d.tabs === 'Readings:true,Moved by:false' && d.edit && d.sub === '28% now · 50% by Dec 31' && !d.dlg, JSON.stringify([v, d]));
|
|
170
|
+
ok('G1 the chart draws each reading, the target with its value and the ship date of the work that moves it', d.tg === 'Target 50%' && d.ship === 'SSO for partners shipped' && d.pts === 4, JSON.stringify(d));
|
|
171
|
+
ok('G1 the newest three readings show with their source, then All 4 readings; Moved by names the work', d.rows === 3 && d.all === 'All 4 readings' && /^Moved by: SSO for partners, Self-serve onboarding v2$/.test(d.moved), JSON.stringify(d));
|
|
172
|
+
ok('G1 On your dashboards has a switch for each saved dashboard, on where the goal is', d.sw === 'On Weekly partner review:true', d.sw);
|
|
173
|
+
await q.click('#czViewer [data-gx="all"]'); ok('G1 All readings shows every reading', (await q.evaluate(() => document.querySelectorAll('#czViewer .ins-rd3').length)) === 4);
|
|
174
|
+
await q.click('#czViewer [data-gx="add"]'); await q.fill('#czViewer [data-rdf] [name="v"]', '31'); await q.click('#czViewer [data-rdf] button[type="submit"]'); await until(() => sent.length > 0, 4000);
|
|
175
|
+
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));
|
|
176
|
+
await until(() => q.evaluate(() => !!document.querySelector('#czViewer [data-gx="dash"]')), 4000);
|
|
177
|
+
await q.click('#czViewer [data-gx="dash"]'); await until(() => saved.length > 0, 4000);
|
|
178
|
+
ok('G1 the dashboard switch saves that dashboard without the goal', saved[0] && saved[0].id === 'pd-1' && saved[0].charts.join() === 'krm-ttfc,krm-gone' && saved[0].ws === 'w1', JSON.stringify(saved));
|
|
179
|
+
await q.click('#czViewer [data-gt="moved"]'); await sleep(100);
|
|
180
|
+
ok('G1 Moved by lists the initiatives on their lifecycle track', (await q.evaluate(() => document.querySelectorAll('#czViewer .ins-gb .ins-ini').length)) === 2);
|
|
181
|
+
await vwClose(q);
|
|
182
|
+
await q.click('#goalTbl [data-goal="krm-nps"] .nm'); await until(() => vw(q));
|
|
183
|
+
const e1 = await txt('#czViewer .ins-etr', q);
|
|
184
|
+
ok('G1 a goal with one reading says a trend needs 2 readings and where the next comes from, with Add a reading (IsMenus)', /A trend needs 2 readings\./.test(e1) && /Add a reading/.test(e1), e1);
|
|
140
185
|
await R.ctx.close();
|
|
141
186
|
}
|
|
142
|
-
/*
|
|
143
|
-
await p.click("#tabLibrary"); 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);
|
|
144
|
-
await p.click('#tabLibrary');
|
|
145
|
-
const rp = await p.evaluate(() => ({ rows: [...document.querySelectorAll('#listRows [data-rpt]')].map((r) => r.querySelector('.nm b').textContent + ' / ' + r.querySelector('.ins-dots + small').textContent), note: document.querySelector('#repFold').textContent, cap: document.querySelector('#repCap').textContent, setups: document.querySelectorAll('#listRows [data-setup]').length, dash: document.querySelectorAll('#listRows [data-d]').length }));
|
|
146
|
-
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 === '9', JSON.stringify(rp));
|
|
147
|
-
await (async (pg, sel) => { if (await pg.locator('#listSeg').isHidden()) await pg.click('#listF'); await pg.click(sel); })(p, '#listSeg [data-f="all"]');
|
|
148
|
-
{ const R = await open(); await R.page.click('#tabLibrary'); 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());
|
|
149
|
-
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"]')));
|
|
150
|
-
await R.ctx.close(); }
|
|
151
|
-
/* I9 labels */
|
|
152
|
-
ok('I9 no demo label, and the foot says where every number comes from and what a press records', !(await p.evaluate(() => /demo/i.test(document.querySelector('main.stage').textContent))) && /every number on this page is a reading of it/.test(await txt('#foot')) && /Delivery trends target/.test(await txt('#foot')) && /Real data/.test(await txt('#snap')));
|
|
153
|
-
ok('I9 the page makes no write request on its own', A.posts.length === 0, A.posts.join());
|
|
154
|
-
/* I10 empty */
|
|
187
|
+
/* G1 the period (AgInsPeriod) */
|
|
155
188
|
{
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
189
|
+
const chip = await p.evaluate(() => ({ name: document.querySelector('#perName').textContent, sub: document.querySelector('#perSub').textContent }));
|
|
190
|
+
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 }));
|
|
191
|
+
await p.click('#perMenu [data-per="lq"]'); await sleep(150);
|
|
192
|
+
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 }));
|
|
193
|
+
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));
|
|
194
|
+
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));
|
|
195
|
+
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));
|
|
196
|
+
await p.click('#perChip'); await p.click('#perMenu [data-per="q"]'); await sleep(100);
|
|
197
|
+
await p.click('#tabOutcomes'); const os1 = await txt('#perSub'); await p.click('#tabGoals'); const os2 = await txt('#perSub');
|
|
198
|
+
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]));
|
|
199
|
+
}
|
|
200
|
+
/* G1 the filter */
|
|
201
|
+
{
|
|
202
|
+
await p.click('#filtB'); await p.click('#filtMenu [data-fk="owner"][data-fv="Dara"]'); await p.keyboard.press('Escape'); await sleep(100);
|
|
203
|
+
const f = await p.evaluate(() => ({ rows: [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => r.dataset.goal).join(), dot: !document.querySelector('#filtDot').hidden }));
|
|
204
|
+
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));
|
|
205
|
+
await p.click('#filtB'); await p.click('#filtMenu [data-fclr]'); await sleep(100);
|
|
206
|
+
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));
|
|
207
|
+
}
|
|
208
|
+
/* G1 Delivery trends: six compact tiles from the Board's measures, honest where a measure is not counted */
|
|
209
|
+
{
|
|
210
|
+
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);
|
|
211
|
+
/* 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 */
|
|
212
|
+
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));
|
|
213
|
+
}
|
|
214
|
+
{
|
|
215
|
+
const R = await open(), q = R.page, sent = [];
|
|
216
|
+
await q.route(/\/api\/(board-metric-targets\/save|insights-records\/target|insights-records\/tile)/, (r) => { sent.push([new URL(r.request().url()).pathname, JSON.parse(r.request().postData() || '{}')]); r.fulfill({ contentType: 'application/json', body: '{"ok":true,"targets":{}}' }); });
|
|
217
|
+
await q.click('#bmBody [data-tile="merges"]'); await until(() => q.evaluate(() => !!document.querySelector('#tgPop')));
|
|
218
|
+
const pop = await q.evaluate(() => ({ h: document.querySelector('#tgPop .ins-h3').textContent, dirs: [...document.querySelectorAll('#tgPop [data-v]')].map((b) => b.textContent + ':' + b.getAttribute('aria-pressed')).join(), range: document.querySelector('#tgPop p.note').textContent, chip: document.querySelector('#tgChip').getAttribute('aria-checked'), tile: document.querySelector('#bmBody [data-tile="merges"]').getAttribute('aria-expanded'), say: document.querySelector('#bmBody [data-tile="merges"] .tg').textContent, viewer: !!document.querySelector('#czViewer:not([hidden])') }));
|
|
219
|
+
ok('G1 a tile press opens its target over the tiles: At least (more merges is better), At most or No target, the tile\'s range, the Board chip (IsTarget)', pop.h === 'Target for merged a week' && pop.dirs === 'At least:true,At most:false,No target:false' && /^Last 3 weeks: 150 to 174, median 160\./.test(pop.range) && /amber only after 2 weeks/.test(pop.range) && pop.chip === 'true' && pop.tile === 'true' && pop.say === 'Setting target…' && !pop.viewer, JSON.stringify(pop));
|
|
220
|
+
await q.fill('#tgV', '150'); await q.fill('#tgFrom', '2026-10-19'); await q.click('#tgSet'); await until(() => sent.length > 1, 4000);
|
|
221
|
+
ok('G1 Set target sends the number to the Board\'s target route and how it is read to the page\'s own records', sent[0][0] === '/api/board-metric-targets/save' && sent[0][1].key === 'merges' && sent[0][1].target === 150 && sent[1][0] === '/api/insights-records/tile' && sent[1][1].dir === 'at least' && sent[1][1].from === '2026-10-19' && sent[1][1].chip === true && await until(() => q.evaluate(() => !document.querySelector('#tgPop')), 5000), JSON.stringify(sent)); // the popover closes once both saves answer
|
|
222
|
+
await q.click('#bmBody [data-tile="late"]'); await until(() => q.evaluate(() => !!document.querySelector('#tgPop')));
|
|
223
|
+
await q.fill('#tgV', '0'); await q.click('#tgChip'); await q.click('#tgSet'); await until(() => sent.length > 3, 4000);
|
|
224
|
+
ok('G1 the Late initiatives target is kept in the page\'s own records, at most by default, and the chip can be left off', sent[2] && sent[2][0] === '/api/insights-records/target' && sent[2][1].key === 'late' && sent[2][1].target === 0 && sent[3][1].dir === 'at most' && sent[3][1].chip === false, JSON.stringify(sent));
|
|
225
|
+
await q.click('#bmBody [data-tile="idle"]'); await until(() => q.evaluate(() => !!document.querySelector('#tgPop'))); await q.click('#tgPop [data-v="none"]'); await q.click('#tgSet'); await until(() => sent.length > 5, 4000);
|
|
226
|
+
ok('G1 No target clears the number', sent[4][1].key === 'idle' && sent[4][1].target === null && sent[5][1].dir === 'none', JSON.stringify(sent.slice(4)));
|
|
227
|
+
await q.click('#bmBody [data-tile="scope"]'); await until(() => q.evaluate(() => !!document.querySelector('#tgPop'))); await q.keyboard.press('Escape');
|
|
228
|
+
ok('G1 Escape closes the target and gives the tile its focus back', await q.evaluate(() => !document.querySelector('#tgPop') && document.activeElement && document.activeElement.dataset.tile === 'scope'));
|
|
229
|
+
await q.click('#viewChip'); await q.click('#viewMenu [data-view="trends"]'); await sleep(150);
|
|
230
|
+
const tv = await q.evaluate(() => { const T = [...document.querySelectorAll('#bmBody [data-tile]')].map((t) => t.getBoundingClientRect()); return { name: document.querySelector('#viewName').textContent, h: document.querySelector('.ins-trends.big h2').textContent, rows: document.querySelectorAll('#goalTbl [data-goal]').length, cols: T.filter((t) => Math.abs(t.top - T[0].top) < 2).length, tg: [...document.querySelectorAll('#bmBody .tg')].map((x) => x.textContent).join('|') }; });
|
|
231
|
+
ok('G1 Delivery trends is a view of its own: the six tiles three to a row, each with its target line', tv.name === 'Delivery trends' && tv.h === 'Delivery trends' && tv.rows === 0 && tv.cols === 3 && tv.tg.split('|').length === 6, JSON.stringify(tv));
|
|
159
232
|
await R.ctx.close();
|
|
160
|
-
const R2 = await open({ model: mk({ reportsOk: false, reports: [], missing: ['reports'] }) });
|
|
161
|
-
ok('I10 reports that could not be read are said to be unread, not empty', await R2.page.click('#tabLibrary') || await R2.page.evaluate(() => /report files could not be read/.test(document.querySelector('#repBody').textContent) && /not read: reports/.test(document.querySelector('#snap').textContent)));
|
|
162
|
-
await R2.ctx.close();
|
|
163
233
|
}
|
|
164
|
-
/* I2 failed read */
|
|
165
234
|
{
|
|
166
|
-
const
|
|
167
|
-
await
|
|
168
|
-
|
|
169
|
-
ok('
|
|
170
|
-
await
|
|
235
|
+
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' } : {})) }) });
|
|
236
|
+
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; });
|
|
237
|
+
/* re-pointed (insights fix): the target is said in the tile's label and title, not as a line under the value */
|
|
238
|
+
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: at most 0:true' && /^2:/.test(t[1]) && await R.page.evaluate(() => !!document.querySelector('#bmBody [data-tile="scope"] svg')), JSON.stringify(t));
|
|
239
|
+
await R.ctx.close();
|
|
240
|
+
}
|
|
241
|
+
{
|
|
242
|
+
const R = await open({ bm: { ok: false, state: 'error', error: 'boom' } });
|
|
243
|
+
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);
|
|
244
|
+
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));
|
|
245
|
+
await R.ctx.close();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* L1 the strip */
|
|
249
|
+
{ 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') }));
|
|
250
|
+
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));
|
|
251
|
+
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());
|
|
171
252
|
}
|
|
172
253
|
|
|
173
|
-
/*
|
|
254
|
+
/* D: New dashboard (AgInsNewDash), describe, the saved view, Edit chart (AgInsChart) and the pin */
|
|
174
255
|
{
|
|
175
256
|
const R = await open(), q = R.page, sent = [];
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
257
|
+
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'] }
|
|
258
|
+
: /dashboard$/.test(u) ? { ok: true, id: 'pd-9', dashboard: { id: 'pd-9' }, pinned: b.pin ? 'pd-9' : null } : { ok: true });
|
|
259
|
+
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)) }); });
|
|
179
260
|
const last = () => sent[sent.length - 1] || [null, {}];
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
await
|
|
187
|
-
const
|
|
188
|
-
ok('
|
|
189
|
-
await q.
|
|
190
|
-
await q.
|
|
191
|
-
|
|
192
|
-
await q.click('#
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
await q.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
await q.
|
|
205
|
-
ok('
|
|
206
|
-
|
|
207
|
-
await q.
|
|
208
|
-
ok('
|
|
209
|
-
await q.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
await q.click('#
|
|
213
|
-
ok('
|
|
214
|
-
await q.
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
ok('
|
|
219
|
-
&& await q.evaluate(() => { const f = document.querySelector('#repAsk'); return !!(f.querySelector('#listNew') && f.querySelector('#repAskIn') && f.querySelector('#repAskGo')); }), JSON.stringify([i0, i1]));
|
|
220
|
-
await q.click('#repAsks [data-ask="a-1"]'); await dlgOn(); await q.click('#oMain [data-rx="chg"]'); await sleep(100);
|
|
221
|
-
ok('R3 Change it needs words first', /Say what to change/.test(await qt('#rxM')));
|
|
222
|
-
await q.fill('#rxChg', 'quarterly'); await q.click('#oMain [data-rx="chg"]'); await sleep(300);
|
|
223
|
-
ok('R3 Change it posts the correction for that request', last()[0] === '/api/report-setups/change' && last()[1].id === 'a-1' && last()[1].text === 'quarterly', JSON.stringify(last()));
|
|
224
|
-
await q.click('#repAsks [data-ask="a-2"]'); await dlgOn();
|
|
225
|
-
ok('R3 a running request says it is working and offers only Cancel', /background run is working/.test(await qt('#oMain')) && (await q.evaluate(() => [...document.querySelectorAll('#oMain [data-rx]')].map((b) => b.dataset.rx).join())) === 'cancel');
|
|
226
|
-
await shut();
|
|
227
|
-
await q.click('#repBody [data-setup="partner-update"]'); await dlgOn();
|
|
228
|
-
const su = await q.evaluate(() => ({ kv: document.querySelector('#oMain .kv2').textContent, acts: [...document.querySelectorAll('#oMain [data-rx]')].map((b) => b.dataset.rx).join() }));
|
|
229
|
-
ok('R4 a set-up report shows its schedule and next draft, with Draft it now, Pause and Shape it in a chat', /ScheduleEvery other Monday at 09:00/.test(su.kv) && /Next draft26 Oct/.test(su.kv) && su.acts === 'draft,pause,studio', JSON.stringify(su));
|
|
230
|
-
await q.click('#oMain [data-rx="pause"]'); await sleep(300);
|
|
231
|
-
ok('R4 Pause posts that report', last()[0] === '/api/report-setups/pause' && last()[1].id === 'partner-update', JSON.stringify(last()));
|
|
232
|
-
ok('R7 every press went to the dashboard save route or an existing report-setups route; an opened popup is only recorded (seen)', R.posts.every((x) => /^POST \/api\/(premium-dashboards\/save|report-setups\/(ask|change|cancel|setup|dismiss|pause|resume|draft)|briefing-premium\/seen)$/.test(x)), R.posts.join());
|
|
233
|
-
ok('R6 the Reports card shows no demo row', !/demo/i.test(await qt('#repBody')));
|
|
261
|
+
await q.click('#newB'); await q.click('#newMenu [data-new="dash"]'); await sleep(150);
|
|
262
|
+
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 }));
|
|
263
|
+
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));
|
|
264
|
+
await q.fill('#ndAskIn', 'Are partners getting value? activation and uptime over 8 weeks'); await q.press('#ndAskIn', 'Enter'); await sleep(300);
|
|
265
|
+
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
|
|
266
|
+
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));
|
|
267
|
+
await q.click('#goalTbl [data-goal="krm-ttfc"] .nm');
|
|
268
|
+
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') }));
|
|
269
|
+
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));
|
|
270
|
+
await q.focus('#ndList [data-pk="krm-ttfc"]'); await q.keyboard.press('Alt+ArrowUp'); await sleep(100);
|
|
271
|
+
const ord = await q.evaluate(() => [...document.querySelectorAll('#ndList [data-pk]')].map((r) => r.dataset.pk).join());
|
|
272
|
+
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
|
|
273
|
+
await q.click('#ndAdd'); await q.selectOption('#ndAddSel', 'krm-churn'); await sleep(100);
|
|
274
|
+
const ord2 = await q.evaluate(() => [...document.querySelectorAll('#ndList [data-pk]')].map((r) => r.dataset.pk).join());
|
|
275
|
+
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]));
|
|
276
|
+
await q.click('#ndList [data-pk="krm-up"] [data-v="Bars"]'); await q.click('#sideBody [data-seg="Range"] [data-v="26w"]');
|
|
277
|
+
await q.fill('#ndQ', ''); await q.click('#sideGo'); const need = await txt('#sideMsg', q); await q.fill('#ndQ', 'Are partners getting value?');
|
|
278
|
+
await q.click('#ndPin'); sent.length = 0; await q.click('#sideGo'); await until(() => q.evaluate(() => document.querySelector('#side').hidden), 5000);
|
|
279
|
+
const sv = sent.find((x) => /dashboard$/.test(x[0]));
|
|
280
|
+
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]));
|
|
281
|
+
sent.length = 0;
|
|
282
|
+
/* the saved view and Edit chart */
|
|
283
|
+
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));
|
|
284
|
+
await q.click('#viewChip'); await q.click('#viewMenu [data-view="pd-1"]'); await sleep(150);
|
|
285
|
+
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 }));
|
|
286
|
+
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));
|
|
287
|
+
await q.click('#goalTbl [data-goal="krm-ttfc"] .nm'); await sleep(150);
|
|
288
|
+
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 }));
|
|
289
|
+
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));
|
|
290
|
+
ok('D2 the preview is drawn in the chart\'s form', await q.evaluate(() => document.querySelectorAll('#chPrev svg.ins-ch2 rect').length > 0));
|
|
291
|
+
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);
|
|
292
|
+
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()));
|
|
293
|
+
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);
|
|
294
|
+
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()));
|
|
295
|
+
await q.click('#goalTbl [data-goal="krm-act"] .nm'); await sleep(100); await q.click('#chMore');
|
|
296
|
+
const cm = await q.evaluate(() => [...document.querySelectorAll('#chMenu button')].map((b) => b.textContent.replace(/\s+/g, ' ') + ':' + (b.disabled ? 'off' : 'on')).join('|'));
|
|
297
|
+
await q.click('#chRemove'); await until(() => q.evaluate(() => document.querySelector('#side').hidden), 5000);
|
|
298
|
+
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()]));
|
|
299
|
+
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());
|
|
234
300
|
await R.ctx.close();
|
|
235
301
|
}
|
|
236
302
|
|
|
237
|
-
/*
|
|
303
|
+
/* O: Outcomes (AgInsOutcomes) and the verdict (AgInsVerdict) */
|
|
238
304
|
{
|
|
239
|
-
const R = await open(
|
|
240
|
-
await q.route('**/api/
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
ok('
|
|
244
|
-
|
|
245
|
-
ok('
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
await
|
|
250
|
-
|
|
251
|
-
await
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
305
|
+
const R = await open(), q = R.page, sent = [];
|
|
306
|
+
await q.route('**/api/insights-records/verdict', (r) => { sent.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
307
|
+
await q.click('#tabOutcomes');
|
|
308
|
+
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 }));
|
|
309
|
+
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);
|
|
310
|
+
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));
|
|
311
|
+
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
|
|
312
|
+
await R.ctx.close();
|
|
313
|
+
const R2 = await open({ model: mk({ goalMeta: { 'krm-up': { guardrail: 'Partner activation must not get worse' } } }) });
|
|
314
|
+
await R2.page.click('#tabOutcomes');
|
|
315
|
+
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));
|
|
316
|
+
await R2.ctx.close();
|
|
317
|
+
const R3 = await open(), q3 = R3.page;
|
|
318
|
+
await q3.route('**/api/insights-records/verdict', (r) => { sent.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
319
|
+
await q3.click('#tabOutcomes'); await q3.click('#outTbl [data-verdict]'); await sleep(150);
|
|
320
|
+
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(' ') }; });
|
|
321
|
+
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));
|
|
322
|
+
const u0 = q3.url(); await q3.click('#sideBody [data-vd="Keep"]'); await q3.click('#sideGo'); const need = await txt('#sideMsg', q3);
|
|
323
|
+
await q3.fill('#vdLearn', 'Codes work.'); await q3.click('#sideGo'); await until(() => sent.length > 0, 4000); await sleep(200);
|
|
324
|
+
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]));
|
|
325
|
+
await R3.ctx.close();
|
|
326
|
+
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: {} } }) });
|
|
327
|
+
await R4.page.click('#tabOutcomes');
|
|
328
|
+
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, ' ') }));
|
|
329
|
+
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));
|
|
330
|
+
await R4.ctx.close();
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/* L: Library (AgInsLibrary) and the report reader */
|
|
334
|
+
{
|
|
335
|
+
const R = await open(), q = R.page;
|
|
336
|
+
await q.click('#tabLibrary');
|
|
337
|
+
/* re-pointed (premium-uncovered-features, IsLibrary): the bar hands New report to Home, Found in your work is cards, the reports are Report · Next · Status */
|
|
338
|
+
const lb = await q.evaluate(() => ({ note: document.querySelector('#pLibrary .ins-lnote').textContent, nr: document.querySelector('#newRep').getAttribute('href'), found: document.querySelector('#listRows .ins-fdh b').textContent, fcards: [...document.querySelectorAll('#listRows .ins-fcard')].map((c) => c.dataset.f + ':' + [...c.querySelectorAll('.ins-btn[data-fx]')].map((b) => b.textContent).join('/')).join(), heads: [...document.querySelectorAll('#repAsks .ins-rlh span')].map((s) => s.textContent).join('|'), rows: [...document.querySelectorAll('#listRows .ins-rl:not(.ins-rlh)')].map((r) => r.querySelector('.nm b').textContent + '|' + r.querySelector('.nx').textContent + '|' + r.querySelector('.st').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, old: !!document.querySelector('#listSeg, #sugB') }));
|
|
339
|
+
ok('L1 Library: reports are made in Home, New report in Home hands off there, and Found in your work holds the finding as a card', /Reports are made in Home/.test(lb.note) && /^\/premium\.html\?ws=w1&ask=insights&q=Make%20a%20new%20report/.test(lb.nr) && lb.found === 'Found in your work · 1' && lb.fcards === 'f-1:Set it up/Not a report' && lb.cap === '9' && !lb.old, JSON.stringify(lb));
|
|
340
|
+
ok('L1 the reports table is Report, Next and Status; a draft says "Draft ready for" its date; a request says Proposal or Working', lb.heads === 'Report|Next|Status' && /Draft ready for Oct 14/.test(lb.rows) && /Partner update\|First draft [^|]+\|Runs every other monday/i.test(lb.rows) && /Churn for finance\|—\|Proposal/.test(lb.rows) && lb.setups === 1 && lb.asks === 2, JSON.stringify(lb.rows));
|
|
341
|
+
ok('L1 dashboards are cards; only the pinned one carries the pin', lb.cards === 'all*,pd-1,p:Growth,p:Reliability', lb.cards);
|
|
342
|
+
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"}}' }); });
|
|
343
|
+
const lastRs = () => rs[rs.length - 1] || [null, {}];
|
|
344
|
+
await q.click('#listRows [data-f="f-1"] [data-fx="open"]'); const s1 = await until(() => vw(q));
|
|
345
|
+
ok('L2 a finding opens what PMOS found, with why, its evidence and the report it would set up, and no "Waiting for design"', s1 && !s1.wait && s1.title === 'Release readiness' && /3 times in 6 weeks/.test(s1.text) && /The report it would set up/.test(s1.text), JSON.stringify(s1));
|
|
346
|
+
await vwClose(q);
|
|
347
|
+
await q.click('#listRows [data-f="f-1"] [data-fx="dismiss"]'); await sleep(150);
|
|
348
|
+
const nr = await q.evaluate(() => ({ gone: !document.querySelector('#listRows [data-f="f-1"]'), toast: document.querySelector('#toast').textContent }));
|
|
349
|
+
await q.click('#toast .cta'); await sleep(150);
|
|
350
|
+
ok('L2 Not a report takes the card off at once with Undo, posts nothing yet, and Undo brings it back (IsLibrary)', nr.gone && /^Not a report · Release readiness/.test(nr.toast) && /Undo/.test(nr.toast) && rs.length === 0 && await q.evaluate(() => !!document.querySelector('#listRows [data-f="f-1"]')), JSON.stringify([nr, rs]));
|
|
351
|
+
await q.click('#listRows [data-f="f-1"] [data-fx="setup"]'); await until(() => rs.length > 0, 4000);
|
|
352
|
+
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));
|
|
353
|
+
await q.click('#listRows [data-setup]'); const s2 = await until(() => vw(q));
|
|
354
|
+
const sv = await q.evaluate(() => ({ tabs: [...document.querySelectorAll('#czViewer .ins-vtab')].map((t) => t.textContent).join(), sel: !!document.querySelector('#listRows .ins-rl.sel[data-setup]'), change: (document.querySelector('#czViewer a.ins-btn') || {}).getAttribute ? document.querySelector('#czViewer a.ins-btn').getAttribute('href') : '' }));
|
|
355
|
+
await q.click('#czViewer [data-sx="pause"]'); await until(() => rs.length > 1, 4000);
|
|
356
|
+
ok('L2 a report setup opens in the Viewer with Setup, Issues and Brief, its schedule and next draft; Pause posts it; Change the setup goes to Home', s2 && !s2.wait && /Every other Monday at 09:00/.test(s2.text) && /PMOS drafts it, you issue it/.test(s2.text) && sv.tabs === 'Setup,Issues,Brief' && sv.sel && /ask=insights&q=Change%20the%20setup%20of%20Partner%20update/.test(sv.change) && lastRs()[0] === 'pause' && lastRs()[1].id === 'partner-update', JSON.stringify([s2, sv, rs]));
|
|
357
|
+
await q.click('#czViewer [data-st="brief"]'); await sleep(80);
|
|
358
|
+
ok('L2 its Brief says what it is for and for whom', /What moved for partners this fortnight/.test(await txt('#czViewer .ins-gb', q)) && /Leadership/.test(await txt('#czViewer .ins-gb', q)));
|
|
359
|
+
await vwClose(q);
|
|
360
|
+
await q.click('#listRows [data-ask="a-1"]'); const s3 = await until(() => vw(q));
|
|
361
|
+
await q.click('#czViewer [data-act="chg"]'); await q.click('#czViewer [data-act="change"]'); const need = await txt('#czViewer [data-msg]', q);
|
|
362
|
+
await q.fill('#czViewer [data-chg]', 'quarterly'); await q.click('#czViewer [data-act="change"]'); await until(() => rs.length > 2, 4000);
|
|
363
|
+
ok('L2 a request from Home opens with what you asked and its proposal; Change it needs words, then posts the correction', s3 && !s3.wait && /A request from Home/.test(s3.text) && /A monthly churn report for finance/.test(s3.text) && /Set it up/.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]));
|
|
364
|
+
await vwClose(q);
|
|
365
|
+
ok('L2 every Library press went to a report-setups route', R.posts.every((x) => /^POST \/api\/report-setups\/(setup|pause|change)$/.test(x)), R.posts.join());
|
|
366
|
+
await q.click('#listRows [data-d="p:Reliability"]'); await sleep(150);
|
|
367
|
+
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');
|
|
368
|
+
await q.click('#tabLibrary'); await q.locator('#listRows [data-rpt]').first().click(); // a report file with no setup opens straight in the reader
|
|
369
|
+
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());
|
|
370
|
+
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"]')));
|
|
255
371
|
await R.ctx.close();
|
|
256
372
|
const lead = { 'planning/reports/biweekly/2026-10-14.md': 'Activation slipped to 28% this fortnight.' };
|
|
257
373
|
const R2 = await open({ model: mk({ leads: lead }) });
|
|
258
374
|
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 }));
|
|
259
|
-
ok('
|
|
375
|
+
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));
|
|
260
376
|
await R2.ctx.close();
|
|
261
377
|
}
|
|
262
378
|
|
|
263
|
-
/*
|
|
264
|
-
|
|
265
|
-
const R = await open(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
await q.
|
|
269
|
-
const
|
|
270
|
-
|
|
379
|
+
/* W: New goal (AgInsNewGoal): every field the form shows is posted; the route checks it (lib/insights-goals.js goalFields, its own unit checks) */
|
|
380
|
+
{
|
|
381
|
+
const R = await open(), q = R.page, sent = [];
|
|
382
|
+
let answer = { ok: true, rid: 'krm-new' };
|
|
383
|
+
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) }); });
|
|
384
|
+
await q.click('#newB'); await q.click('#newMenu [data-new="goal"]'); await sleep(100);
|
|
385
|
+
const vis = () => q.evaluate(() => [...document.querySelectorAll('#sideBody [data-for]')].filter((x) => !x.hidden).map((x) => x.dataset.for).join('|'));
|
|
386
|
+
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 }));
|
|
387
|
+
const v0 = await vis();
|
|
388
|
+
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]));
|
|
389
|
+
await q.click('#sideBody [data-seg="Type"] [data-v="Done or not"]'); const v1 = await vis();
|
|
390
|
+
await q.click('#sideBody [data-seg="Type"] [data-v="Stay within"]'); const v2 = await vis(); const lab = await txt('#sideBody [data-lab="tgt"]', q);
|
|
391
|
+
await q.click('#ngAlways'); const v3 = await vis();
|
|
392
|
+
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]));
|
|
393
|
+
await q.click('#sideBody [data-seg="Type"] [data-v="Count"]');
|
|
394
|
+
await q.fill('#ngName', 'Weekly active partners'); await q.fill('#ngBase', '10'); await q.fill('#ngTgt', '40');
|
|
395
|
+
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 });
|
|
396
|
+
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);
|
|
397
|
+
const refused = await txt('#sideMsg', q);
|
|
398
|
+
answer = { ok: true, rid: 'krm-new' }; await q.click('#sideGo'); await until(() => sent.length > 1, 4000); await sleep(200);
|
|
399
|
+
const b = sent[1] || {};
|
|
400
|
+
ok('W1 a refusal from the route is said in the panel and the panel stays open', /target must be above/.test(refused), refused);
|
|
401
|
+
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));
|
|
402
|
+
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);
|
|
403
|
+
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]));
|
|
271
404
|
await R.ctx.close();
|
|
272
405
|
}
|
|
406
|
+
|
|
407
|
+
/* I10 empty and unread */
|
|
273
408
|
{
|
|
274
|
-
const R = await open(
|
|
275
|
-
ok('
|
|
409
|
+
const R = await open({ model: mk({ outcomes: [] }) });
|
|
410
|
+
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 === ''));
|
|
411
|
+
await R.ctx.close();
|
|
412
|
+
const R2 = await open({ model: mk({ reportsOk: false, reports: [], missing: ['reports'] }) });
|
|
413
|
+
await R2.page.click('#tabLibrary');
|
|
414
|
+
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)));
|
|
415
|
+
await R2.ctx.close();
|
|
416
|
+
}
|
|
417
|
+
/* I2 failed read */
|
|
418
|
+
{
|
|
419
|
+
const c2 = await browser.newContext({ viewport: { width: 1280, height: 900 } }), p2 = await c2.newPage();
|
|
420
|
+
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' }) }));
|
|
421
|
+
await p2.goto(BASE + '/premium-insights.html');
|
|
422
|
+
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));
|
|
423
|
+
await c2.close();
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/* I11 the phone (AgInsPhone) and the floors */
|
|
427
|
+
for (const theme of ['light', 'dark']) {
|
|
428
|
+
const R = await open({ w: 390, h: 844, theme }), q = R.page;
|
|
429
|
+
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 */
|
|
430
|
+
const hit = (b) => Math.max(b.getBoundingClientRect().height, parseFloat(getComputedStyle(b, '::after').height) || 0);
|
|
431
|
+
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)));
|
|
432
|
+
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() }; });
|
|
433
|
+
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));
|
|
276
434
|
await R.ctx.close();
|
|
277
435
|
}
|
|
278
436
|
|
|
@@ -286,31 +444,31 @@ const mk = (o) => IP.build(F.facts(Object.assign({ pinned: 'all' }, o))); // A
|
|
|
286
444
|
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), pg = await ctx.newPage(), errs = [];
|
|
287
445
|
pg.on('pageerror', (e) => errs.push(String(e)));
|
|
288
446
|
await pg.goto(BASE + '/premium-insights.html');
|
|
289
|
-
ok('E4 the real page says there is
|
|
447
|
+
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(' | '));
|
|
290
448
|
await ctx.close();
|
|
291
449
|
}
|
|
292
450
|
{
|
|
293
451
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ins-repo-'));
|
|
294
452
|
fs.mkdirSync(path.join(dir, 'planning', 'records'), { recursive: true });
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
{ id:
|
|
453
|
+
const LG = require('../scripts/trust/ledger.js'), U = (i) => LG.newId(1.7e12 + i * 1000); // the ledger is append-only by ULID
|
|
454
|
+
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: '%' } },
|
|
455
|
+
{ 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 } },
|
|
456
|
+
{ 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 } }];
|
|
298
457
|
fs.writeFileSync(path.join(dir, 'planning', 'records', 'kr-metrics.jsonl'), L.map((x) => JSON.stringify(x)).join('\n') + '\n');
|
|
299
458
|
const port2 = T.port(), base2 = `http://${require('./test-run').HOST}:${port2}`;
|
|
300
459
|
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-')) }) });
|
|
301
460
|
await T.waitForServer(base2);
|
|
302
461
|
const j = await (await fetch(base2 + '/api/insights-premium')).json(); const m = j.model;
|
|
303
|
-
ok('E5 a scratch repository\'s KR metric records reach the page model: one
|
|
462
|
+
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));
|
|
304
463
|
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));
|
|
305
464
|
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), pg = await ctx.newPage(), errs = [];
|
|
306
465
|
pg.on('pageerror', (e) => errs.push(String(e)));
|
|
307
466
|
await pg.goto(base2 + '/premium-insights.html');
|
|
308
|
-
ok('E7 the real page draws that
|
|
309
|
-
/* briefing-premium-reports against the real server: New dashboard, Save, the switch, then the ledger answers it back */
|
|
467
|
+
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(' | '));
|
|
310
468
|
const H = await T.pressHeaders(base2);
|
|
311
469
|
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);
|
|
312
470
|
await pg.reload();
|
|
313
|
-
ok('E8 a dashboard saved as the main one
|
|
471
|
+
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));
|
|
314
472
|
const j2 = await (await fetch(base2 + '/api/insights-premium')).json(), d2 = j2.model.dashboards.find((d) => d.saved);
|
|
315
473
|
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));
|
|
316
474
|
const body = JSON.stringify({ ws: m.board.ws, board: m.board.id, name: 'From an agent', purpose: 'x', charts: [] });
|
|
@@ -318,40 +476,77 @@ const mk = (o) => IP.build(F.facts(Object.assign({ pinned: 'all' }, o))); // A
|
|
|
318
476
|
const noNonce = await fetch(base2 + '/api/premium-dashboards/save', { method: 'POST', headers: { 'Content-Type': 'application/json', Origin: base2 }, body }).then((x) => x.status);
|
|
319
477
|
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);
|
|
320
478
|
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());
|
|
479
|
+
/* New goal against the real route: the record lands in the scratch repository with every field the page sent */
|
|
480
|
+
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');
|
|
481
|
+
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');
|
|
482
|
+
const krFile = path.join(dir, 'planning', 'records', 'kr-metrics.jsonl'), recs = () => fs.readFileSync(krFile, 'utf8').trim().split('\n').map((x) => JSON.parse(x));
|
|
483
|
+
const landed = await until(() => /Weekly partners/.test(fs.readFileSync(krFile, 'utf8')), 8000);
|
|
484
|
+
const rec = landed ? recs().find((x) => x.fields && x.fields.metric === 'Weekly partners') : null;
|
|
485
|
+
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));
|
|
486
|
+
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() }));
|
|
487
|
+
const bad1 = await post('goal', { name: 'Wrong way', type: 'Count', direction: 'Up', baseline: 9, target: 5, due: '2026-12-31' });
|
|
488
|
+
const done = await post('goal', { name: 'SOC 2 report', type: 'Done or not', due: '2026-12-15', steps: ['Scope', 'Audit'] });
|
|
489
|
+
const tick = await post('steps', { rid: done.body.rid, done: [true, false] });
|
|
490
|
+
const doneRec = recs().filter((x) => x.rid === done.body.rid);
|
|
491
|
+
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)]));
|
|
492
|
+
const dsc = await post('describe', { text: 'How is partner activation doing?' });
|
|
493
|
+
const dsh = await post('dashboard', { name: 'Activation weekly', purpose: 'How is activation doing?', charts: [{ goal: 'krm-a', form: 'Bars' }], range: '8w', pin: true });
|
|
494
|
+
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' });
|
|
495
|
+
const vd = await post('verdict', { ini: 'nothing-shipped', verdict: 'Keep', learned: 'It held.' });
|
|
496
|
+
const tg = await post('target', { key: 'scope', target: 3 });
|
|
497
|
+
const asAgent2 = await post('verdict', { ini: 'x', verdict: 'Keep', learned: 'y' }, { ...H, 'x-pmos-session': 's1' });
|
|
498
|
+
const j3 = await (await fetch(base2 + '/api/insights-premium')).json(), m3 = j3.model;
|
|
499
|
+
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
|
|
500
|
+
&& 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]));
|
|
501
|
+
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() }));
|
|
502
|
+
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));
|
|
321
503
|
await ctx.close();
|
|
322
504
|
}
|
|
323
505
|
|
|
324
|
-
/*
|
|
506
|
+
/* M: Portfolio (IsMenus): with two products the picker counts each one's goals and rolls them up, grouped by product */
|
|
507
|
+
{
|
|
508
|
+
const two = [{ ws: 'w1', id: 'w1', name: 'pmos', goals: 5 }, { ws: 'w2', id: 'w2', name: 'Billing', goals: 1 }];
|
|
509
|
+
const other = IP.build(F.facts({ board: { ws: 'w2', id: 'w2', name: 'Billing' }, boards: two, outcomes: F.facts().outcomes.slice(0, 1).map((o) => Object.assign({}, o, { id: 'krm-inv', name: 'Invoices paid on time' })), initiatives: [], saved: [] }));
|
|
510
|
+
const R = await open({ model: mk({ boards: two }) }), q = R.page, asked = [];
|
|
511
|
+
await q.route('**/api/insights-premium?ws=w2*', (r) => { asked.push(r.request().url()); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: other }) }); });
|
|
512
|
+
await q.click('#prodPick'); const pm = await q.evaluate(() => ({ items: [...document.querySelectorAll('#prodMenu [data-board]')].map((b) => b.textContent).join(), pf: (document.querySelector('#prodMenu [data-portfolio]') || {}).textContent, note: (document.querySelector('#prodMenu .ins-mnote') || {}).textContent }));
|
|
513
|
+
ok('M1 the product picker counts each product\'s goals, then Portfolio rolls them up', pm.items === 'pmos5 goals,Billing1 goal' && pm.pf === 'Portfolio · all products' && /rolls goals up across products/.test(pm.note), JSON.stringify(pm));
|
|
514
|
+
await q.click('#prodMenu [data-portfolio]');
|
|
515
|
+
const pf = await until(async () => { const x = await q.evaluate(() => ({ name: document.querySelector('#prodName').textContent, groups: [...document.querySelectorAll('#goalTbl .ins-grp')].map((g) => g.querySelector('[role="cell"]').textContent), rows: document.querySelectorAll('#goalTbl [data-goal]').length, brief: document.querySelector('#brief').textContent, budgets: document.querySelectorAll('#goalTbl [data-budget]').length })); return x.groups.includes('Billing') ? x : null; }, 6000);
|
|
516
|
+
ok('M1 Portfolio reads the other product once and groups every goal by product; budgets stay with their product', !!pf && pf.name === 'Portfolio' && pf.groups.slice(0, 2).join() === 'pmos,Billing' && pf.rows === 6 && /^Portfolio: 6 goals across 2 products/.test(pf.brief) && pf.budgets === 0 && asked.length === 1, JSON.stringify(pf));
|
|
517
|
+
await q.click('#goalTbl [data-goal="w2~krm-inv"] .nm'); const gv = await until(() => vw(q));
|
|
518
|
+
ok('M1 a goal of another product opens its detail, named with its product and not on this product\'s dashboards', gv && gv.title === 'Invoices paid on time' && /Billing/.test(gv.text) && !(await q.evaluate(() => document.querySelector('#czViewer [data-gx="dash"], #czViewer [data-gx="chart"]'))), JSON.stringify(gv));
|
|
519
|
+
await vwClose(q);
|
|
520
|
+
await q.click('#prodPick'); await q.click('#prodMenu [data-board="w1"]'); await sleep(150);
|
|
521
|
+
ok('M1 picking the open product again leaves Portfolio', (await txt('#prodName', q)) === 'pmos' && (await q.evaluate(() => document.querySelectorAll('#goalTbl [data-goal]').length)) === 5);
|
|
522
|
+
await R.ctx.close();
|
|
523
|
+
}
|
|
524
|
+
/* P: the phone (IsPhone): the goal detail full screen with Readings, Moved by and Dashboards; a report setup as a sheet */
|
|
525
|
+
{
|
|
526
|
+
const R = await open({ w: 390, h: 844 }), q = R.page;
|
|
527
|
+
await q.click('#goalCards [data-goal="krm-act"]'); await until(() => vw(q));
|
|
528
|
+
const ph = await q.evaluate(() => { const v = document.querySelector('#czViewer').getBoundingClientRect(); return { w: Math.round(v.width), tabs: [...document.querySelectorAll('#czViewer .ins-vtab')].map((t) => t.textContent).join(), first: document.querySelector('#czViewer .ins-gd').firstElementChild.className, add: (document.querySelector('#czViewer .ins-btn.wide[data-gx="add"]') || {}).textContent, over: document.documentElement.scrollWidth > innerWidth }; });
|
|
529
|
+
ok('P1 on a phone the goal detail covers the screen: the chart first, then Readings, Moved by and Dashboards, and a full-width Add a reading', ph.w === 390 && ph.tabs === 'Readings,Moved by,Dashboards' && ph.first === 'ins-gh' && ph.add === 'Add a reading' && !ph.over, JSON.stringify(ph));
|
|
530
|
+
await q.click('#czViewer [data-gt="dash"]'); await sleep(80);
|
|
531
|
+
ok('P1 the Dashboards tab holds the switches', (await q.evaluate(() => document.querySelectorAll('#czViewer .ins-gb [data-gx="dash"]').length)) === 1);
|
|
532
|
+
await vwClose(q);
|
|
533
|
+
await q.click('#tabLibrary'); await q.click('#listRows [data-setup]');
|
|
534
|
+
const sh = await until(() => q.evaluate(() => { const s = document.querySelector('#repSheet'); return s ? { title: s.querySelector('.ins-h3').textContent, btns: [...s.querySelectorAll('button, a')].map((b) => b.textContent).join(','), viewer: !!document.querySelector('#czViewer:not([hidden])'), bottom: Math.round(innerHeight - s.getBoundingClientRect().bottom) } : null; }), 4000);
|
|
535
|
+
ok('P1 on a phone a report setup opens as a sheet: Draft it now, Pause, Change the setup in Home', !!sh && sh.title === 'Partner update' && sh.btns === 'Draft it now,Pause,Change the setup in Home' && !sh.viewer && sh.bottom === 0, JSON.stringify(sh));
|
|
536
|
+
await q.keyboard.press('Escape');
|
|
537
|
+
ok('P1 Escape closes the sheet', await q.evaluate(() => !document.querySelector('#repSheet, #repScrim')));
|
|
538
|
+
await R.ctx.close();
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/* I11 fidelity to the Agreed design (AgInsGoals, AgInsPhone): Nunito, the cozy panel, the pill tabs, the table, the strip and the six tiles */
|
|
325
542
|
for (const [w, h] of [[1440, 900], [390, 844]]) {
|
|
326
543
|
const R = await open({ w, h }); await sleep(300);
|
|
327
544
|
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();
|
|
328
|
-
|
|
545
|
+
const tiles = [...document.querySelectorAll('#bmBody [data-tile]')].map((t) => t.getBoundingClientRect());
|
|
546
|
+
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 }; });
|
|
329
547
|
const phone = w < 720;
|
|
330
|
-
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') && f.bg === 'rgb(255, 255, 255)' && f.tabBg === 'rgb(244, 243, 240)' && f.tabR === '999px' && f.tabW === '700' && f.stripR === '16px' && f.stripBg === 'rgb(244, 243, 240)' &&
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
/* G2 Outcomes and the verdict, Library, and New goal */
|
|
334
|
-
{
|
|
335
|
-
const R = await open(), q = R.page, sent = [];
|
|
336
|
-
await q.route('**/api/records/kr-metrics/add', (r) => { sent.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true,"rid":"krm-new"}' }); });
|
|
337
|
-
await q.click('#tabOutcomes');
|
|
338
|
-
const o = await q.evaluate(() => ({ 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, decide: document.querySelectorAll('#outTbl [data-verdict]').length, view: document.querySelector('#viewChip').offsetParent === null }));
|
|
339
|
-
ok('G2 Outcomes lists the shipped work by what it needs: a verdict, still in its window; with what its goal promised and where it stands', 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/.test(o.strip) && /Partner activation 20% → 50% by 31 Dec/.test(o.sso) && /28% of 50%/.test(o.sso) && o.decide === 1 && o.view, JSON.stringify(o));
|
|
340
|
-
await q.click('#outTbl [data-verdict]'); await sleep(150);
|
|
341
|
-
const v = await q.evaluate(() => ({ title: document.querySelector('#sideTitle').textContent, opts: [...document.querySelectorAll('#sideBody .ins-opt')].map((b) => b.dataset.vd + ':' + b.getAttribute('aria-checked')).join() }));
|
|
342
|
-
await q.click('#sideBody [data-vd="Keep"]'); await q.fill('#vdLearn', 'Codes work.');
|
|
343
|
-
await q.route('**/premium.html*', (r) => r.fulfill({ status: 200, contentType: 'text/html', body: '<!doctype html><title>home</title>' }));
|
|
344
|
-
await Promise.all([q.waitForURL(/premium\.html/), q.click('#sideGo')]);
|
|
345
|
-
const u = new URL(q.url());
|
|
346
|
-
ok('G2 the verdict offers Keep, Iterate or Stop, and Record verdict opens Home with it; nothing is posted from Insights', v.title === 'Refund reason codes' && v.opts === 'Keep:false,Iterate:true,Stop:false' && u.searchParams.get('ask') === 'verdict' && /Keep\. What we learned: Codes work\./.test(u.searchParams.get('q')) && R.posts.length === 0, JSON.stringify([v, u.search, R.posts]));
|
|
347
|
-
await q.goBack(); await until(() => q.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0));
|
|
348
|
-
await q.click('#newB'); await q.click('#newMenu [data-new="goal"]');
|
|
349
|
-
await q.fill('#ngName', 'Weekly active partners'); await q.fill('#ngBase', '10'); await q.fill('#ngTgt', '10'); await q.click('#sideGo');
|
|
350
|
-
const refused = await q.textContent('#sideMsg');
|
|
351
|
-
await q.fill('#ngTgt', '40'); await q.click('#sideBody [data-seg="Type"] [data-v="Count"]'); await q.fill('#ngObj', 'Growth'); await q.click('#sideGo'); await sleep(300);
|
|
352
|
-
ok('G2 New goal checks the numbers, then adds a KR metric record with its baseline, target, date and objective', /must differ/.test(refused) && sent.length === 1 && sent[0].ws === 'w1' && sent[0].fields.metric === 'Weekly active partners' && sent[0].fields.baseline === 10 && sent[0].fields.target === 40 && sent[0].fields.pillar === 'Growth' && sent[0].fields.unit === '' && /^\d{4}-\d{2}-\d{2}$/.test(sent[0].fields.by), JSON.stringify([refused, sent]));
|
|
353
|
-
await q.click('#helpB');
|
|
354
|
-
ok('G2 the help explains goals, charts, dashboards and reports, and the goal types', await q.evaluate(() => !document.querySelector('#helpPop').hidden && document.querySelectorAll('#helpPop .ins-hc > div').length === 4 && /Reports are made in Home/.test(document.querySelector('#helpPop').textContent)));
|
|
548
|
+
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));
|
|
549
|
+
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));
|
|
355
550
|
await R.ctx.close();
|
|
356
551
|
}
|
|
357
552
|
return finish();
|