create-pmos 0.397.0 → 0.398.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +101 -52
  8. package/workspace/briefing-premium-board-test.js +252 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +86 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  13. package/workspace/briefing-premium-initiative-test.js +159 -296
  14. package/workspace/briefing-premium-insights-test.js +337 -219
  15. package/workspace/briefing-premium-metrics-test.js +53 -97
  16. package/workspace/briefing-premium-products-test.js +40 -27
  17. package/workspace/briefing-premium-sources-test.js +66 -48
  18. package/workspace/briefing-premium-test.js +150 -647
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +12 -0
  21. package/workspace/fixtures/board-premium-trail.js +32 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  23. package/workspace/guide/briefing-premium.md +3 -1
  24. package/workspace/guide/home.md +47 -0
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/lib/agent-roles.js +71 -0
  27. package/workspace/lib/board-premium.js +85 -19
  28. package/workspace/lib/board-trail.js +223 -0
  29. package/workspace/lib/home-work-item.js +58 -0
  30. package/workspace/lib/insights-goals.js +196 -0
  31. package/workspace/lib/insights-premium.js +62 -14
  32. package/workspace/lib/insights-records.js +101 -0
  33. package/workspace/lib/jira-tickets.js +1 -1
  34. package/workspace/lib/route-modules.js +4 -0
  35. package/workspace/lib/routes-board-trail.js +33 -0
  36. package/workspace/lib/routes-home-desk.js +176 -0
  37. package/workspace/lib/routes-insights-premium.js +12 -3
  38. package/workspace/lib/routes-insights-records.js +129 -0
  39. package/workspace/lib/routes-notes.js +1 -0
  40. package/workspace/lib/routes-viewer.js +108 -0
  41. package/workspace/lib/transcript-steps.js +123 -0
  42. package/workspace/lib/viewer-meeting.js +205 -0
  43. package/workspace/lib/viewer-report.js +89 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/premium-board-actions-test.js +85 -75
  47. package/workspace/premium-briefing-depth-test.js +66 -53
  48. package/workspace/premium-chat-attach-test.js +54 -63
  49. package/workspace/premium-chat-chart-tab-test.js +35 -37
  50. package/workspace/premium-chat-context-test.js +19 -18
  51. package/workspace/premium-chat-goal-view-test.js +23 -23
  52. package/workspace/premium-chat-notes-test.js +26 -31
  53. package/workspace/premium-chat-report-tab-test.js +32 -28
  54. package/workspace/premium-chat-term-test.js +16 -16
  55. package/workspace/premium-chat-viewer-test.js +60 -59
  56. package/workspace/premium-core-doc-issue-test.js +50 -43
  57. package/workspace/premium-html-viewer-test.js +14 -17
  58. package/workspace/premium-phone-card-test.js +7 -2
  59. package/workspace/premium-phone-room-test.js +41 -35
  60. package/workspace/premium-report-read-test.js +115 -197
  61. package/workspace/premium-viewer-download-test.js +19 -22
  62. package/workspace/premium-viewer-flicker-test.js +11 -16
  63. package/workspace/premium-viewer-share-test.js +6 -9
  64. package/workspace/premium-viewer-test.js +41 -60
  65. package/workspace/premium-vw-backlog-test.js +53 -33
  66. package/workspace/premium-vw-cal-test.js +82 -128
  67. package/workspace/premium-vw-copy-test.js +17 -33
  68. package/workspace/premium-vw-doc-test.js +11 -10
  69. package/workspace/premium-vw-item-test.js +50 -49
  70. package/workspace/premium-vw-jira-test.js +53 -27
  71. package/workspace/premium-vw-meet-test.js +118 -187
  72. package/workspace/premium-vw-notes-test.js +85 -108
  73. package/workspace/premium-vw-rec-test.js +72 -194
  74. package/workspace/premium-vw-slides-test.js +46 -50
  75. package/workspace/premium-welcome-test.js +3 -2
  76. package/workspace/premium-work-depth-test.js +61 -53
  77. package/workspace/public/pm/bd-acts.js +305 -0
  78. package/workspace/public/pm/bd-span.js +186 -82
  79. package/workspace/public/pm/bd-stages.js +25 -11
  80. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  81. package/workspace/public/pm/c3-md.js +3 -395
  82. package/workspace/public/pm/c3-phone-detail.js +1 -1
  83. package/workspace/public/pm/c3-phone-model.js +3 -68
  84. package/workspace/public/pm/chat-term.js +3 -3
  85. package/workspace/public/pm/cozy-board.css +497 -230
  86. package/workspace/public/pm/cozy-home.css +570 -142
  87. package/workspace/public/pm/cozy-home.js +5 -3
  88. package/workspace/public/pm/cozy-insights.css +296 -167
  89. package/workspace/public/pm/cozy-md.js +396 -0
  90. package/workspace/public/pm/cozy-nav.js +17 -6
  91. package/workspace/public/pm/cozy-placeholder.js +26 -0
  92. package/workspace/public/pm/cozy-viewer.css +3 -3
  93. package/workspace/public/pm/cozy-viewer.js +144 -0
  94. package/workspace/public/pm/cozy-vw.css +485 -0
  95. package/workspace/public/pm/cozy.css +83 -1
  96. package/workspace/public/pm/home-adddoc.js +48 -0
  97. package/workspace/public/pm/home-app.js +905 -0
  98. package/workspace/public/pm/home-around.js +515 -0
  99. package/workspace/public/pm/home-chat.js +459 -0
  100. package/workspace/public/pm/home-data.js +312 -0
  101. package/workspace/public/pm/home-draft.js +68 -0
  102. package/workspace/public/pm/home-more.js +249 -0
  103. package/workspace/public/pm/home-phone-card.js +109 -0
  104. package/workspace/public/pm/home-work.js +519 -0
  105. package/workspace/public/pm/phone-moment.js +69 -0
  106. package/workspace/public/pm/pm-work-view.js +1 -1
  107. package/workspace/public/pm/premium-attach.js +4 -0
  108. package/workspace/public/pm/premium-board.js +423 -394
  109. package/workspace/public/pm/premium-chart-tab.js +110 -62
  110. package/workspace/public/pm/premium-deck.js +3 -3
  111. package/workspace/public/pm/premium-first.js +25 -21
  112. package/workspace/public/pm/premium-insights.js +792 -568
  113. package/workspace/public/pm/premium-meeting.js +61 -549
  114. package/workspace/public/pm/premium-notes.js +1 -1
  115. package/workspace/public/pm/premium-report-frame.css +20 -0
  116. package/workspace/public/pm/premium-report-read.js +509 -480
  117. package/workspace/public/pm/premium-report-tab.js +87 -63
  118. package/workspace/public/pm/premium-shell.js +72 -119
  119. package/workspace/public/pm/premium-viewer.js +22 -1
  120. package/workspace/public/pm/premium-vw-cal.js +187 -48
  121. package/workspace/public/pm/premium-vw-doc.css +6 -0
  122. package/workspace/public/pm/premium-vw-doc.js +40 -2
  123. package/workspace/public/pm/premium-vw-file.js +2 -2
  124. package/workspace/public/pm/premium-vw-meet.js +6 -83
  125. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  126. package/workspace/public/pm/premium-vw-notes.js +56 -69
  127. package/workspace/public/pm/premium-vw-open.js +35 -0
  128. package/workspace/public/pm/premium-vw-page.js +16 -0
  129. package/workspace/public/pm/premium-vw-rec.js +11 -218
  130. package/workspace/public/pm/premium-vw-slides.css +5 -0
  131. package/workspace/public/pm/premium-vw-slides.js +44 -8
  132. package/workspace/public/pm/term-view.js +22 -0
  133. package/workspace/public/premium-board.html +28 -70
  134. package/workspace/public/premium-initiative.html +8 -48
  135. package/workspace/public/premium-insights.html +22 -60
  136. package/workspace/public/premium-viewer.html +20 -0
  137. package/workspace/public/premium.html +16 -107
  138. package/workspace/server.js +18 -3
  139. package/workspace/test-files.json +1 -0
  140. package/workspace/test-lists/home-libs.json +9 -0
  141. package/workspace/test-lists/premium-report-read.json +1 -1
  142. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  143. package/workspace/test-lists/premium-vw-notes.json +1 -1
  144. package/workspace/public/pm/premium-work.js +0 -729
  145. package/workspace/public/pm/premium.js +0 -1146
@@ -1,25 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- /* briefing-premium-calendar-test.js — the Calendar card's day strip (initiative premium-calendar-card; it replaced the Today / This week switch) and the meeting dialog on the premium Briefing (initiative briefing-premium-calendar, slice 1;
4
- * planning/prd/briefing-premium-calendar-prd.md C1 to C10). Serves the real page from the real server. The Briefing model, the calendar answer, the replay and the material
5
- * are answered by stand-ins, so each press can be read off the request the page sent; the routes' own behaviour is in their own suites.
6
- * C1 the switch · C2 the week · C3 honest states · C4 the dialog · C5 link it · C6 notes · C7 material · C8 replay summary · C9 only the link write · C10 floors and fidelity
3
+ /* briefing-premium-calendar-test.js — the calendar's day strip and a meeting opened from it (initiative premium-calendar-card and
4
+ * briefing-premium-calendar, slice 1; planning/prd/briefing-premium-calendar-prd.md C1 to C10; re-pointed for premium-agreed-design, area viewer:
5
+ * the calendar and the meeting open in the Viewer card, /premium-viewer.html, not in the old Briefing card and dialog). Serves the real page from
6
+ * the real server; the calendar, the notes, Focus, the replay and the material are answered by stand-ins (fixtures/premium-viewer-fixtures.js),
7
+ * so each press can be read off the request the page sent. Home's own calendar card (its title and fold) is Home's to test.
8
+ * C1 the strip · C2 the day · C3 honest states · C4 a meeting · C5 link it · C6 notes · C7 material · C8 replay · C9 only the link write · C10 floors
7
9
  * Every wait polls the page; no fixed sleep stands in for a state. */
8
- const fs = require('fs');
9
10
  const path = require('path');
10
11
  const { spawn } = require('child_process');
11
12
  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
13
  const T = require('./test-run').configure({ name: 'briefing-premium-calendar' });
15
- const B = require('./lib/briefing-premium.js');
16
- const F = require('./fixtures/briefing-premium-facts.js');
14
+ const F = require('./fixtures/premium-viewer-fixtures.js');
17
15
 
18
- const BASE = T.BASE;
19
- const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
20
- const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
16
+ const BASE = T.BASE, until = F.until;
21
17
  const results = [];
22
- const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
18
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 500) : ''}`); };
23
19
  let srv = null; let browser = null;
24
20
  const finish = async (code) => {
25
21
  if (browser) await browser.close().catch(() => {});
@@ -30,33 +26,7 @@ const finish = async (code) => {
30
26
  process.exit(code !== undefined ? code : (bad ? 1 : 0));
31
27
  };
32
28
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
33
-
34
- const pad = (n) => String(n).padStart(2, '0');
35
- const dayKey = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
36
- const iso = (d) => { const off = -d.getTimezoneOffset(), a = Math.abs(off); return `${dayKey(d)}T${pad(d.getHours())}:${pad(d.getMinutes())}:00${off >= 0 ? '+' : '-'}${pad(Math.floor(a / 60))}:${pad(a % 60)}`; };
37
- const NOW = new Date();
38
- const at = (h, m, plus = 0) => { const d = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate() + plus, h, m, 0, 0); return d; };
39
- const monday = () => { const d = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate()); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); return d; };
40
- /* a weekday of this week that is not today: Tuesday when today is Monday, else Monday */
41
- const OTHER = () => { const m = monday(); if (NOW.getDay() === 1) m.setDate(m.getDate() + 1); return m; };
42
- const weekAnswer = () => {
43
- const m = monday(), cells = [];
44
- for (let i = 0; i < 7; i++) { const d = new Date(m.getFullYear(), m.getMonth(), m.getDate() + i); cells.push({ key: dayKey(d), start: dayKey(d), end: dayKey(d), events: [] }); }
45
- const put = (d, e) => cells.find((c) => c.key === dayKey(d)).events.push(e);
46
- /* today holds Sprint planning (the Today row); another day of the strip holds Checkout sync and Sprint planning (the rows a picked day lists) */
47
- const o = (h, mm) => { const x = OTHER(); x.setHours(h, mm, 0, 0); return x; };
48
- put(at(14, 0), { id: 'ev-sprint-today', at: iso(at(14, 0)), end: iso(at(15, 0)), title: 'Sprint planning', attendees: ['Dara', 'Priya', 'Sam'], series: 'sprint-planning' });
49
- put(o(9, 30), { id: 'ev-checkout', at: iso(o(9, 30)), end: iso(o(10, 15)), title: 'Checkout sync', attendees: ['Priya', 'Dara'] });
50
- put(o(14, 0), { id: 'ev-sprint', at: iso(o(14, 0)), end: iso(o(15, 0)), title: 'Sprint planning', attendees: ['Dara', 'Priya', 'Sam'], series: 'sprint-planning' });
51
- const lvl = { phase: 'upcoming', level: { kind: 'board', ws: 'w1', id: 'idpf', name: 'IDPF', why: 'you linked it to the board', by: 'pm' } };
52
- return { ok: true, view: 'week', range: { start: cells[0].key, end: cells[6].key }, cells, events_source: 'calendar-memory', today: dayKey(NOW),
53
- context: { 'ev-sprint': lvl, 'ev-sprint-today': lvl },
54
- link_boards: [{ ws: 'w1', id: 'idpf', name: 'IDPF' }, { ws: 'w1', id: 'pay', name: 'Payments' }], gantt: [{ id: 'premium-ux', title: 'Premium UX' }] };
55
- };
56
- const REPLAY = { ok: true, note: { id: 'n1', title: 'Sprint planning notes' }, meeting: { title: 'Sprint planning', attendees: ['Dara', 'Priya', 'Sam'] }, audio: { url: '/x', ms: 1500000 }, length_ms: 1500000, lines: [{}],
57
- keys: [{ k: 'decision', text: 'Plan the sprint with eight people', state: 'draft' }, { k: 'action', text: 'Sam confirms the data fix owner', owner: 'Sam', due: 'Tue', state: 'owner' }, { k: 'question', text: 'Does a release eat the capacity?', state: 'open' }] };
58
- const MATERIAL = { ok: true, key: 'k', items: [{ id: 'm1', kind: 'doc', ref: 'r', title: 'Capacity sheet', scope: 'series' }, { id: 'm2', kind: 'link', url: 'https://x.example', title: 'Roadmap', scope: 'meeting' }] };
59
- const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html'), 'utf8');
29
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
60
30
 
61
31
  (async () => {
62
32
  const exe = findBrowser();
@@ -66,172 +36,92 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
66
36
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
67
37
  await T.waitForServer(BASE);
68
38
  browser = await chromium.launch({ executablePath: exe });
39
+ const W = F.world();
40
+ const tap = (p, sel) => p.$eval('#czViewer ' + sel, (b) => b.click());
41
+ const text = (p) => p.evaluate(() => (document.querySelector('#czViewer') || {}).innerText || '');
42
+ const weekReads = (S) => S.gets.filter((g) => g.startsWith('/api/calendar-views')).length;
43
+ const ALL = [];
44
+ const open = async (url, o) => { const X = await F.open(browser, BASE, url, { noLive: true, ...o }); ALL.push(X); return X; };
69
45
 
70
- const facts = () => { const f = F.facts(); f.meetings = [{ start: at(14, 0).getTime(), end: at(15, 0).getTime(), title: 'Sprint planning', with: 'Dara, Priya, Sam', initiative: null }]; return f; };
71
- const open = async ({ w = 1280, h = 900, theme = 'light', week = weekAnswer(), replay = 404, material = MATERIAL, linkRes = { ok: true, link: { kind: 'portfolio' } } } = {}) => {
72
- const ctx = await browser.newContext({ viewport: { width: w, height: h } });
73
- const page = await ctx.newPage();
74
- const S = { errors: [], reqs: [], posts: [], weekGets: [], replayGets: [] };
75
- page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
76
- page.on('request', (r) => { if (r.url().startsWith(BASE)) S.reqs.push(r.method() + ' ' + new URL(r.url()).pathname); });
77
- const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
78
- await page.route('**/api/briefing-premium*', (r) => json(r, { ok: true, state: 'ready', model: B.build(facts()), as_of: Date.now() }));
79
- await page.route('**/api/calendar-views*', (r) => {
80
- const q = new URL(r.request().url()).search;
81
- if (/only=gantt/.test(q)) return json(r, { ok: true, view: 'quarter', gantt: [], no_plan: 0 }); // the Around you card's pulse, not the week
82
- S.weekGets.push(q); json(r, week, week && week.ok === false ? 500 : 200);
83
- });
84
- await page.route('**/api/meeting-replay*', (r) => { S.replayGets.push(new URL(r.request().url()).search); if (replay === 404) json(r, { ok: false, error: 'no note for that meeting' }, 404); else json(r, replay); });
85
- await page.route('**/api/meeting-material*', (r) => json(r, material));
86
- await page.route('**/api/calendar-links', (r) => { S.posts.push(JSON.parse(r.request().postData() || '{}')); json(r, linkRes, linkRes.ok ? 200 : 403); });
87
- await page.goto(BASE + '/premium.html?theme=' + theme);
88
- S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0 && document.querySelectorAll('#tl .ev').length > 0), 20000);
89
- return Object.assign(S, { ctx, page });
90
- };
91
- const strip = (p) => until(() => p.evaluate(() => document.querySelectorAll('#wkStrip [data-day]').length === 5));
92
- const week = (p) => strip(p).then(() => p.click(`#wkStrip [data-day="${dayKey(OTHER())}"]`)).then(() => until(() => p.evaluate(() => !!document.querySelector('#tl .wkd') || /Calendar not read/.test(document.querySelector('#tl').textContent))));
93
-
94
- const A = await open();
95
- ok('0 the page draws the list and Today', A.up);
96
- if (!A.up) return finish(1);
46
+ /* C1 the strip */
47
+ const A = await open('/premium-viewer.html?open=calendar');
97
48
  const p = A.page;
49
+ ok('C1 the calendar opens in the Viewer card', await until(() => p.evaluate(() => document.querySelectorAll('#czViewer .vz-day').length === 5), 15000));
50
+ const strip = await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-day')].map((d) => ({ dow: d.querySelector('span').textContent, on: d.getAttribute('aria-pressed'), h: Math.round(d.getBoundingClientRect().height) })));
51
+ ok('C1 the strip has Monday to Friday and today is pressed', strip.map((d) => d.dow).join() === 'MON,TUE,WED,THU,FRI' && strip.filter((d) => d.on === 'true').length === 1, JSON.stringify(strip));
52
+ ok('C1 each day button is at least 44 px', strip.every((d) => d.h >= 44), JSON.stringify(strip));
53
+ ok('C1 the week is read once when the page opens, for today\'s week', weekReads(A.S) === 1 && A.S.gets.some((g) => g.includes('view=week')), JSON.stringify(A.S.gets.filter((g) => g.startsWith('/api/calendar-views'))));
98
54
 
99
- /* C1 the card: titled Calendar, a strip of five days, today picked and the Today timeline below */
100
- await strip(p);
101
- const sw = await p.evaluate(() => ({ title: document.querySelector('#hToday').textContent, days: [...document.querySelectorAll('#wkStrip [data-day]')].map((b) => b.dataset.day + ':' + b.getAttribute('aria-pressed')), box: [...document.querySelectorAll('#wkStrip [data-day]')].map((b) => { const r = b.getBoundingClientRect(); return Math.round(Math.min(r.width, r.height)); }), ahead: !!document.querySelector('#tl .grp'), sw: !!document.querySelector('#rng'), fold: document.querySelector('#todayCard .foldb').getAttribute('aria-expanded') }));
102
- const isWeekday = NOW.getDay() >= 1 && NOW.getDay() <= 5;
103
- // re-pointed for premium-agreed-design: on Home the calendar is the list's Today group (premium.html #hToday reads Today, not Calendar)
104
- ok('C1 the card is titled Today, has no Today / This week switch, and is open at 1280 px', sw.title === 'Today' && !sw.sw && sw.fold === 'true', JSON.stringify(sw));
105
- ok('C1 the strip has Monday to Friday, today is pressed, and Today is unchanged', sw.days.length === 5 && sw.days.filter((x) => /:true$/.test(x)).length === (isWeekday ? 1 : 0) && (!isWeekday || sw.days.includes(dayKey(NOW) + ':true')) && sw.ahead, JSON.stringify(sw.days));
106
- ok('C1 each day button is at least 44 px', sw.box.every((n) => n >= 44), JSON.stringify(sw.box));
107
- ok('C1 the week is read once when the page opens, for today\'s date', A.weekGets.length === 1 && /view=week/.test(A.weekGets[0]) && A.weekGets[0].includes('date=' + dayKey(NOW)), JSON.stringify(A.weekGets));
55
+ /* C2 the day */
56
+ const today = await text(p);
57
+ ok('C2 Today names the day and counts its entries', /Today, \w{3} \d{1,2} \w{3}\s+\d+ entr(y|ies)/.test(today), today.slice(0, 400));
58
+ ok('C2 a row shows the time, the title, what it is about and the people', /\d{2}:\d{2}\s+Rail review\s+Viewer · Sam, Wawan/.test(today), today.slice(0, 600));
59
+ await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-day')].find((d) => d.getAttribute('aria-pressed') === 'false' && d.querySelector('i').hasAttribute('data-on')).click());
60
+ ok('C2 pressing a day lists that day only, with its count', await until(async () => { const t = await text(p); return /1:1 with Dita/.test(t) && !/Rail review/.test(t) && /\b1 entry\b/.test(t); }), (await text(p)).slice(0, 400));
61
+ ok('C2 another day of the same week is not read again', weekReads(A.S) === 1);
62
+ await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-day')].find((d) => /today/.test(d.querySelector('small').textContent)).click());
63
+ ok('C2 pressing today brings Today back unchanged', await until(async () => (await text(p)) === today));
108
64
 
109
- /* C2 another day */
110
- await week(p);
111
- const wk = await p.evaluate(() => ({
112
- days: [...document.querySelectorAll('#tl .wkd')].map((d) => d.textContent), rows: [...document.querySelectorAll('#tl .ev')].map((e) => e.querySelector('b').textContent + '|' + e.querySelector('time').textContent + '|' + e.querySelector('.d').textContent),
113
- cap: document.querySelector('#todayCap').textContent, filter: getComputedStyle(document.querySelector('#todayCard .fbtn')).display,
114
- pressed: [...document.querySelectorAll('#wkStrip [aria-pressed="true"]')].map((b) => b.dataset.day), label: document.querySelector('#tl').getAttribute('aria-label') }));
115
- ok('C2 pressing a day lists that day only, with its count', wk.days.length === 1 && /2 meetings/.test(wk.days[0]) && wk.pressed.join() === dayKey(OTHER()), JSON.stringify(wk));
116
- ok('C2 a row shows time, title, length, people and what it is about', wk.rows.some((r) => r === 'Sprint planning|14:00|1 h · with Dara, Priya, Sam · Board: IDPF') && wk.rows.some((r) => r === 'Checkout sync|09:30|45 min · with Priya, Dara'), JSON.stringify(wk.rows));
117
- ok('C2 the caption counts the day\'s meetings and the source filter is hidden', /^2 meetings/.test(wk.cap) && wk.filter === 'none', JSON.stringify(wk));
118
- if (isWeekday) {
119
- await p.click(`#wkStrip [data-day="${dayKey(NOW)}"]`);
120
- const back = await p.evaluate(() => ({ ahead: !!document.querySelector('#tl .grp'), wk: !!document.querySelector('#tl .wkd'), filter: getComputedStyle(document.querySelector('#todayCard .fbtn')).display, cap: document.querySelector('#todayCap').textContent }));
121
- ok('C2 pressing today brings Today back unchanged', back.ahead && !back.wk && back.filter !== 'none' && /earlier · \d+ ahead/.test(back.cap), JSON.stringify(back));
122
- await week(p);
123
- }
65
+ /* C4 a meeting */
66
+ await p.evaluate(() => [...document.querySelectorAll('#czViewer .vz-row')].find((r) => /Rail review/.test(r.textContent)).click());
67
+ ok('C4 a row opens the meeting card with its title and when', await until(async () => /Rail review/.test(await p.textContent('#czViewer .cz-vw-title')) && /Today \d{2}:\d{2} to \d{2}:\d{2}/.test(await text(p))), (await text(p)).slice(0, 300));
68
+ ok('C4 the card reads Focus for that meeting, and no replay (it has no note)', await until(() => A.S.gets.some((g) => /meeting-focus\?event=ev-rail/.test(g))) && !A.S.gets.some((g) => /meeting-replay/.test(g)));
69
+ ok('C4 the card has no conversation and no tabs', await p.evaluate(() => !document.querySelector('#dlg, .stream, #vTabs')));
124
70
 
125
- /* C11 hide and show */
126
- await p.click('#todayCard .foldb');
127
- const hid = await p.evaluate(() => ({ fold: document.querySelector('#todayCard').classList.contains('calhid'), tl: getComputedStyle(document.querySelector('#tl')).display, strip: getComputedStyle(document.querySelector('#wkStrip')).display, line: document.querySelector('#todayCard .folds').textContent, shown: !document.querySelector('#todayCard .folds').hidden, exp: document.querySelector('#todayCard .foldb').getAttribute('aria-expanded') }));
128
- ok('C11 the chevron hides the card to its header and one line', hid.fold && hid.tl === 'none' && hid.strip === 'none' && hid.shown && hid.exp === 'false' && /meetings? this week/.test(hid.line), JSON.stringify(hid));
129
- const H2p = await A.ctx.newPage(); await H2p.goto(BASE + '/premium.html?theme=light');
130
- ok('C11 a reload keeps it hidden', await until(() => H2p.evaluate(() => document.querySelector('#todayCard').classList.contains('calhid'))));
131
- await H2p.click('#todayCard .folds');
132
- ok('C11 pressing the line shows it again, and that is kept', await until(() => H2p.evaluate(() => !document.querySelector('#todayCard').classList.contains('calhid') && localStorage.getItem('pmos.premium.calfold.brief') === '0')));
133
- await H2p.close();
134
- await p.click('#todayCard .foldb');
135
- await until(() => p.evaluate(() => !document.querySelector('#todayCard').classList.contains('calhid')));
71
+ /* C6, C7, C8 the parts */
72
+ ok('C6 with no note the card says the notes are written after the meeting', /Notes and next steps\s+Written after the meeting/.test(await text(p)));
73
+ ok('C7 the material is listed, with who linked it and its topic', /Material 2 linked/.test(await text(p)) && /Rail PRD\s+added by you/.test(await text(p)) && /For The report panel/.test(await text(p)));
74
+ ok('C8 with no recording the card offers no Replay', !(await p.$('#czViewer [data-a="replay"]')));
136
75
 
137
- /* C4 C5 C6 C7 C8: the dialog from a week row */
138
- await p.focus('#tl .ev[data-w]');
139
- const rowKey = await p.evaluate(() => { const r = [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Sprint planning'); r.id = 'rowSprint'; return r.dataset.w; });
140
- await p.click('#rowSprint');
141
- const dlg = await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && /Capacity sheet/.test(document.querySelector('#oMain').textContent) ? { title: document.querySelector('#dTitle').textContent, eye: document.querySelector('#dEye').textContent, sub: document.querySelector('#dSub').textContent, text: document.querySelector('#oMain').textContent, ask: document.querySelector('#askF').hidden } : null));
142
- ok('C4 a week row opens the standard dialog with its title and when', dlg && dlg.title === 'Sprint planning' && /14:00/.test(dlg.sub) && /Calendar/.test(dlg.eye), JSON.stringify(dlg));
143
- ok('C4 the dialog reads the replay and the material of that meeting', A.replayGets.some((q) => q.includes('event=ev-sprint')) && !!dlg);
144
- ok('C6 with no note the dialog says so', dlg && /No notes for this meeting\./.test(dlg.text));
145
- ok('C7 the material is listed with the scope it was linked at', dlg && /Capacity sheet/.test(dlg.text) && /every meeting of this series/.test(dlg.text) && /Roadmap/.test(dlg.text) && /for this meeting/.test(dlg.text));
146
- ok('C8 with no recording the dialog draws no Replay', dlg && !/Replay/.test(dlg.text) && !/recording/i.test(dlg.text));
147
- ok('C4 a week row has its own conversation too (premium-popup-context P1)', dlg && dlg.ask === false);
148
- ok('C5 the dialog says what it is about, and that the calendar is never written', dlg && /It is about Board: IDPF/.test(dlg.text) && /calendar itself is never written/.test(dlg.text));
149
- await p.keyboard.press('Escape');
150
- // re-pointed for premium-agreed-design H2: on a desktop Home the chat is docked and stays open, so Escape takes the meeting's
151
- // conversation back to the PM's own chat (title "Chat", the docked #dlg stays on) instead of closing the dialog; focus still returns to the row
152
- const closed = await until(() => p.evaluate(() => { const g = document.querySelector('#dlg'); return !g.classList.contains('on') || (document.body.classList.contains('cz-dock') && document.querySelector('#dTitle').textContent === 'Chat'); }));
153
- ok('C4 Escape closes the meeting\'s dialog and focus returns to the row', closed && await until(() => p.evaluate(() => document.activeElement && document.activeElement.id === 'rowSprint'), 3000));
76
+ /* C5 link it: a calendar meeting is linked for its whole series */
77
+ await tap(p, '[data-a="more"]');
78
+ await tap(p, '[data-a="m-about"]');
79
+ const opts = await until(() => p.evaluate(() => { const s = document.querySelector('#czViewer [data-a="aboutsel"]'); return s ? [...s.options].map((o) => o.textContent) : null; }));
80
+ ok('C5 the choices are the Portfolio, the boards and Remove the link, marked Waiting for design', opts && opts.join('|') === 'Choose|Portfolio|Board: Growth|Remove the link' && !!(await p.$('#czViewer [data-cz-placeholder="About picker"]')), JSON.stringify(opts));
81
+ ok('C5 it says it applies to every meeting and the calendar is never written', /Applies to every meeting of “Rail review”\. The calendar itself is never written\./.test(await text(p)));
82
+ await tap(p, '[data-a="aboutgo"]');
83
+ ok('C5 Link it with no choice writes nothing', A.S.posts.length === 0);
84
+ const r0 = weekReads(A.S);
85
+ await p.selectOption('#czViewer [data-a="aboutsel"]', 'board|w1|b1');
86
+ await tap(p, '[data-a="aboutgo"]');
87
+ const link = await until(() => A.S.posts.find((x) => x.path === '/api/calendar-links'));
88
+ ok('C5 the press posts one link to /api/calendar-links for the meeting', link && JSON.stringify(link.body).includes('Rail review') && JSON.stringify(link.body).includes('b1') && A.S.posts.length === 1, JSON.stringify(link && link.body));
89
+ ok('C5 after the write the week is read again and the card says Linked', await until(async () => weekReads(A.S) > r0 && /Linked\./.test(await text(p))), String(weekReads(A.S)) + ' ' + r0 + ' ' + (await text(p)).slice(0, 300));
154
90
 
155
- /* C5 link it */
156
- await p.click('#rowSprint');
157
- await until(() => p.evaluate(() => !!document.querySelector('#mtgSel') && /Capacity sheet/.test(document.querySelector('#oMain').textContent)));
158
- await p.click('#oMain .vm-menu > summary'); await p.click('#oMain [data-vm="about"]'); // Change what it is about, in the More menu, opens the choice
159
- const dis = await p.evaluate(() => document.querySelector('#mtgLink').disabled);
160
- ok('C5 Link it is off until a choice is made', dis === true);
161
- const optsText = await p.evaluate(() => [...document.querySelectorAll('#mtgSel option')].map((o) => o.textContent));
162
- ok('C5 the choices are the Portfolio, the answer\'s boards and initiatives, and removing the link', optsText.includes('Portfolio') && optsText.includes('Board: Payments') && optsText.includes('Initiative: Premium UX') && optsText.includes('Remove the link'), JSON.stringify(optsText));
163
- await p.selectOption('#mtgSel', 'board|w1|pay');
164
- await p.click('#mtgLink');
165
- await until(() => A.posts.length === 1);
166
- ok('C5 the press posts one link to /api/calendar-links for the meeting and its series', A.posts.length === 1 && A.posts[0].kind === 'board' && A.posts[0].board === 'pay' && A.posts[0].ws === 'w1' && A.posts[0].event.title === 'Sprint planning' && A.posts[0].event.series === 'sprint-planning', JSON.stringify(A.posts));
167
- ok('C5 after the write the week is read again', await until(() => A.weekGets.length >= 2));
168
- await p.keyboard.press('Escape');
91
+ /* C9 only the link write */
92
+ ok('C9 the only write the page sent is the link', [...new Set(A.S.posts.map((x) => x.path))].join() === '/api/calendar-links', A.S.posts.map((x) => x.path).join());
93
+ ok('C9 no recording, Focus or material write was sent', !A.S.posts.some((x) => /notes|meeting-focus|meeting-material/.test(x.path)));
94
+ await A.ctx.close();
169
95
 
170
- /* C3 honest states */
171
- const E = await open({ week: { ok: false, error: 'the calendar could not read the repository: boom' } });
172
- await week(E.page);
173
- const er = await E.page.evaluate(() => ({ text: document.querySelector('#tl').textContent, rows: document.querySelectorAll('#tl .ev').length, cap: document.querySelector('#todayCap').textContent }));
174
- ok('C3 a failed read says "Calendar not read" with the reason and draws no meeting', /Calendar not read\./.test(er.text) && /boom/.test(er.text) && er.rows === 0 && er.cap === 'Calendar not read', JSON.stringify(er));
175
- const Z = await open({ week: Object.assign(weekAnswer(), { cells: weekAnswer().cells.map((c) => Object.assign({}, c, { events: [] })), context: {} }) });
176
- await week(Z.page);
177
- ok('C3 an empty day says so', await Z.page.evaluate(() => /^No meetings/.test(document.querySelector('#todayCap').textContent) && /No meetings\./.test(document.querySelector('#tl').textContent) && document.querySelectorAll('#tl .ev').length === 0));
178
-
179
- /* C6 C8 with a note and a recording */
180
- const R = await open({ replay: REPLAY });
181
- await week(R.page);
182
- await R.page.evaluate(() => { [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Sprint planning').click(); });
183
- const rd = await until(() => R.page.evaluate(() => /Next step/.test(document.querySelector('#oMain').textContent) ? document.querySelector('#oMain').textContent : null));
184
- const owner = await R.page.evaluate(() => { const c = document.querySelector('#oMain [data-vm-t="actions"] tbody tr'); return c ? [...c.children].slice(1, 3).map((x) => x.textContent).join(' · ') : ''; });
185
- ok('C6 the note\'s decisions, next steps and questions are listed as the note holds them', rd && /Plan the sprint with eight people/.test(rd) && /Sam confirms the data fix owner/.test(rd) && /^Sam · Tue/.test(owner) && /Does a release eat the capacity\?/.test(rd) && /Sprint planning notes/.test(rd), String(rd).slice(0, 300));
186
- ok('C8 a kept recording is summarised, and Replay opens in the dialog', rd && /A recording is kept: 25 min, 3 key points/.test(rd) && /Replay/.test(rd) && !/Replay opens in the console/.test(rd));
187
- const ppl = await R.page.evaluate(() => [...document.querySelectorAll('#oMain .vm-ppl .pp')].map((x) => x.lastChild.textContent).join(', '));
188
- ok('C6 the replay answer\'s people are used only when the calendar lists none', rd && ppl === 'Dara, Priya, Sam', ppl);
96
+ /* C8 a kept recording offers Replay */
97
+ const R = await open('/premium-viewer.html?open=meeting&note=n1');
98
+ ok('C8 a kept recording offers Replay, and the card reads its replay', await until(() => R.page.evaluate(() => !!document.querySelector('#czViewer [data-a="replay"]')), 15000) && R.S.gets.some((g) => /meeting-replay\?note=n1/.test(g)));
99
+ await R.ctx.close();
189
100
 
190
- /* C4 a Today row opens the same dialog when the calendar answer knows the meeting */
191
- const Tt = await open({ replay: REPLAY });
192
- await Tt.page.evaluate(() => { [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Sprint planning').click(); });
193
- const td = await until(() => Tt.page.evaluate(() => /Capacity sheet/.test(document.querySelector('#oMain').textContent) ? { ask: document.querySelector('#askF').hidden, title: document.querySelector('#dTitle').textContent } : null));
194
- ok('C4 a Today meeting row opens the full dialog and keeps its conversation', td && td.title === 'Sprint planning' && td.ask === false, JSON.stringify(td));
195
- const Mg = await open({ week: { ok: false, error: 'down' } });
196
- await Mg.page.evaluate(() => { [...document.querySelectorAll('#tl .ev')].find((e) => e.dataset.kind !== 'x' && e.querySelector('b').textContent === 'Sprint planning').click(); });
197
- ok('C4 when the calendar answer is down, a Today row keeps the plain dialog', await until(() => Mg.page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dTitle').textContent === 'Sprint planning' && !document.querySelector('#mtgSel'))));
101
+ /* C3 honest states */
102
+ const E = await open('/premium-viewer.html?open=calendar');
103
+ await E.page.route('**/api/calendar-views*', (r) => { const w = W.week(); w.cells.forEach((c) => { c.events = []; }); return json(r, w); });
104
+ await E.page.route(/\/api\/notes(\?.*)?$/, (r) => json(r, { ok: true, notes: [], series_open: {} }));
105
+ await E.page.reload();
106
+ ok('C3 an empty day says so', await until(async () => /Today, .*\s+No meetings/.test(await text(E.page)) && !(await E.page.$('#czViewer .vz-row[data-c="open"]'))), (await text(E.page)).slice(0, 400));
107
+ await E.page.route('**/api/calendar-views*', (r) => json(r, { ok: false, error: 'the calendar is not connected' }, 500));
108
+ await E.page.reload();
109
+ ok('C3 a failed read says the calendar was not read, with the reason, and draws no meeting', await until(async () => /The calendar was not read\. the calendar is not connected/.test(await text(E.page))) && !(await E.page.$('#czViewer .vz-row[data-c="open"]')), (await text(E.page)).slice(0, 300));
110
+ await E.ctx.close();
198
111
 
199
- /* C9 */
200
- // an opened popup is recorded for its lead (popup context slice 11, R1); that record is not a press
201
- const allPosts = [].concat(A.reqs, R.reqs, Tt.reqs).filter((r) => /^POST /.test(r) && r !== 'POST /api/briefing-premium/seen');
202
- ok('C9 the only write the page sent is the link', allPosts.length === 1 && allPosts[0] === 'POST /api/calendar-links', JSON.stringify(allPosts));
203
- ok('C9 no recording, Focus or material write was sent', ![].concat(A.reqs, R.reqs, Tt.reqs).some((r) => /POST \/api\/(notes|meeting-focus|meeting-material)/.test(r)));
204
- ok('C9 no page error', [A, E, Z, R, Tt, Mg].every((x) => x.errors.length === 0), JSON.stringify([A, E, Z, R, Tt, Mg].map((x) => x.errors)));
112
+ /* C4 Escape closes the card */
113
+ const G = await open('/premium-viewer.html?open=meeting&event=ev-rail&date=' + F.dayKey(W.RAIL));
114
+ await until(() => G.page.evaluate(() => !!document.querySelector('#czViewer .vz-mtg')), 15000);
115
+ await G.page.keyboard.press('Escape');
116
+ ok('C4 Escape closes the meeting card', await until(() => G.page.evaluate(() => { const v = document.querySelector('#czViewer'); return !v || v.hidden || !v.querySelector('.vz-mtg'); })));
117
+ await G.ctx.close();
205
118
 
206
- /* C10 floors and fidelity */
207
- for (const th of ['light', 'dark']) {
208
- const P = await open({ w: 390, h: 844, theme: th });
209
- await strip(P.page);
210
- ok(`C10 at 390 px (${th}) the card starts hidden`, await P.page.evaluate(() => document.querySelector('#todayCard').classList.contains('calhid') && !document.querySelector('#todayCard .folds').hidden));
211
- await P.page.click('#todayCard .folds');
212
- await week(P.page);
213
- const f = await P.page.evaluate(() => ({ scroll: document.documentElement.scrollWidth <= innerWidth + 1, rows: [...document.querySelectorAll('#tl .ev')].map((e) => e.getBoundingClientRect().height), sw: [...document.querySelectorAll('#wkStrip [data-day], #todayCard .foldb')].map((b) => Math.min(b.getBoundingClientRect().width, b.getBoundingClientRect().height)) }));
214
- ok(`C10 at 390 px (${th}) there is no sideways scroll and rows, day buttons and the chevron are at least 44 px`, f.scroll && f.rows.every((h) => h >= 44) && f.sw.every((n) => n >= 44), JSON.stringify(f));
215
- await P.ctx.close();
216
- }
217
- const css = (page, sel) => page.evaluate((s) => { const e = document.querySelector(s); if (!e) return null; const c = getComputedStyle(e); return ['fontSize', 'fontWeight', 'letterSpacing', 'textTransform', 'borderRadius', 'paddingTop', 'color'].map((k) => c[k]).join('|'); }, sel);
218
- const mk = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const mp = await mk.newPage();
219
- await mp.setContent(MOCKUP); await CT.applyToPage(mp, CT_VENDOR); await mp.waitForTimeout(500);
220
- const F1 = await open();
221
- /* re-pointed for premium-agreed-design: the Agreed design replaces the old Briefing mockup's look (its 28 px card, its ink and amber now-line).
222
- * On Home the Calendar is a group of the list: no card box (cozy-home.css .cz-home .card), the cozy ink for text and the cozy blue ink for
223
- * the now line, read from cozy.css's tokens in the page. The type (size, weight, tracking, case) is still the mockup's. */
224
- const tok = (page, v) => page.evaluate((v) => { const e = document.createElement('i'); e.style.color = 'var(' + v + ')'; document.body.appendChild(e); const c = getComputedStyle(e).color; e.remove(); return c; }, v);
225
- const ink = await tok(F1.page, '--cz-ink'), blueink = await tok(F1.page, '--cz-blueink');
226
- const agreed = { '#todayCard': { box: '0px|0px', color: ink }, '#tl .ev b': { box: '0px|0px', color: ink }, '#tl .nowl': { box: '0px|8px', color: blueink } };
227
- for (const a of Object.keys(agreed)) {
228
- const x = await css(mp, a), y = await css(F1.page, a), xs = (x || '').split('|'), ys = (y || '').split('|');
229
- ok('C10 fidelity: ' + a + ' keeps the mockup\'s type and takes the Agreed design\'s box and colour at 1280 px', !!x && !!y && /^rgb/.test(ink) && xs.slice(0, 4).join('|') === ys.slice(0, 4).join('|') && ys.slice(4, 6).join('|') === agreed[a].box && ys[6] === agreed[a].color, x + ' vs ' + y + ' (agreed ' + JSON.stringify(agreed[a]) + ')');
230
- }
231
- const grp = await css(mp, '#tl .grp');
232
- await week(F1.page);
233
- const wd = await css(F1.page, "#tl .wkd");
234
- ok('C10 fidelity: a day heading uses the mockup\'s group-heading type', grp && wd && wd.split('|').slice(0, 4).join('|') === grp.split('|').slice(0, 4).join('|'), grp + ' vs ' + wd);
235
- await mk.close();
119
+ /* C10 floors */
120
+ const H = await open('/premium-viewer.html?open=meeting&event=ev-rail&date=' + F.dayKey(W.RAIL), { w: 390, h: 844 });
121
+ await until(() => H.page.evaluate(() => !!document.querySelector('#czViewer .vz-mtg')), 15000);
122
+ const fl = await H.page.evaluate(() => ({ over: document.documentElement.scrollWidth - innerWidth, head: [...document.querySelectorAll('#czViewer .vz-r1 > button')].filter((b) => b.getClientRects().length).map((b) => Math.round(b.getBoundingClientRect().height)) }));
123
+ ok('C10 at 390 px the meeting card has no sideways scroll', fl.over <= 0, JSON.stringify(fl));
124
+ await H.ctx.close();
125
+ ok('C9 no page error', ALL.every((x) => x.errors.length === 0), JSON.stringify(ALL.map((x) => x.errors).filter((e) => e.length)));
236
126
  return finish();
237
127
  })().catch((e) => { console.error(e); finish(1); });