create-pmos 0.395.0 → 0.397.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.
Files changed (100) hide show
  1. package/package.json +25 -30
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +20 -40
  8. package/workspace/briefing-premium-board-test.js +145 -107
  9. package/workspace/briefing-premium-calendar-2-test.js +5 -2
  10. package/workspace/briefing-premium-calendar-3-test.js +13 -8
  11. package/workspace/briefing-premium-calendar-test.js +16 -5
  12. package/workspace/briefing-premium-initiative-test.js +50 -41
  13. package/workspace/briefing-premium-insights-test.js +104 -85
  14. package/workspace/briefing-premium-metrics-test.js +11 -32
  15. package/workspace/briefing-premium-sources-test.js +42 -21
  16. package/workspace/briefing-premium-test.js +112 -98
  17. package/workspace/briefing-premium-work-test.js +78 -64
  18. package/workspace/changelog.json +24 -0
  19. package/workspace/fixtures/board-premium-facts.js +2 -1
  20. package/workspace/fixtures/board-premium-jira.js +28 -0
  21. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  22. package/workspace/fixtures/initiatives-api/list.json +30 -42
  23. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  24. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  25. package/workspace/fixtures/insights-premium-facts.js +11 -2
  26. package/workspace/guide/briefing-premium.md +3 -1
  27. package/workspace/guide/index.md +1 -0
  28. package/workspace/guide/lifecycle.md +51 -0
  29. package/workspace/home-shot.js +38 -0
  30. package/workspace/lib/board-premium.js +92 -1
  31. package/workspace/lib/engine/boards.js +15 -14
  32. package/workspace/lib/engine/nine-stages.js +49 -20
  33. package/workspace/lib/engine/signals/detectors.js +13 -11
  34. package/workspace/lib/insights-premium.js +78 -1
  35. package/workspace/lib/routes-board-premium.js +3 -2
  36. package/workspace/lib/routes-initiatives.js +1 -1
  37. package/workspace/lib/routes-insights-premium.js +8 -1
  38. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  39. package/workspace/package-lock.json +2 -2
  40. package/workspace/package.json +1 -1
  41. package/workspace/premium-agreed-viewer-shots.js +76 -0
  42. package/workspace/premium-board-actions-test.js +2 -0
  43. package/workspace/premium-chat-chart-tab-test.js +6 -5
  44. package/workspace/premium-chat-context-test.js +8 -6
  45. package/workspace/premium-chat-goal-view-test.js +9 -7
  46. package/workspace/premium-chat-notes-test.js +3 -2
  47. package/workspace/premium-chat-report-tab-test.js +8 -2
  48. package/workspace/premium-chat-term-test.js +3 -1
  49. package/workspace/premium-chat-viewer-test.js +23 -17
  50. package/workspace/premium-core-doc-issue-test.js +2 -0
  51. package/workspace/premium-html-viewer-test.js +4 -2
  52. package/workspace/premium-phone-card-test.js +1 -0
  53. package/workspace/premium-phone-room-test.js +16 -11
  54. package/workspace/premium-report-read-test.js +1 -1
  55. package/workspace/premium-vw-backlog-test.js +2 -0
  56. package/workspace/premium-vw-cal-test.js +9 -4
  57. package/workspace/premium-vw-doc-test.js +1 -1
  58. package/workspace/premium-vw-item-test.js +1 -0
  59. package/workspace/premium-vw-jira-test.js +4 -1
  60. package/workspace/premium-vw-notes-test.js +2 -1
  61. package/workspace/premium-vw-rec-test.js +3 -2
  62. package/workspace/premium-vw-slides-test.js +2 -2
  63. package/workspace/premium-work-depth-test.js +7 -3
  64. package/workspace/public/pm/bd-span.js +120 -0
  65. package/workspace/public/pm/bd-stages.js +33 -0
  66. package/workspace/public/pm/cozy-board.css +373 -0
  67. package/workspace/public/pm/cozy-home.css +152 -0
  68. package/workspace/public/pm/cozy-home.js +170 -0
  69. package/workspace/public/pm/cozy-initiative.css +138 -0
  70. package/workspace/public/pm/cozy-insights.css +292 -0
  71. package/workspace/public/pm/cozy-nav.js +54 -0
  72. package/workspace/public/pm/cozy-viewer.css +143 -0
  73. package/workspace/public/pm/cozy.css +172 -0
  74. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  75. package/workspace/public/pm/lifecycle-lens.js +22 -11
  76. package/workspace/public/pm/premium-board.js +329 -67
  77. package/workspace/public/pm/premium-brief.js +1 -1
  78. package/workspace/public/pm/premium-chat.js +17 -10
  79. package/workspace/public/pm/premium-initiative-head.js +138 -0
  80. package/workspace/public/pm/premium-initiative.js +28 -4
  81. package/workspace/public/pm/premium-insights.js +530 -244
  82. package/workspace/public/pm/premium-shell.js +40 -10
  83. package/workspace/public/pm/premium-viewer.js +5 -0
  84. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  85. package/workspace/public/pm/premium-vw-jira.css +11 -0
  86. package/workspace/public/pm/premium-vw-jira.js +11 -4
  87. package/workspace/public/pm/premium-vw-rec.js +5 -2
  88. package/workspace/public/pm/premium-wide.css +30 -0
  89. package/workspace/public/pm/premium-work.js +18 -8
  90. package/workspace/public/pm/premium.js +19 -6
  91. package/workspace/public/premium-board.html +83 -47
  92. package/workspace/public/premium-chat.html +7 -32
  93. package/workspace/public/premium-initiative.html +16 -8
  94. package/workspace/public/premium-insights.html +83 -43
  95. package/workspace/public/premium-work.html +6 -71
  96. package/workspace/public/premium.html +62 -15
  97. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  98. package/workspace/server.js +7 -0
  99. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  100. package/workspace/third-party/README.md +1 -0
@@ -3,14 +3,14 @@
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
5
  * (fixtures/insights-premium-facts.js); the last blocks read a scratch repository's KR metric records through the real route, and compare the page with the mockup.
6
- * I1 place · I2 reading · I3 charts · I4 no series · I5 dashboards · I6 what stands out · I7 dialog · I8 reports · I9 labels · I10 empty · I11 floors and fidelity */
6
+ * I1 place · I2 reading · I3 charts · I4 no series · I5 dashboards · I6 what stands out · I7 dialog · I8 reports · I9 labels · I10 empty · I11 floors and fidelity
7
+ * premium-agreed-design (planning/prd/premium-agreed-design-prd.md N1, N2, G1, G2): the floating place menu, no page header, the Goals table, the period,
8
+ * Outcomes with the verdict, Library, New goal and New dashboard. The old mockup comparison is replaced by the Agreed design's tokens. */
7
9
  const fs = require('fs');
8
10
  const os = require('os');
9
11
  const path = require('path');
10
12
  const { spawn } = require('child_process');
11
13
  const { findBrowser } = require('./lib/find-browser');
12
- const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
13
- const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
14
14
  const T = require('./test-run').configure({ name: 'briefing-premium-insights' });
15
15
  const IP = require('./lib/insights-premium.js');
16
16
  const F = require('./fixtures/insights-premium-facts.js');
@@ -32,7 +32,6 @@ const finish = async (code) => {
32
32
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
33
33
 
34
34
  const mk = (o) => IP.build(F.facts(Object.assign({ pinned: 'all' }, o))); // All measures pinned, so the top card starts on every measure
35
- const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html');
36
35
 
37
36
  (async () => {
38
37
  const exe = findBrowser();
@@ -52,27 +51,38 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
52
51
  await page.route('**/api/insights-premium*', (r) => { calls++; if (answers) { const a = answers(calls); return r.fulfill({ status: a.status, contentType: 'application/json', body: JSON.stringify(a.body) }); } return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: current, as_of: 1 }) }); });
53
52
  await page.route('**/api/briefing-premium/**', (r) => { const rq = r.request(); if (rq.method() === 'GET') return r.fulfill({ contentType: 'application/json', body: JSON.stringify(thread) }); return r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
54
53
  await page.goto(BASE + '/premium-insights.html?theme=' + theme);
55
- const up = await until(() => page.evaluate(() => document.querySelectorAll('#dashBody .mch').length > 0 || /could not be read/.test(document.querySelector('#snap').textContent) || document.querySelectorAll('#dashBody .nempty').length > 0), 20000);
54
+ const up = await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0 || /could not be read/.test(document.querySelector('#snap').textContent) || !!document.querySelector('#goalTbl .ins-empty')), 20000);
56
55
  return { ctx, page, errors, posts, up, calls: () => calls, setModel: (m) => { current = m; }, setThread: (t) => { thread = t; } };
57
56
  };
58
57
 
59
58
  const A = await open();
60
- ok('0 the page draws the charts', A.up);
59
+ ok('0 the page draws the goals', A.up);
61
60
  if (!A.up) return finish(1);
62
61
  const p = A.page, M = mk();
63
62
  const txt = (s) => p.evaluate((q) => (document.querySelector(q) || {}).textContent || '', s);
64
63
 
65
64
  /* I1 */
66
- const rail = await p.evaluate(() => ({ names: [...document.querySelectorAll('.rail .pl')].map((b) => b.textContent.trim()), cur: document.querySelector('.rail [aria-current="page"]').textContent.trim(), pi: getComputedStyle(document.querySelector('.rail')).getPropertyValue('--pi').trim(), title: document.title, name: document.querySelector('#crBoard').textContent, sw: document.querySelector('#crSw').hidden }));
67
- ok('I1 the rail names five places, Insights is current, the board is named and has no switcher for one board', rail.names.join() === 'Briefing,My work,Chat,Board,Insights' && rail.cur === 'Insights' && rail.pi === '4' && rail.name === 'pmos' && rail.sw, JSON.stringify(rail));
65
+ const nav = await p.evaluate(() => ({ fabs: document.querySelectorAll('#czFab').length, label: document.querySelector('#czFab').getAttribute('aria-label'), rail: getComputedStyle(document.querySelector('.rail')).display, title: document.title, name: document.querySelector('#prodName').textContent, boards: document.querySelectorAll('#prodMenu [data-board]').length }));
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 === 'none' && nav.name === 'pmos' && nav.boards === 1, JSON.stringify(nav));
67
+ { 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
+ 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
+ { 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
+ 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)); }
68
71
  { await p.click('#moreBtn'); const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('I1 the ⋯ menu links to the console (premium-console-link, premium-topbar)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); await p.keyboard.press('Escape'); }
69
72
  ok('I1 the page is served at /premium-insights and /premium-insights.html', (await fetch(BASE + '/premium-insights')).status === 200 && (await fetch(BASE + '/premium-insights.html')).status === 200);
70
- for (const [go, re] of [['brief', /\/premium\.html$/], ['work', /\/premium-work\.html$/], ['init', /\/premium-board\.html$/]]) {
71
- const r2 = await open(); await r2.page.locator(`.rail [data-go="${go}"]`).click();
72
- ok(`I1 the ${go} button opens its premium page`, await until(() => re.test(r2.page.url()), 5000), r2.page.url());
73
+ for (const [go, re] of [['Home', /\/premium\.html$/], ['Board', /\/premium-board\.html$/]]) {
74
+ const r2 = await open(); await r2.page.click('#czFab'); await r2.page.locator('#czMenu a', { hasText: go }).click();
75
+ ok(`N1 the menu's ${go} opens its premium page`, await until(() => re.test(r2.page.url()), 5000), r2.page.url());
73
76
  await r2.ctx.close();
74
77
  }
75
- { const r2 = await open(); const before = r2.page.url(); await r2.page.locator('.rail [data-go="rep"]').click(); await sleep(300); ok('I1 the Insights button opens nothing else: it is the page already', r2.page.url() === before); await r2.ctx.close(); }
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); }
76
86
 
77
87
  /* I3 charts */
78
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') })) }));
@@ -95,24 +105,26 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
95
105
  const ns = await p.evaluate(() => [...document.querySelectorAll('#dashBody .ngl, #dashBody .dplist .nempty')].map((e) => e.textContent.replace(/\s+/g, ' ').trim()));
96
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));
97
107
  /* I5 dashboards */
108
+ await p.click('#tabLibrary');
98
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')));
99
- ok('I5 dashboards: all measures first, then the saved ones, then the pillars the records name; the pinned one is marked, pillars cannot be pinned', tabs.join() === 'All measures:true,Weekly partner review:false,Growth:none,Reliability:none', tabs.join());
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());
100
111
  await p.click('#repBody [data-d="p:Reliability"]');
101
- ok('I5 choosing a pillar shows only its charts and one count', (await p.evaluate(() => document.querySelectorAll('#dashBody .mch').length)) === 1 && /1 of 1.*on their line/.test(await txt('#dashBody .mhint')) && (await p.evaluate(() => document.querySelector('#dashBody .mprog').getAttribute('aria-valuenow'))) === '1');
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');
102
114
  await p.click('#repBody [data-d="all"]');
103
115
  const hint = await txt('#dashBody .mhint');
104
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);
105
- ok('I5 the dock counts the same two', (await txt('#dN')) === '2' && /measures off their line/.test(await txt('#dLab')) && /First Time to first call/.test(await txt('#dNext')));
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')));
106
118
  /* I6 */
107
119
  const fd = await p.evaluate(() => [...document.querySelectorAll('.nfd li')].map((li) => li.className + ': ' + li.textContent.replace(/\s+/g, ' ').trim()));
108
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));
109
121
  ok('I6 no sentence gives a cause', !fd.some((x) => /forecast|because|caused|expected to/i.test(x)));
110
- const hero = await p.evaluate(() => ({ eye: document.querySelector('#insEye').textContent, head: document.querySelector('#brief').textContent, why: document.querySelector('#insWhy').textContent, more: [...document.querySelectorAll('#insMore button')].map((b) => b.textContent), acts: [...document.querySelectorAll('#insAct button')].map((b) => b.textContent), note: document.querySelector('#insNote').textContent }));
111
- ok('L1 the insight leads the page: the strongest finding, its reason, two more and the method', /2 of 3 behind their line · readings to 15 Oct/.test(hero.eye) && hero.head === 'Time to first call will miss its 3 days target on 31 Dec unless it turns.' && /Over its last 4 readings it went from 8 days to 9 days/.test(hero.why) && hero.more.length === 2 && /Partner activation will miss/.test(hero.more[0]) && hero.acts.join() === 'Ask PMOS why,See the chart' && /straight line through its last four readings/.test(hero.note), JSON.stringify(hero));
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));
112
124
  /* I7 dialog */
113
- await p.click('#insAct [data-open]'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
114
- const dl = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, eye: document.querySelector('#dEye').textContent, kv: [...document.querySelectorAll('#oMain .kv2')].map((k) => k.textContent.replace(/\s+/g, ' ')).join(' | '), path: document.querySelector('#oMain .dpath').textContent, btn: document.querySelectorAll('#oMain button').length, hold: document.querySelector('#holdWhy').textContent, sw: [...document.querySelectorAll('#oMain [role=switch]')].map((b) => b.querySelector('b').textContent + ':' + b.getAttribute('aria-checked')).join(), inert: ['.rail', 'main.stage', '#dock'].every((s) => document.querySelector(s).inert) }));
115
- ok('I7 a finding opens the standard dialog: the record\'s numbers, its readings with dates, its path, and only the dashboard switch as a press', dl.title === 'Time to first call' && /real data/.test(dl.eye) && /Target3 days by 31 Dec/.test(dl.kv) && /15 Oct9 days/.test(dl.kv) && dl.path === 'planning/records/kr-metrics.jsonl' && dl.btn === 1 && dl.sw === 'Weekly partner review:true' && /Nothing here changes a record/.test(dl.hold) && dl.inert, JSON.stringify(dl));
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));
116
128
  ok('I7 Escape closes it and focus returns', (await p.keyboard.press('Escape'), await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')))));
117
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);
118
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); }));
@@ -128,24 +140,25 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
128
140
  await R.ctx.close();
129
141
  }
130
142
  /* I8 reports */
131
- await (async (pg, sel) => { if (await pg.locator('#listSeg').isHidden()) await pg.click('#listF'); await pg.click(sel); })(p, '#listSeg [data-f="rep"]'); await sleep(100);
132
- const rp = await p.evaluate(() => ({ rows: [...document.querySelectorAll('#listRows [data-rpt]')].map((r) => r.querySelector('.dmn b').textContent + ' / ' + r.querySelector('.s').textContent), note: document.querySelector('#cRep .mhint').textContent, cap: document.querySelector('#repCap').textContent, setups: document.querySelectorAll('#listRows [data-setup]').length, dash: document.querySelectorAll('#listRows [data-d]').length }));
133
- ok('I8 the Reports filter lists the set-up reports, then one row per report with its cycles counted (PM 2026-10-22)', rp.rows.join() === 'biweekly / 1 draft,monthly / 1 issued' && rp.setups === 1 && rp.dash === 0 && /Nothing is sent from here/.test(rp.note) && rp.cap === '7', JSON.stringify(rp));
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));
134
147
  await (async (pg, sel) => { if (await pg.locator('#listSeg').isHidden()) await pg.click('#listF'); await pg.click(sel); })(p, '#listSeg [data-f="all"]');
135
- { const R = await open(); await (async (pg, sel) => { if (await pg.locator('#listSeg').isHidden()) await pg.click('#listF'); await pg.click(sel); })(R.page, '#listSeg [data-f="rep"]'); await R.page.locator('#listRows [data-rpt]').first().click(); ok('I8 a report opens in the page\'s reader, not the console (premium-report-read R1)', await until(() => R.page.evaluate(() => document.querySelector('#dlg').classList.contains('rdrd') && document.querySelector('#dlg').classList.contains('on')), 5000) && /premium-insights\.html/.test(R.page.url()), R.page.url());
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());
136
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"]')));
137
150
  await R.ctx.close(); }
138
151
  /* I9 labels */
139
- ok('I9 no demo label, and the foot says what is left out', !(await p.evaluate(() => /demo/i.test(document.querySelector('main.stage').textContent))) && /Left out: any measure no record holds/.test(await txt('#foot')) && /Board measures card/.test(await txt('#foot')) && /Real data/.test(await txt('#snap')));
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')));
140
153
  ok('I9 the page makes no write request on its own', A.posts.length === 0, A.posts.join());
141
154
  /* I10 empty */
142
155
  {
143
156
  const R = await open({ model: mk({ outcomes: [] }) });
144
- ok('I10 with no KR metric the page says there is no insight yet, draws nothing, and the list still holds the report files', await R.page.evaluate(() => /No KR metric is recorded/.test(document.querySelector('#brief').textContent) && /No KR metric is recorded for this workspace/.test(document.querySelector('#dashBody').textContent) && document.querySelectorAll('#listRows [data-rpt]').length === 2 && document.querySelectorAll('#dashBody .mch').length === 0 && /There is no insight yet/.test(document.querySelector('#brief').textContent) && document.querySelectorAll('#insAct button').length === 0));
145
- ok('I10 with nothing to chart the top card is hidden (All measures stays a row of the list), and the hero\'s explanation waits behind an ⓘ (premium-calmer-first-screen)', await R.page.evaluate(() => document.querySelector('#cDash').hidden && document.querySelector('#insWhy').hidden && !!document.querySelector('#insEye .infob[aria-controls="insWhy"]') && !/Shown above/.test(document.querySelector('#repBody').textContent)));
157
+ ok('I10 with no KR metric the page says there is no insight yet, draws nothing, and the list 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('#listRows [data-rpt]').length === 2 && document.querySelectorAll('#dashBody .mch').length === 0 && /There is no insight yet/.test(document.querySelector('#brief').textContent) && document.querySelectorAll('#insAct button').length === 0));
158
+ ok('I10 with nothing to chart the charts section is hidden and the strip makes no number', await R.page.evaluate(() => document.querySelector('#cDash').hidden && document.querySelector('#insWhy').textContent === '' && /There is no insight yet/.test(document.querySelector('#brief').textContent) && !/goals?, \d+ behind/.test(document.querySelector('#insEye').textContent)));
146
159
  await R.ctx.close();
147
160
  const R2 = await open({ model: mk({ reportsOk: false, reports: [], missing: ['reports'] }) });
148
- ok('I10 reports that could not be read are said to be unread, not empty', await R2.page.evaluate(() => /report files could not be read/.test(document.querySelector('#repBody').textContent) && /not read: reports/.test(document.querySelector('#snap').textContent)));
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)));
149
162
  await R2.ctx.close();
150
163
  }
151
164
  /* I2 failed read */
@@ -166,7 +179,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
166
179
  const last = () => sent[sent.length - 1] || [null, {}];
167
180
  const dlgOn = () => until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
168
181
  const shut = async () => { for (let i = 0; i < 2 && await q.evaluate(() => document.querySelector('#dlg').classList.contains('on')); i++) { await q.keyboard.press('Escape'); await sleep(150); } await until(() => q.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))); }; // a full-screen dialog leaves full screen on the first Escape
169
- await q.click('#repBody [data-d="pd-1"]'); await sleep(200);
182
+ await q.click('#tabLibrary'); await q.click('#repBody [data-d="pd-1"]'); await sleep(200);
170
183
  const sv = await q.evaluate(() => ({ tiles: [...document.querySelectorAll('#dashBody .mch .mlab')].map((e) => e.firstChild.textContent), gone: [...document.querySelectorAll('#dashBody .dplist .nempty')].map((e) => e.textContent.replace(/\s+/g, ' ')), bar: document.querySelector('#dashBar').textContent, purpose: document.querySelector('#dashPurpose').textContent }));
171
184
  ok('R1 a saved dashboard draws its charts in its order and says which chart is gone, in its place', sv.tiles.join() === 'Partner activation,Time to first call' && sv.gone.length === 1 && /krm-gone.*No KR metric record is called krm-gone/.test(sv.gone[0]) && /Monday partner review/.test(sv.purpose) && /Pin.*Back to All measures.*Edit/.test(sv.bar), JSON.stringify(sv));
172
185
  await q.route('**/premium-chat.html*', (r) => r.fulfill({ status: 200, contentType: 'text/html', body: '<!doctype html><title>chat</title>' }));
@@ -174,32 +187,36 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
174
187
  const u1 = new URL(q.url());
175
188
  ok('R2 Edit opens the Chat page with the saved dashboard in its tab: the Insight Studio is removed', u1.searchParams.get('open') === 'dashboard:pd-1' && u1.searchParams.get('ws') === 'w1', u1.search);
176
189
  await q.goBack(); await until(() => q.evaluate(() => !!document.querySelector('#repBody [data-d="pd-1"]')));
177
- await q.click('#listNew'); await Promise.all([q.waitForURL(/premium-chat\.html/), q.click('#pdNew')]);
190
+ await q.click('#tabLibrary'); await q.click('#listNew'); await q.click('#lmDash'); await sleep(150);
191
+ const nd = await q.evaluate(() => ({ side: !document.querySelector('#side').hidden, tab: document.querySelector('#tabGoals').getAttribute('aria-selected'), boxes: document.querySelectorAll('#goalTbl .ins-cb').length }));
192
+ await q.click('#goalTbl [data-goal="krm-act"] .nm'); await q.click('#goalTbl [data-goal="krm-up"] .nm'); await q.fill('#ndName', 'Partner first week'); await q.fill('#ndQ', 'Are partners getting value?'); await q.click('#sideGo'); await sleep(300);
193
+ ok('G2 New dashboard selects goals in the table, then Save posts them as one dashboard', nd.side && nd.tab === 'true' && nd.boxes === 5 && last()[0] === '/api/premium-dashboards/save' && last()[1].name === 'Partner first week' && JSON.stringify(last()[1].charts) === JSON.stringify(['krm-act', 'krm-up']) && last()[1].board === 'w1', JSON.stringify([nd, last()]));
194
+ sent.length = 0; await q.click('#tabLibrary'); await q.click('#listNew'); await q.click('#lmDash'); await q.fill('#ndAskIn', 'partner health'); await Promise.all([q.waitForURL(/premium-chat\.html/), q.press('#ndAskIn', 'Enter')]);
178
195
  const u2 = new URL(q.url());
179
- ok('R2 New, then Dashboard, opens the Chat page with a first message for the PM to send, and posts nothing', u2.searchParams.get('say') === 'Make a dashboard of ' && !u2.searchParams.get('open') && !sent.length, u2.search);
196
+ ok('R2 describing a new dashboard opens the Chat page with a first message for the PM to send, and posts nothing', u2.searchParams.get('say') === 'Make a dashboard of partner health' && !u2.searchParams.get('open') && !sent.length, u2.search);
180
197
  await q.goBack(); await until(() => q.evaluate(() => !!document.querySelector('#repBody [data-d="pd-1"]')));
181
- await q.click('#repBody [data-d="pd-1"]'); await sleep(200);
198
+ await q.click('#tabLibrary'); await q.click('#repBody [data-d="pd-1"]'); await sleep(200);
182
199
  await (async (pg, sel) => { if (await pg.locator('#dashBar').isHidden()) await pg.click('#dashMore'); await pg.click(sel); })(q, '#pdBack'); await q.locator('#dashBody .lk[data-open="ins:krm-up"]').click(); await dlgOn(); await q.click('#oMain [data-pdsw="pd-1"]'); await sleep(300);
183
200
  ok('R3 the chart dialog\'s switch saves that dashboard with the chart added', last()[0] === '/api/premium-dashboards/save' && JSON.stringify(last()[1].charts) === JSON.stringify(['krm-act', 'krm-ttfc', 'krm-gone', 'krm-up']) && /Added to Weekly partner review/.test(await qt('#pdSwM')), JSON.stringify(last()));
184
201
  await shut();
185
- const groups = await q.evaluate(() => [...document.querySelectorAll('#repBody .ngrp > .label')].map((e) => e.textContent));
186
- ok('R1 your requests and what PMOS found stay at the top of the list', groups.join() === 'Your requests · 2,Found in your work · 1', groups.join());
187
- await q.click('#repFound .dmo'); await dlgOn();
202
+ await q.click('#tabLibrary'); const groups = await q.evaluate(() => ({ asks: document.querySelectorAll('#repAsks [data-ask]').length, sug: document.querySelector('#sugB').textContent, hidden: !document.querySelector('#repFound [data-found]') })); await q.click('#sugB');
203
+ ok('R1 your requests are rows of the reports table, and what PMOS found waits behind its suggestions chip', groups.asks === 2 && groups.sug === '1 suggestion from your work' && groups.hidden && await q.evaluate(() => !!document.querySelector('#repFound [data-found="f-1"]')), JSON.stringify(groups));
204
+ await q.click('#repFound [data-found]'); await dlgOn();
188
205
  ok('R2 a finding opens with its proposal and what PMOS saw', /ScheduleWeekly, Thursdays 09:00/.test(await qt('#oMain .kv2')) && (await q.evaluate(() => document.querySelectorAll('#oMain .pdev li').length)) === 2);
189
206
  const n0 = sent.length;
190
207
  await q.click('#oMain [data-rx="no"]'); await sleep(300);
191
- ok('R2 Not a report hides the row and waits; Undo sends nothing', (await q.evaluate(() => !document.querySelector('#repFound'))) && sent.length === n0 && (await q.click('#rxUndo'), await sleep(5400), sent.length === n0) && await q.evaluate(() => !!document.querySelector('#repFound')));
208
+ ok('R2 Not a report hides the row and waits; Undo sends nothing', (await q.evaluate(() => !document.querySelector('#repFound [data-found]'))) && sent.length === n0 && (await q.click('#rxUndo'), await sleep(5400), sent.length === n0) && await q.evaluate(() => !!document.querySelector('#repFound [data-found]')));
192
209
  await q.click('#oMain [data-rx="no"]'); await sleep(5600);
193
210
  ok('R2 without Undo, Not a report is sent after 5 seconds', last()[0] === '/api/report-setups/dismiss' && last()[1].finding === 'f-1' && last()[1].ws === 'w1', JSON.stringify(last()));
194
211
  await until(() => q.evaluate(() => !document.querySelector('#dlg').classList.contains('on') || true)); if (await q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))) await shut();
195
- await q.click('#repFound .dmo'); await dlgOn(); await q.click('#oMain [data-rx="set"]'); await sleep(400);
212
+ await q.click('#repFound [data-found]'); await dlgOn(); await q.click('#oMain [data-rx="set"]'); await sleep(400);
196
213
  ok('R2 Set it up posts the finding and says where the first draft is', last()[0] === '/api/report-setups/setup' && last()[1].finding === 'f-1' && /first draft is planning\/reports\/release-readiness\/2026-10-23\.md/.test(await qt('#toast')), JSON.stringify(last()));
197
214
  await q.fill('#repAskIn', 'A weekly risk note'); await q.click('#repAskGo'); await sleep(300);
198
- ok('R3 the Ask box posts the request and says it only proposes', last()[0] === '/api/report-setups/ask' && last()[1].text === 'A weekly risk note' && /Nothing is set up yet/.test(await qt('#toast')) && /only proposes/i.test(await qt('#cRep .nask-n')), JSON.stringify(last()));
199
- const info = async () => q.evaluate(() => ({ hid: document.querySelector('#repFold').hidden, exp: document.querySelector('#cRep .nrline .infob').getAttribute('aria-expanded') }));
200
- const i0 = await info(); await q.click('#cRep .nrline .infob'); const i1 = await info();
215
+ ok('R3 the Ask box posts the request and says it only proposes', last()[0] === '/api/report-setups/ask' && last()[1].text === 'A weekly risk note' && /Nothing is set up yet/.test(await qt('#toast')) && /only proposes/i.test(await qt('#pLibrary .ins-asknote')), JSON.stringify(last()));
216
+ const info = async () => q.evaluate(() => ({ hid: document.querySelector('#repFold').hidden, exp: document.querySelector('#pLibrary .ins-lnote .infob').getAttribute('aria-expanded') }));
217
+ const i0 = await info(); await q.click('#pLibrary .ins-lnote .infob'); const i1 = await info();
201
218
  ok('R3b the ask is one rounded input with + and send inside it, and the info button opens the longer note', i0.hid && i0.exp === 'false' && !i1.hid && i1.exp === 'true'
202
- && await q.evaluate(() => { const f = document.querySelector('#repAsk'); return !!(f.querySelector('#listNew') && f.querySelector('#repAskIn') && f.querySelector('#repAskGo')) && !document.querySelector('#cRep .lbar'); }), JSON.stringify([i0, i1]));
219
+ && await q.evaluate(() => { const f = document.querySelector('#repAsk'); return !!(f.querySelector('#listNew') && f.querySelector('#repAskIn') && f.querySelector('#repAskGo')); }), JSON.stringify([i0, i1]));
203
220
  await q.click('#repAsks [data-ask="a-1"]'); await dlgOn(); await q.click('#oMain [data-rx="chg"]'); await sleep(100);
204
221
  ok('R3 Change it needs words first', /Say what to change/.test(await qt('#rxM')));
205
222
  await q.fill('#rxChg', 'quarterly'); await q.click('#oMain [data-rx="chg"]'); await sleep(300);
@@ -222,33 +239,31 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
222
239
  const R = await open({ model: mk({ pinned: undefined }) }), q = R.page, sent = [];
223
240
  await q.route('**/api/premium-dashboards/pin', (r) => { const b = JSON.parse(r.request().postData() || '{}'); sent.push(b); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, pinned: b.id }) }); });
224
241
  const top = await q.evaluate(() => ({ h: document.querySelector('#hDash').textContent, tag: document.querySelector('#dashTag').textContent, tiles: document.querySelectorAll('#dashBody .mch').length, pin: document.querySelector('#pdPin').textContent }));
225
- ok('L4 the saved main dashboard is the pinned one and shows at the top, with Unpin', top.h === 'Weekly partner review' && top.tag === 'Pinned' && top.tiles === 2 && top.pin === 'Unpin', JSON.stringify(top));
226
- ok('L4 the top card\'s presses wait under a shut ⋯, its purpose behind ⓘ, and the list\'s filter is one chip (premium-calmer-first-screen)', await q.evaluate(() => document.querySelector('#dashBar').hidden && !document.querySelector('#dashMore').hidden && document.querySelector('#dashMore').getAttribute('aria-expanded') === 'false' && document.querySelector('#dashAbout').hidden && /\S/.test(document.querySelector('#dashPurpose').textContent) && document.querySelector('#listSeg').hidden && /^All\d+$/.test(document.querySelector('#listF').textContent.trim())));
227
- R.setModel(mk({ pinned: 'all' })); await q.click('#repBody [data-pin="all"]'); await sleep(300);
228
- ok('L4 after Pin, the pinned dashboard is the top card', await until(() => q.evaluate(() => document.querySelector('#hDash').textContent === 'All measures' && document.querySelector('#dashTag').textContent === 'Pinned')));
242
+ ok('L4 the saved main dashboard is the pinned one and shows at the top, with Unpin', top.h === 'Charts on Weekly partner review' && top.tag === 'Pinned' && top.tiles === 2 && top.pin === 'Unpin', JSON.stringify(top));
243
+ ok('L4 the view\'s presses wait under a shut ⋯ and its purpose behind ⓘ (premium-calmer-first-screen)', await q.evaluate(() => document.querySelector('#dashBar').hidden && !document.querySelector('#dashMore').hidden && document.querySelector('#dashMore').getAttribute('aria-expanded') === 'false' && document.querySelector('#dashAbout').hidden && /\S/.test(document.querySelector('#dashPurpose').textContent)));
244
+ R.setModel(mk({ pinned: 'all' })); await q.click('#tabLibrary'); await q.click('#repBody [data-pin="all"]'); await sleep(300);
245
+ ok('L4 after Pin, the pinned dashboard is the top card', await until(() => q.evaluate(() => document.querySelector('#hDash').textContent === 'Charts on All goals' && document.querySelector('#dashTag').textContent === 'Pinned')));
229
246
  ok('L4 the pin on a row posts that dashboard to the pin route, and nothing else', sent.length === 1 && sent[0].id === 'all' && sent[0].ws === 'w1' && sent[0].board === 'w1' && R.posts.every((x) => x === 'POST /api/premium-dashboards/pin'), JSON.stringify([sent, R.posts]));
230
- R.setModel(mk({ pinned: null })); await (async (pg, sel) => { if (await pg.locator('#dashBar').isHidden()) await pg.click('#dashMore'); await pg.click(sel); })(q, '#pdPin'); await sleep(300);
231
- ok('L4 Unpin posts no dashboard, and with nothing pinned the top card shows All measures as not pinned, with Pin', sent[sent.length - 1].id === null && await until(() => q.evaluate(() => document.querySelector('#hDash').textContent === 'All measures' && document.querySelector('#dashTag').textContent === 'Not pinned' && document.querySelector('#pdPin').textContent === 'Pin')), JSON.stringify(sent));
232
- await q.click('#listNew');
247
+ R.setModel(mk({ pinned: null })); await q.click('#tabGoals'); await (async (pg, sel) => { if (await pg.locator('#dashBar').isHidden()) await pg.click('#dashMore'); await pg.click(sel); })(q, '#pdPin'); await sleep(300);
248
+ ok('L4 Unpin posts no dashboard, and with nothing pinned the top card shows All measures as not pinned, with Pin', sent[sent.length - 1].id === null && await until(() => q.evaluate(() => document.querySelector('#hDash').textContent === 'Charts on All goals' && document.querySelector('#dashTag').textContent === 'Not pinned' && document.querySelector('#pdPin').textContent === 'Pin')), JSON.stringify(sent));
249
+ await q.click('#tabLibrary'); await q.click('#listNew');
233
250
  const mn = await q.evaluate(() => ({ open: !document.querySelector('#listMenu').hidden, items: [...document.querySelectorAll('#listMenu button')].map((b) => b.textContent).join(), exp: document.querySelector('#listNew').getAttribute('aria-expanded') }));
234
251
  await q.keyboard.press('Escape');
235
252
  ok('L5 New offers Dashboard or Report, and Escape closes it', mn.open && mn.items === 'Dashboard,Report' && mn.exp === 'true' && await q.evaluate(() => document.querySelector('#listMenu').hidden), JSON.stringify(mn));
236
- const pg1 = await q.evaluate(() => ({ rows: document.querySelectorAll('#listRows .dmr').length, pager: document.querySelector('#listPager').textContent }));
237
- await q.click('#listPager [data-pg="2"]'); await sleep(100);
238
- const pg2 = await q.evaluate(() => ({ rows: [...document.querySelectorAll('#listRows .dmo b')].map((b) => b.textContent), cur: document.querySelector('#listPager [aria-current="page"]').textContent }));
239
- ok('L5 six rows to a page with page numbers; page 2 holds the rest', pg1.rows === 6 && /1–6 of 7/.test(pg1.pager) && pg2.cur === '2' && pg2.rows.join() === 'monthly', JSON.stringify([pg1, pg2]));
253
+ const pg1 = await q.evaluate(() => ({ reps: document.querySelectorAll('#listRows [data-rpt], #listRows [data-setup], #listRows [data-ask]').length, dash: document.querySelectorAll('#listRows [data-d]').length }));
254
+ ok('L5 Library lists every report and request, then every dashboard as a card (the Agreed design has no pages)', pg1.reps === 5 && pg1.dash === 4, JSON.stringify(pg1));
240
255
  await R.ctx.close();
241
256
  const lead = { 'planning/reports/biweekly/2026-10-14.md': 'Activation slipped to 28% this fortnight.' };
242
257
  const R2 = await open({ model: mk({ leads: lead }) });
243
- const ln = await R2.page.evaluate(() => ({ dash: [...document.querySelectorAll('#listRows [data-d] .nil')].map((e) => e.textContent), rep: [...document.querySelectorAll('#listRows [data-rpt] .nil')].map((e) => e.textContent), su: document.querySelector('#listRows [data-setup] small').textContent }));
244
- ok('L6 each dashboard row shows its top finding, a report row quotes its file, a setup with no file says no draft is written yet', ln.dash[0] === 'Time to first call will miss its 3 days target on 31 Dec unless it turns.' && ln.rep[0] === '“Activation slipped to 28% this fortnight.”' && /^No draft is written yet/.test(ln.su), JSON.stringify(ln));
258
+ 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('L6 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' && ln.rep[0] === '“Activation slipped to 28% this fortnight.”' && /^No draft is written yet/.test(ln.su), JSON.stringify(ln));
245
260
  await R2.ctx.close();
246
261
  }
247
262
 
248
263
  /* I11 floors */
249
264
  for (const theme of ['light', 'dark']) {
250
265
  const R = await open({ w: 390, h: 844, theme }), q = R.page;
251
- const m = await q.evaluate(() => { const small = [...document.querySelectorAll('#listSeg button, #listNew, #listPager button, #repBody .npin, #insAct button, #insMore button, #dashBar button, #dashBody .lk, #dashBody .nfr, #repBody .dmo, #repBody .lk, #repBody input, #repAskGo, #crSw')].filter((b) => !b.closest('[hidden]') && b.getBoundingClientRect().height > 0 && b.getBoundingClientRect().height < 44).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1, small }; });
266
+ const m = await q.evaluate(() => { const small = [...document.querySelectorAll('#insBar button, #askWhy, #goalTbl .ins-ini, #dashBar button, #dashBody .lk, #dashBody .nfr, #czFab')].filter((b) => !b.closest('[hidden]') && b.getBoundingClientRect().height > 0 && b.getBoundingClientRect().height < 44).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1, small }; });
252
267
  ok(`I11 at 390 px (${theme}) the page has no sideways scroll and every control is 44 px`, !m.over && m.small.length === 0, JSON.stringify(m));
253
268
  await q.locator('#dashBody .nfr').first().click(); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(900);
254
269
  const g = await q.evaluate(() => { const r = document.querySelector('#dlg').getBoundingClientRect(); return { l: Math.round(r.left), w: Math.round(r.width), vw: innerWidth, tabs: getComputedStyle(document.querySelector('#dTabs')).display }; });
@@ -271,7 +286,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
271
286
  const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), pg = await ctx.newPage(), errs = [];
272
287
  pg.on('pageerror', (e) => errs.push(String(e)));
273
288
  await pg.goto(BASE + '/premium-insights.html');
274
- ok('E4 the real page says there is nothing to chart, and has no script error', await until(() => pg.evaluate(() => /No KR metric is recorded/.test(document.querySelector('#dashBody').textContent)), 20000) && errs.length === 0, errs.join(' | '));
289
+ ok('E4 the real page says there is nothing to chart, and has no script error', await until(() => pg.evaluate(() => /No KR metric is recorded/.test(document.querySelector('#brief').textContent) && /No goal is recorded/.test(document.querySelector('#goalTbl').textContent)), 20000) && errs.length === 0, errs.join(' | '));
275
290
  await ctx.close();
276
291
  }
277
292
  {
@@ -295,7 +310,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
295
310
  const H = await T.pressHeaders(base2);
296
311
  const made = await fetch(base2 + '/api/premium-dashboards/save', { method: 'POST', headers: H, body: JSON.stringify({ ws: m.board.ws, board: m.board.id, name: 'Partner review', purpose: 'The Monday partner review.', charts: [m.charts[0].id], main: true }) }).then((x) => x.status);
297
312
  await pg.reload();
298
- ok('E8 a dashboard saved as the main one (a press in the Chart tab) is pinned and drawn at the top of the real page', made === 200 && await until(() => pg.evaluate(() => document.querySelector('#hDash').textContent === 'Partner review' && document.querySelector('#dashTag').textContent === 'Pinned' && document.querySelectorAll('#dashBody .mch').length === 1), 10000), await pg.evaluate(() => (document.querySelector('#pdM') || {}).textContent + ' / ' + document.querySelector('#hDash').textContent + ' ' + document.querySelector('#dashTag').textContent));
313
+ ok('E8 a dashboard saved as the main one (a press in the Chart tab) is pinned and drawn at the top of the real page', made === 200 && await until(() => pg.evaluate(() => document.querySelector('#hDash').textContent === 'Charts on Partner review' && document.querySelector('#dashTag').textContent === 'Pinned' && document.querySelectorAll('#dashBody .mch').length === 1), 10000), await pg.evaluate(() => (document.querySelector('#pdM') || {}).textContent + ' / ' + document.querySelector('#hDash').textContent + ' ' + document.querySelector('#dashTag').textContent));
299
314
  const j2 = await (await fetch(base2 + '/api/insights-premium')).json(), d2 = j2.model.dashboards.find((d) => d.saved);
300
315
  ok('E8 the model reads it back from the ledger', !!d2 && d2.name === 'Partner review' && d2.main && d2.charts.join() === m.charts[0].id, JSON.stringify(d2));
301
316
  const body = JSON.stringify({ ws: m.board.ws, board: m.board.id, name: 'From an agent', purpose: 'x', charts: [] });
@@ -306,34 +321,38 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
306
321
  await ctx.close();
307
322
  }
308
323
 
309
- /* I11 fidelity against the mockup */
310
- if (!fs.existsSync(MOCKUP)) ok('I11 the mockup is in the repository', false, MOCKUP);
311
- else {
312
- const PAIRS = [['rail', '.rail', '.rail'], ['card', '.nlc .card', '#cDash'], ['heading', '#hNd', '#hDash'], ['band', '.nfd', '.nfd'], ['bandlabel', '.nfd .label', '.nfd .label'], ['finding', '.nfd .nfr', '.nfd .nfr'], ['findtext', '.nfd .nft', '.nfd .nft'], ['dot', '.nfd .nfdot', '.nfd .nfdot'],
313
- ['hint', '.mhint', '.mhint'], ['grid', '.ngrid', '.ngrid'], ['tile', '.ngrid .mt1', '.ngrid .mt1'], ['tlabel', '.ngrid .mlab', '.ngrid .mlab'], ['chip', '.ngrid .mchip', '.ngrid .mchip'], ['value', '.ngrid .mval', '.ngrid .mval'], ['caption', '.ngrid .mwk', '.ngrid .mwk'],
314
- ['foot', '.ngrid .mfoot', '.ngrid .mfoot'], ['link', '.ntf .lk', '.ntf .lk'], ['repcard', '.nlr .card', '#cRep'], ['dock', '.dock', '.dock']];
315
- const SKIP_W = ['card', 'band', 'bandlabel', 'finding', 'findtext', 'hint', 'tile', 'tlabel', 'chip', 'value', 'caption', 'foot', 'link', 'heading', 'repcard', 'grid'];
316
- const PROPS = ['fontSize', 'fontWeight', 'fontFamily', 'color', 'backgroundColor', 'borderRadius', 'paddingTop', 'paddingLeft', 'letterSpacing', 'lineHeight', 'boxShadow', 'backdropFilter', 'borderTopColor'];
317
- const grab = (pg, which) => pg.evaluate(([pairs, props, idx]) => { const o = {}; for (const pr of pairs) { const n = pr[0], s0 = pr[idx]; const s = (n === 'rail' || n === 'dock') ? s0 : 'main.stage:not([hidden]) ' + s0; const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [PAIRS, PROPS, which]);
318
- for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
319
- const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
320
- await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
321
- await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
322
- await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="ins"]').click(); }, th);
323
- await until(() => m.evaluate(() => document.querySelectorAll('#nMain .mt1').length > 0)); await sleep(900);
324
- const R = await open({ w, h, theme: th }); await sleep(500);
325
- const a = await grab(m, 1), c = await grab(R.page, 2), diffs = [];
326
- for (const [n] of PAIRS) {
327
- if (!a[n] || !c[n]) { diffs.push(n + ' missing'); continue; }
328
- for (const k of Object.keys(a[n])) {
329
- const geom = k === 'left' || k === 'width';
330
- if (geom && (SKIP_W.includes(n) && k === 'width' || ['findtext', 'tlabel', 'chip', 'value', 'caption', 'foot', 'link', 'dot', 'finding', 'hint', 'heading', 'repcard'].includes(n) && k === 'left')) continue;
331
- if (geom ? Math.abs(a[n][k] - c[n][k]) > 2 : a[n][k] !== c[n][k]) diffs.push(`${n}.${k} ${a[n][k]} | ${c[n][k]}`);
332
- }
333
- }
334
- ok(`I11 styles and geometry match the mockup at ${w} px, ${th}`, diffs.length === 0, diffs.join(' ; '));
335
- await m.context().close(); await R.ctx.close();
336
- }
324
+ /* I11 fidelity to the Agreed design (AgInsGoals, AgInsPhone): Nunito, the cozy panel, the pill tabs, the table and the strip */
325
+ for (const [w, h] of [[1440, 900], [390, 844]]) {
326
+ const R = await open({ w, h }); await sleep(300);
327
+ 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
+ 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) }; });
329
+ 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)' && (phone || f.rowH >= 60) && !f.over && f.fab === 56 && (phone ? f.fabX > 300 : f.fabX === 36), JSON.stringify(f));
331
+ await R.ctx.close();
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)));
355
+ await R.ctx.close();
337
356
  }
338
357
  return finish();
339
358
  })().catch((e) => { console.error(e); finish(1); });
@@ -8,8 +8,6 @@ const fs = require('fs');
8
8
  const path = require('path');
9
9
  const { spawn } = require('child_process');
10
10
  const { findBrowser } = require('./lib/find-browser');
11
- const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
12
- const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
13
11
  const T = require('./test-run').configure({ name: 'briefing-premium-metrics' });
14
12
  const BP = require('./lib/board-premium.js');
15
13
  const MP = require('./lib/board-metrics-premium.js');
@@ -31,7 +29,6 @@ const finish = async (code) => {
31
29
  };
32
30
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
33
31
 
34
- const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html');
35
32
  const NOW = Date.now(), W = MP.weeksTo(NOW);
36
33
  const runsIn = (wk, count, corr) => Array.from({ length: count }, (_, k) => ({ created_at: new Date(W[wk].from + (k + 1) * 60000).toISOString(), human_corrections: k < corr ? 1 : 0 }));
37
34
  const I = (id, o) => Object.assign({ id, accepted: false, stopped: false, steps: [], last_activity: new Date(NOW - 3 * 86400000).toISOString() }, o);
@@ -59,6 +56,7 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
59
56
  await page.route('**/api/briefing-premium/**', (r) => { const rq = r.request(); if (rq.method() === 'GET') return r.fulfill({ contentType: 'application/json', body: JSON.stringify(thread) }); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); return r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
60
57
  await page.goto(BASE + '/premium-board.html?theme=' + theme);
61
58
  await until(() => page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 20000);
59
+ await page.evaluate(() => { const m = document.querySelector('#miMet'); if (m) m.click(); }); // the Agreed design opens the Metrics card from the ⋯ menu (premium-agreed-design)
62
60
  return { ctx, page, errors, posts, calls: () => calls, setThread: (t) => { thread = t; } };
63
61
  };
64
62
 
@@ -67,8 +65,8 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
67
65
  const shown = await until(() => p.evaluate(() => !document.querySelector('#cMet').hidden && document.querySelectorAll('#metBody .mt1').length === 4));
68
66
  ok('C1 a tenant board draws the Metrics card with four tiles', shown);
69
67
  if (!shown) return finish(1);
70
- const place = await p.evaluate(() => ({ above: document.querySelector('#cMet').getBoundingClientRect().bottom <= document.querySelector('#cIni').getBoundingClientRect().top, cap: document.querySelector('#metCap').textContent, h: document.querySelector('#hMet').textContent }));
71
- ok('C1 the card sits above the Initiatives card and says which repository it counts', place.above && place.cap === 'counted from idpf' && place.h === 'Metrics', JSON.stringify(place));
68
+ const place = await p.evaluate(() => ({ above: !document.querySelector('#popMet').hidden && !!document.querySelector('#popMet #cMet'), cap: document.querySelector('#metCap').textContent, h: document.querySelector('#hMet').textContent }));
69
+ ok('C1 the card opens from the ⋯ menu (Agreed design; it sat above the Initiatives card before) and says which repository it counts', place.above && place.cap === 'counted from idpf' && place.h === 'Metrics', JSON.stringify(place));
72
70
 
73
71
  /* C2 */
74
72
  const tiles = await p.evaluate(() => [...document.querySelectorAll('#metBody .mt1')].map((t) => ({ l: t.querySelector('span').textContent, v: t.querySelector('.mval').textContent, c: t.querySelector('.mwk').textContent, chart: !!t.querySelector('svg'), cls: t.className, chg: (t.querySelector('.mchg') || {}).textContent || '' })));
@@ -110,6 +108,7 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
110
108
  A.setThread({ ok: true, working: false, turns: [] }); await p.fill('#askIn', 'Why did it fall?'); const n0 = A.posts.length; await p.press('#askIn', 'Enter');
111
109
  ok('C4 a question posts the metric\'s key and the text', await until(() => A.posts.length > n0 && A.posts[A.posts.length - 1].path === '/api/briefing-premium/ask' && A.posts[A.posts.length - 1].body.key === 'board:metric-corrections' && A.posts[A.posts.length - 1].body.text === 'Why did it fall?'), JSON.stringify(A.posts.slice(-1)));
112
110
  await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
111
+ await p.evaluate(() => { if (document.querySelector('#popMet').hidden) document.querySelector('#miMet').click(); }); // the dialog's close leaves the Metrics popover shut
113
112
  await p.locator('#metBody .mt1').nth(2).click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(400);
114
113
  ok('C4 Blocked opens its definition, and the weeks before its history started read Not kept yet', await p.evaluate(() => { const v = [...document.querySelectorAll('#oMain .vtb div b')].map((b) => b.textContent); return document.querySelector('#dTitle').textContent === 'Blocked' && /blocked step/.test(document.querySelector('#oMain .lede').textContent) && v.length === 8 && v.slice(0, 7).every((x) => x === 'Not kept yet') && v[7] === '1'; }));
115
114
  await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
@@ -190,35 +189,15 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
190
189
  await ctx.close();
191
190
  }
192
191
 
193
- /* C8 fidelity against the mockup */
194
- if (!fs.existsSync(MOCKUP)) ok('C8 the mockup is in the repository', false, MOCKUP);
195
- else {
196
- const SEL = [['card', '#cMet'], ['heading', '#hMet'], ['hint', '#cMet .mhint'], ['note', '#cMet .note'], ['t1', '#cMet .mt1:nth-child(1)'], ['t1val', '#cMet .mt1:nth-child(1) .mval'], ['t1cap', '#cMet .mt1:nth-child(1) .mwk'], ['t1chg', '#cMet .mt1:nth-child(1) .mchg'], ['t1svg', '#cMet .mt1:nth-child(1) svg'], ['t1line', '#cMet .mt1:nth-child(1) .ln2'], ['t1dot', '#cMet .mt1:nth-child(1) .dt'], ['t1foot', '#cMet .mt1:nth-child(1) .mfoot'], ['t3', '#cMet .mt1:nth-child(3)'], ['t3val', '#cMet .mt1:nth-child(3) .mval'], ['t3cap', '#cMet .mt1:nth-child(3) .mwk'], ['t4', '#cMet .mt1:nth-child(4)'], ['t4lab', '#cMet .mt1:nth-child(4) span']];
197
- const SKIP_W = new Set(['hint', 'note', 't1val', 't1cap', 't1chg', 't1foot', 't3val', 't3cap', 't4lab', 'heading']);
198
- const SKIP_L = new Set(['t1val', 't1cap', 't1chg', 't1foot', 't3val', 't3cap', 't4lab', 'hint', 'note']);
199
- const PROPS = ['fontSize', 'fontWeight', 'fontFamily', 'color', 'backgroundColor', 'borderRadius', 'paddingTop', 'paddingLeft', 'letterSpacing', 'lineHeight', 'boxShadow', 'stroke', 'strokeWidth', 'fill', 'marginTop'];
200
- const grab = (pg) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s] of pairs) { const e = document.querySelector('main.stage:not([hidden]) ' + s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [SEL, PROPS]);
192
+ /* C8 the card keeps every part of the mockup's card, in the Agreed design's type (premium-agreed-design: the Board is drawn to the AgBoard frames,
193
+ so the card no longer copies the retired briefing mockup's geometry and type; the same parts are checked, each drawn and visible) */
194
+ {
195
+ const SEL = [['card', '#cMet'], ['heading', '#hMet'], ['hint', '#cMet .mhint'], ['note', '#cMet .note'], ['t1', '#cMet .mt1:nth-child(1)'], ['t1val', '#cMet .mt1:nth-child(1) .mval'], ['t1cap', '#cMet .mt1:nth-child(1) .mwk'], ['t1chg', '#cMet .mt1:nth-child(1) .mchg'], ['t1svg', '#cMet .mt1:nth-child(1) svg'], ['t1line', '#cMet .mt1:nth-child(1) .ln2'], ['t1dot', '#cMet .mt1:nth-child(1) .dt'], ['t1foot', '#cMet .mt1:nth-child(1) .mfoot'], ['t3', '#cMet .mt1:nth-child(3)']];
201
196
  for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
202
- const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
203
- await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
204
- await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
205
- await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="init"]').click(); }, th);
206
- await until(() => m.evaluate(() => document.querySelectorAll('#cMet .mt1').length > 0));
207
- await m.evaluate(() => { drawBoardPage(BOARDS.find((b) => b.real)); }); // the mockup's one board that is read from a repository: four tiles, none with a target
208
- await until(() => m.evaluate(() => document.querySelectorAll('#cMet .mt1').length === 4 && !!document.querySelector('#cMet .note'))); await sleep(900);
209
197
  const R = await open({ w, h, theme: th }); await until(() => R.page.evaluate(() => document.querySelectorAll('#metBody .mt1').length === 4)); await sleep(500);
210
- const a = await grab(m), c = await grab(R.page), diffs = [];
211
- for (const [n] of SEL) {
212
- if (!a[n] || !c[n]) { diffs.push(n + ' missing'); continue; }
213
- for (const k of Object.keys(a[n])) {
214
- const geom = k === 'left' || k === 'width';
215
- if (geom && ((k === 'width' && SKIP_W.has(n)) || (k === 'left' && SKIP_L.has(n)))) continue;
216
- if (k === 'boxShadow' && /^t[1-4]$/.test(n)) continue; // a tile that needs a look carries the orange outline here; the mockup's real board draws it only off target
217
- if (geom ? Math.abs(a[n][k] - c[n][k]) > 2 : a[n][k] !== c[n][k]) diffs.push(`${n}.${k} ${a[n][k]} | ${c[n][k]}`);
218
- }
219
- }
220
- ok(`C8 styles and geometry match the mockup at ${w} px, ${th}`, diffs.length === 0, diffs.join(' ; '));
221
- await m.context().close(); await R.ctx.close();
198
+ const c = await R.page.evaluate((pairs) => { const miss = []; for (const [n, q] of pairs) { const e = document.querySelector(q); const r = e && e.getBoundingClientRect(); if (!e || ((!r.width || !r.height) && !e.closest('#metFold'))) miss.push(n); } /* the hint and the note sit in the card's info fold (premium-calmer-first-screen) */ return { miss, font: getComputedStyle(document.querySelector('#cMet')).fontFamily, over: document.documentElement.scrollWidth > innerWidth + 1 }; }, SEL);
199
+ ok(`C8 the Metrics card draws every part, in Nunito, with no sideways scroll at ${w} px, ${th}`, c.miss.length === 0 && /Nunito/.test(c.font) && !c.over, JSON.stringify(c));
200
+ await R.ctx.close();
222
201
  }
223
202
  }
224
203
  return finish();