create-pmos 0.397.0 → 0.399.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/package.json +25 -25
  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 +105 -52
  8. package/workspace/briefing-premium-board-test.js +284 -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 +85 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +99 -83
  13. package/workspace/briefing-premium-initiative-test.js +175 -290
  14. package/workspace/briefing-premium-insights-test.js +414 -219
  15. package/workspace/briefing-premium-metrics-test.js +55 -97
  16. package/workspace/briefing-premium-products-test.js +44 -28
  17. package/workspace/briefing-premium-sources-test.js +70 -49
  18. package/workspace/briefing-premium-test.js +155 -648
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +24 -0
  21. package/workspace/ev-everywhere-test.js +210 -0
  22. package/workspace/fixtures/board-premium-trail.js +32 -0
  23. package/workspace/fixtures/premium-viewer-fixtures.js +187 -0
  24. package/workspace/guide/briefing-premium.md +3 -1
  25. package/workspace/guide/home.md +68 -0
  26. package/workspace/guide/index.md +1 -0
  27. package/workspace/lib/agent-roles.js +71 -0
  28. package/workspace/lib/board-grill.js +63 -0
  29. package/workspace/lib/board-premium.js +121 -24
  30. package/workspace/lib/board-trail.js +223 -0
  31. package/workspace/lib/home-work-item.js +58 -0
  32. package/workspace/lib/initiative-layout.js +77 -0
  33. package/workspace/lib/insights-goals.js +196 -0
  34. package/workspace/lib/insights-premium.js +64 -15
  35. package/workspace/lib/insights-records.js +115 -0
  36. package/workspace/lib/jira-tickets.js +1 -1
  37. package/workspace/lib/meeting-points.js +52 -0
  38. package/workspace/lib/news-for-you.js +88 -0
  39. package/workspace/lib/notes-series.js +29 -6
  40. package/workspace/lib/report-confirm.js +48 -0
  41. package/workspace/lib/route-modules.js +12 -0
  42. package/workspace/lib/routes-board-docs.js +46 -0
  43. package/workspace/lib/routes-board-grill.js +90 -0
  44. package/workspace/lib/routes-board-trail.js +33 -0
  45. package/workspace/lib/routes-home-desk.js +176 -0
  46. package/workspace/lib/routes-home-review.js +108 -0
  47. package/workspace/lib/routes-initiative-layout.js +57 -0
  48. package/workspace/lib/routes-insights-premium.js +16 -4
  49. package/workspace/lib/routes-insights-records.js +133 -0
  50. package/workspace/lib/routes-meeting-points.js +37 -0
  51. package/workspace/lib/routes-news.js +57 -0
  52. package/workspace/lib/routes-notes.js +3 -1
  53. package/workspace/lib/routes-report-confirm.js +31 -0
  54. package/workspace/lib/routes-search.js +38 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/search-index.js +176 -0
  57. package/workspace/lib/transcript-steps.js +123 -0
  58. package/workspace/lib/viewer-meeting.js +205 -0
  59. package/workspace/lib/viewer-report.js +89 -0
  60. package/workspace/package-lock.json +2 -2
  61. package/workspace/package.json +1 -1
  62. package/workspace/premium-board-actions-test.js +128 -82
  63. package/workspace/premium-briefing-depth-test.js +104 -90
  64. package/workspace/premium-chat-attach-test.js +54 -63
  65. package/workspace/premium-chat-chart-tab-test.js +37 -37
  66. package/workspace/premium-chat-context-test.js +19 -18
  67. package/workspace/premium-chat-goal-view-test.js +23 -23
  68. package/workspace/premium-chat-notes-test.js +26 -31
  69. package/workspace/premium-chat-report-tab-test.js +46 -28
  70. package/workspace/premium-chat-term-test.js +16 -16
  71. package/workspace/premium-chat-viewer-test.js +60 -59
  72. package/workspace/premium-core-doc-issue-test.js +52 -43
  73. package/workspace/premium-html-viewer-test.js +14 -17
  74. package/workspace/premium-phone-card-test.js +10 -3
  75. package/workspace/premium-phone-room-test.js +41 -35
  76. package/workspace/premium-report-read-test.js +152 -197
  77. package/workspace/premium-viewer-download-test.js +19 -22
  78. package/workspace/premium-viewer-flicker-test.js +11 -16
  79. package/workspace/premium-viewer-share-test.js +6 -9
  80. package/workspace/premium-viewer-test.js +41 -60
  81. package/workspace/premium-vw-backlog-test.js +53 -33
  82. package/workspace/premium-vw-cal-test.js +97 -128
  83. package/workspace/premium-vw-copy-test.js +17 -33
  84. package/workspace/premium-vw-doc-test.js +17 -10
  85. package/workspace/premium-vw-item-test.js +50 -49
  86. package/workspace/premium-vw-jira-test.js +53 -27
  87. package/workspace/premium-vw-meet-test.js +115 -187
  88. package/workspace/premium-vw-notes-test.js +88 -109
  89. package/workspace/premium-vw-rec-test.js +71 -194
  90. package/workspace/premium-vw-slides-test.js +46 -50
  91. package/workspace/premium-welcome-test.js +3 -2
  92. package/workspace/premium-work-depth-test.js +61 -53
  93. package/workspace/public/pm/bd-acts.js +383 -0
  94. package/workspace/public/pm/bd-asks.js +261 -0
  95. package/workspace/public/pm/bd-pop.js +59 -0
  96. package/workspace/public/pm/bd-span.js +222 -82
  97. package/workspace/public/pm/bd-stages.js +25 -11
  98. package/workspace/public/pm/bd-views.js +169 -0
  99. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  100. package/workspace/public/pm/c3-md.js +3 -395
  101. package/workspace/public/pm/c3-phone-detail.js +1 -1
  102. package/workspace/public/pm/c3-phone-model.js +3 -68
  103. package/workspace/public/pm/chat-term.js +3 -3
  104. package/workspace/public/pm/cozy-board.css +798 -230
  105. package/workspace/public/pm/cozy-ev.css +228 -0
  106. package/workspace/public/pm/cozy-evmodel.js +106 -0
  107. package/workspace/public/pm/cozy-evui.js +47 -0
  108. package/workspace/public/pm/cozy-home.css +570 -142
  109. package/workspace/public/pm/cozy-home.js +5 -3
  110. package/workspace/public/pm/cozy-insights.css +437 -170
  111. package/workspace/public/pm/cozy-md.js +396 -0
  112. package/workspace/public/pm/cozy-nav.js +104 -29
  113. package/workspace/public/pm/cozy-news.js +140 -0
  114. package/workspace/public/pm/cozy-placeholder.js +26 -0
  115. package/workspace/public/pm/cozy-search.js +203 -0
  116. package/workspace/public/pm/cozy-settings.js +198 -0
  117. package/workspace/public/pm/cozy-sources.js +89 -0
  118. package/workspace/public/pm/cozy-today.css +217 -0
  119. package/workspace/public/pm/cozy-viewer.css +3 -3
  120. package/workspace/public/pm/cozy-viewer.js +145 -0
  121. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  122. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  123. package/workspace/public/pm/cozy-vw.css +485 -0
  124. package/workspace/public/pm/cozy.css +83 -1
  125. package/workspace/public/pm/home-adddoc.js +48 -0
  126. package/workspace/public/pm/home-app.js +1179 -0
  127. package/workspace/public/pm/home-around.js +413 -0
  128. package/workspace/public/pm/home-chat.js +512 -0
  129. package/workspace/public/pm/home-data.js +312 -0
  130. package/workspace/public/pm/home-dictate.js +54 -0
  131. package/workspace/public/pm/home-draft.js +68 -0
  132. package/workspace/public/pm/home-ini-model.js +190 -0
  133. package/workspace/public/pm/home-ini.css +171 -0
  134. package/workspace/public/pm/home-ini.js +456 -0
  135. package/workspace/public/pm/home-list.js +276 -0
  136. package/workspace/public/pm/home-more.js +132 -0
  137. package/workspace/public/pm/home-phone-card.js +109 -0
  138. package/workspace/public/pm/home-review.js +104 -0
  139. package/workspace/public/pm/home-task.js +67 -0
  140. package/workspace/public/pm/home-today.js +144 -0
  141. package/workspace/public/pm/home-work.js +547 -0
  142. package/workspace/public/pm/phone-moment.js +69 -0
  143. package/workspace/public/pm/pm-work-view.js +1 -1
  144. package/workspace/public/pm/premium-attach.js +4 -0
  145. package/workspace/public/pm/premium-board.js +548 -395
  146. package/workspace/public/pm/premium-chart-tab.js +109 -62
  147. package/workspace/public/pm/premium-deck.js +3 -3
  148. package/workspace/public/pm/premium-first.js +23 -21
  149. package/workspace/public/pm/premium-insights.js +1102 -581
  150. package/workspace/public/pm/premium-meeting.js +61 -549
  151. package/workspace/public/pm/premium-mtg-present.js +138 -0
  152. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  153. package/workspace/public/pm/premium-notes.js +1 -1
  154. package/workspace/public/pm/premium-report-frame.css +20 -0
  155. package/workspace/public/pm/premium-report-read.js +669 -476
  156. package/workspace/public/pm/premium-report-tab.js +116 -67
  157. package/workspace/public/pm/premium-shell.js +76 -123
  158. package/workspace/public/pm/premium-viewer.js +22 -1
  159. package/workspace/public/pm/premium-vw-cal.js +277 -48
  160. package/workspace/public/pm/premium-vw-doc.css +6 -0
  161. package/workspace/public/pm/premium-vw-doc.js +40 -2
  162. package/workspace/public/pm/premium-vw-file.js +2 -2
  163. package/workspace/public/pm/premium-vw-meet.js +6 -83
  164. package/workspace/public/pm/premium-vw-mtg.js +958 -0
  165. package/workspace/public/pm/premium-vw-notes.js +116 -68
  166. package/workspace/public/pm/premium-vw-open.js +35 -0
  167. package/workspace/public/pm/premium-vw-page.js +16 -0
  168. package/workspace/public/pm/premium-vw-rec.js +11 -218
  169. package/workspace/public/pm/premium-vw-slides.css +5 -0
  170. package/workspace/public/pm/premium-vw-slides.js +44 -8
  171. package/workspace/public/pm/rp-parts.js +269 -0
  172. package/workspace/public/pm/term-view.js +22 -0
  173. package/workspace/public/premium-board.html +29 -70
  174. package/workspace/public/premium-initiative.html +8 -48
  175. package/workspace/public/premium-insights.html +26 -64
  176. package/workspace/public/premium-viewer.html +20 -0
  177. package/workspace/public/premium.html +18 -107
  178. package/workspace/r/m1.png +0 -0
  179. package/workspace/r/m2.png +0 -0
  180. package/workspace/r/m3.png +0 -0
  181. package/workspace/r/nl.png +0 -0
  182. package/workspace/server.js +18 -3
  183. package/workspace/test-files.json +1 -0
  184. package/workspace/test-lists/home-libs.json +9 -0
  185. package/workspace/test-lists/initiative-layout.json +9 -0
  186. package/workspace/test-lists/premium-report-read.json +1 -1
  187. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  188. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  189. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  190. package/workspace/test-lists/premium-vw-notes.json +1 -1
  191. package/workspace/test-lists/uf-everywhere.json +15 -0
  192. package/workspace/test-lists/uf-home.json +9 -0
  193. package/workspace/test-lists/uncovered-board.json +9 -0
  194. package/workspace/public/pm/premium-work.js +0 -729
  195. package/workspace/public/pm/premium.js +0 -1146
@@ -5,6 +5,8 @@
5
5
  * S1/S8 no brief for today: the header says so S2/S5 the rows, each tagged Across products (the brief names no included initiative)
6
6
  * S3 the dialog opens an https link and records nothing S7 the digests in Today S9 the writes refuse a source key; the agent answers
7
7
  * S11 the source row and the digest are drawn in the Agreed design's tokens at 1280 and 390 px, light and dark; no sideways scroll
8
+ * (re-pointed by premium-agreed-design: rows are Home's Needs-you rows; by premium-uncovered-features: the digests are in New for you and
9
+ * the read lines in Sources, both opened from the place menu)
8
10
  * Every wait polls the page; no fixed sleep stands in for a state. */
9
11
  const fs = require('fs');
10
12
  const os = require('os');
@@ -15,6 +17,18 @@ const T = require('./test-run').configure({ name: 'briefing-premium-sources' });
15
17
 
16
18
  const BASE = T.BASE;
17
19
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
20
+ /* premium-agreed-design: the Briefing's ranked list, its dialog, its Today timeline and its cards are gone. A source row is a Needs-you row on
21
+ * Home (its hint leads with the product, then the source and sender, then the prepared line) and opens in the Viewer.
22
+ * premium-uncovered-features: Around you is gone. Today's digests are in New for you, and the read lines and the background line are in
23
+ * Sources; both open from the place menu (cozy-nav.js). */
24
+ const PLACE_ITEM = { 'Around you': '[data-cz-news]', 'New for you': '[data-cz-news]', Sources: '[data-cz-sources]' };
25
+ const moreItem = async (pg, label, sel) => {
26
+ if (await pg.isVisible('#czViewer')) { await pg.keyboard.press('Escape'); }
27
+ await pg.click('#czFab'); await pg.click('#czMenu ' + PLACE_ITEM[label]);
28
+ await pg.waitForSelector('#czViewer ' + sel, { timeout: 15000 });
29
+ };
30
+ const srcRowsOf = (pg) => pg.$$eval('#hmList .hm-r[data-id^="n:src:"]', (els) => els.map((e) => ({ key: e.dataset.id.slice(2), title: e.querySelector('.hm-rt b').textContent, line2: (e.querySelector('.hm-rt em') || {}).textContent || '' })));
31
+ const allNeeds = async (pg) => { for (let i = 0; i < 20; i++) { const t = await pg.textContent('#hmList [data-hm-allneeds]').catch(() => null); if (t === null || !/Show$/.test(t.trim())) return; await pg.click('#hmList [data-hm-allneeds]', { timeout: 2000 }).catch(() => {}); await sleep(150); } };
18
32
  const until = async (fn, ms = 15000, step = 150) => { const t0 = Date.now(); for (;;) { let v = null; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
19
33
  const results = [];
20
34
  const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 300) : ''}`); };
@@ -85,30 +99,32 @@ const sh = (cwd, args) => spawnSync('git', args, { cwd, encoding: 'utf8' });
85
99
  const page = await ctx.newPage(); const errors = [];
86
100
  page.on('pageerror', (e) => errors.push(String(e.message || e)));
87
101
  await page.goto(BASE + '/premium.html?theme=' + theme, { waitUntil: 'domcontentloaded' });
88
- await page.waitForSelector('#rank .rr', { timeout: 60000 });
102
+ await page.waitForSelector('#hmList .hm-r[data-id^="n:src:"]', { state: 'attached', timeout: 60000 });
89
103
  return { ctx, page, errors };
90
104
  };
91
105
 
92
106
  {
93
107
  const { ctx, page, errors } = await open();
94
- const rows = await page.$$eval('#rank .rr', (els) => els.map((e) => ({ key: e.dataset.key, title: e.querySelector('.rt').textContent.replace('Do this first', ''), line2: e.querySelector('.rs').textContent, old: e.querySelectorAll('.sug, .skip').length })));
95
- ok('S2 the first row is two lines: the title, then the source and sender · the verb and the prepared line', rows[0] && rows[0].line2 === 'Across productsMail · Anna Lee · Reply: Confirm Thursday' && rows[0].old === 0, JSON.stringify(rows[0]));
108
+ await allNeeds(page);
109
+ const rows = await srcRowsOf(page);
110
+ ok('S2 the first row is two lines: the title, then the product, the source and sender · the verb and the prepared line', rows[0] && rows[0].title === 'Confirm the Thursday review' && rows[0].line2 === 'Across products · Mail · Anna Lee · Reply: Confirm Thursday', JSON.stringify(rows[0]));
96
111
  ok('S2 a row with a verb and no prepared line shows the verb alone', rows[1] && /Confluence · Budi Santoso · Sign off$/.test(rows[1].line2), JSON.stringify(rows[1]));
97
- ok('S6 the dock counts the rows', (await page.textContent('#dN')) === '4', await page.textContent('#dN'));
98
- await page.click('#rank .rr:first-child .rhd');
99
- await page.waitForSelector('#srcLink');
100
- const link = await page.$eval('#srcLink', (a) => ({ href: a.href, target: a.target, rel: a.rel, h: Math.round(a.getBoundingClientRect().height) }));
101
- ok('S3 the dialog opens the item\'s https link in a new tab', link.href === 'https://mail.example/t/1' && link.target === '_blank' && /noopener/.test(link.rel), JSON.stringify(link));
102
- ok('S2 the row\'s why now is in its dialog', /Why now\s*Why aaaaaaaaaaa1/.test(await page.textContent('#card')), await page.textContent('#card'));
103
- ok('S3 the dialog offers nothing that records or sends', (await page.$('#recBtn')) === null && (await page.$('[data-until]')) === null && (await page.$('#dBody [data-op]')) === null);
112
+ // premium-uncovered-features (canvas HmMyWork): no Needs you group; the greeting counts the next steps that are yours, the source rows among them
113
+ const needN = await page.textContent('#hmList .hm-tc .big'), allRows = await page.$$eval('#hmList .hm-r[data-id^="n:"]', (els) => els.length);
114
+ const gn = /(\d+) next steps? (?:is|are) yours/.exec(needN || '');
115
+ ok('S6 Home counts the rows: the four source rows are among the next steps, and the greeting counts them all', rows.length === 4 && !!gn && +gn[1] >= allRows && allRows >= 4, needN + ' / ' + allRows);
116
+ await page.click(`#hmList [data-hm-sel="n:${rows[0].key}"]`);
117
+ await page.waitForSelector('#czViewer #srcLink');
118
+ const link = await page.$eval('#czViewer #srcLink', (a) => ({ href: a.href, target: a.target, rel: a.rel, h: Math.round(a.getBoundingClientRect().height) }));
119
+ ok('S3 the Viewer opens the item\'s https link in a new tab', link.href === 'https://mail.example/t/1' && link.target === '_blank' && /noopener/.test(link.rel), JSON.stringify(link));
120
+ ok('S2 the row\'s why now is in its Viewer card', /Why now\s*Why aaaaaaaaaaa1/.test(await page.textContent('#czViewer')), await page.textContent('#czViewer'));
121
+ ok('S3 the card offers nothing that records or sends', (await page.$('#czViewer [data-hv-rec]')) === null && (await page.$('#czViewer [data-hv-later], #czViewer [data-hv-until]')) === null && (await page.$('#czViewer [data-hv-opt]')) === null);
104
122
  ok('S11 the link is at least 44 px high', link.h >= 44, String(link.h));
105
123
  await page.keyboard.press('Escape');
106
- const chip = await page.$eval('#srcChips', (e) => e.textContent);
107
- ok('S7 Today lists Digests with their count', /Digests1/.test(chip), chip);
108
- await page.click('#tl .ev.src-digest');
109
- await page.waitForSelector('#dBody');
110
- const dtxt = await page.textContent('#dlg');
111
- ok('S7 the digest dialog holds its lines and its link', /Decision: Ship on Friday/.test(dtxt) && /Open: Who owns QA/.test(dtxt) && (await page.getAttribute('#srcLink', 'href')) === 'https://slack.example/c/1', dtxt.slice(0, 200));
124
+ await moreItem(page, 'New for you', '#aroundDig');
125
+ const dig = await page.$eval('#czViewer #aroundDig', (e) => ({ h: e.querySelector('.ev-lbl').textContent, t: e.textContent, href: (e.querySelector('a.srcLink') || {}).href || '' }));
126
+ ok('S7 New for you lists Digests with their count', dig.h === 'Digests 1', dig.h);
127
+ ok('S7 the digest holds its lines and its link', /Decision: Ship on Friday/.test(dig.t) && /Open: Who owns QA/.test(dig.t) && dig.href === 'https://slack.example/c/1', JSON.stringify(dig).slice(0, 300));
112
128
  ok('no page error', errors.length === 0, errors.join(' | '));
113
129
  await ctx.close();
114
130
  }
@@ -120,21 +136,19 @@ const sh = (cwd, args) => spawnSync('git', args, { cwd, encoding: 'utf8' });
120
136
  const shot = process.env.PMOS_SHOT_DIR || '';
121
137
  for (const theme of ['light', 'dark']) {
122
138
  const { ctx, page, errors } = await open({ theme, w: theme === 'dark' ? 390 : 1280, h: 844 });
123
- await page.waitForFunction(() => /sdot (ok|warn|bad)/.test((document.querySelector('#srcDot') || {}).className || ''), null, { timeout: 15000 }).catch(() => {});
124
- const dot = await page.$eval('#srcDot', (e) => e.className);
139
+ // premium-agreed-design (shared foundation): the design draws no Sources chip, so there is no dot on the page; the level is still read (GET /api/sources)
140
+ const dot = await page.evaluate(() => (document.querySelector('#srcDot, #srcChip') ? 'drawn' : 'none'));
141
+ await moreItem(page, 'Sources', '#srcHealth');
125
142
  if (theme === 'light') {
126
- // briefing-source-flow, slice 5: each card says which reads it shows and when, from the same Sources read
127
- await page.waitForSelector('#todayCard > .cread:not([hidden])', { timeout: 15000 }).catch(() => {});
128
- const rd = await page.evaluate(() => ({ cal: (document.querySelector('#todayCard > .cread') || {}).textContent || '', moves: (document.querySelector('#movesCard > .cread') || {}).textContent || '' }));
129
- ok('H5 the Calendar card names its read, and What you need to do names the initiatives, My work and the brief', /^Calendar (read|not read yet|failed)/.test(rd.cal) && /Initiatives/.test(rd.moves) && /My work/.test(rd.moves) && /Brief (built|not built yet|off)/.test(rd.moves), JSON.stringify(rd));
143
+ // briefing-source-flow, slice 5: Home names which reads each part shows and when, from the same Sources read (Home's Sources card)
144
+ const rd = await page.evaluate(() => ({ cal: ((document.querySelector('#czViewer [data-reads="Today"]') || {}).textContent || '').replace(/^Today:\s*/, ''), moves: ((document.querySelector('#czViewer [data-reads="Needs you"]') || {}).textContent || '').replace(/^Needs you:\s*/, '') }));
145
+ ok('H5 Sources names the read Today shows, and the initiatives, My work and the brief that Needs you shows', /^Calendar (read|not read yet|failed)/.test(rd.cal) && /Initiatives/.test(rd.moves) && /My work/.test(rd.moves) && /Brief (built|not built yet|off)/.test(rd.moves), JSON.stringify(rd));
130
146
  if (shot) await page.screenshot({ path: path.join(shot, 'cards-reads-light.png'), fullPage: true });
131
147
  }
132
- if (theme === 'light') await page.click('#srcChip'); else { await page.click('#moreBtn'); await page.click('#srcItem'); }
133
- await page.waitForSelector('#srcHealth .hline', { timeout: 15000 }).catch(() => {});
134
- const line = await page.$eval('#srcHealth', (e) => ({ text: e.textContent.trim(), dot: (e.querySelector('.sdot') || {}).className || '', w: Math.round(e.getBoundingClientRect().width), sw: document.documentElement.scrollWidth }));
148
+ const line = await page.$eval('#czViewer #srcHealth', (e) => ({ text: e.textContent.trim(), dot: (e.querySelector('.ev-dot') || {}).className || '', w: Math.round(e.getBoundingClientRect().width), sw: document.documentElement.scrollWidth }));
135
149
  if (theme === 'light') {
136
- ok('H2 Sources opens with the background line on top, in the level\'s colour', line.text.startsWith(h.line.slice(0, 20)) && line.dot === 'sdot ' + (h.level === 'ok' ? 'ok' : h.level), JSON.stringify(line));
137
- ok('H3 the chip\'s dot is red only when background work stopped', h.level === 'bad' ? dot === 'sdot bad' : dot !== 'sdot bad', dot);
150
+ ok('H2 Sources opens with the background line on top, in the level\'s colour', line.text.startsWith(h.line.slice(0, 20)) && line.dot === 'ev-dot ' + (h.level === 'ok' ? 'ok' : 'risk'), JSON.stringify(line));
151
+ ok('H3 no Sources chip and no dot are drawn on the page; the line above carries the level (premium-agreed-design)', dot === 'none', dot);
138
152
  } else ok('H4 on a phone the line fits: no sideways scroll', line.sw <= 390 && line.w > 0, JSON.stringify(line));
139
153
  if (shot) { await sleep(1200); await page.screenshot({ path: path.join(shot, 'sources-health-' + theme + '.png') }); }
140
154
  ok('H no page error (' + theme + ')', errors.length === 0, errors.join(' | '));
@@ -160,47 +174,54 @@ const sh = (cwd, args) => spawnSync('git', args, { cwd, encoding: 'utf8' });
160
174
  * (cozy.css, cozy-home.css), resolved in the page itself for the theme under test; the row and the digest still fill their column, and still
161
175
  * nothing scrolls sideways. A source row that drifted off the design's tokens fails here as it failed against the mockup. */
162
176
  {
163
- const PAIRS = [['row', '#rank .rr:nth-child(2)'], ['number', '#rank .rr:nth-child(2) .rn'], ['title', '#rank .rr:nth-child(2) .rt'], ['subject', '#rank .rr:nth-child(2) .rs'], ['event', '#tl .ev:not(:first-of-type)'], ['eventTime', '#tl .ev:not(:first-of-type) time'], ['eventTitle', '#tl .ev:not(:first-of-type) b']];
177
+ // re-pointed again for the Agreed design's Home: the source row is a Needs-you row of Home's list, and the digest is a row of New for you
178
+ const ROWS = [['row', '.hm-rm'], ['number', '.hm-dot'], ['title', '.hm-rt b'], ['subject', '.hm-rt em']];
179
+ const DIGS = [['event', ''], ['eventTime', '.ev-tx .ev-mut'], ['eventTitle', '.ev-tx b']];
164
180
  const SANS = 'var(--cz-sans)';
165
181
  /* The design's values, as the tokens name them (a value that starts var( is resolved in the page; anything else is literal) */
166
182
  const WANT = {
167
183
  row: { fontFamily: SANS, color: 'var(--cz-ink)', backgroundColor: 'transparent' },
168
- number: { backgroundColor: 'var(--cz-blue)', borderRadius: '50%', width: '8px', height: '8px' }, // the rank is a blue dot, not a number
184
+ number: { backgroundColor: 'var(--cz-blue)', borderRadius: '50%', width: '7px', height: '7px' }, // the row's dot is blue: it waits on you
169
185
  title: { fontFamily: SANS, fontSize: '14px', fontWeight: '700', color: 'var(--cz-ink)' },
170
- subject: { fontFamily: SANS, fontSize: '12px', fontWeight: '500', color: 'var(--cz-blueink)' },
171
- event: { fontFamily: SANS, color: 'var(--cz-ink)', borderTopColor: 'var(--hair)' },
172
- eventTime: { color: 'var(--ink-2)' },
173
- eventTitle: { fontFamily: SANS, color: 'var(--cz-ink)' },
186
+ subject: { fontFamily: SANS, fontSize: '12.5px', color: 'var(--cz-blueink)' }, // the canvas's row line (.lrow .s, premium-uncovered-features)
187
+ event: { fontFamily: SANS, color: 'var(--cz-ink)', backgroundColor: 'transparent' }, // a row of New for you's table (cozy-ev.css)
188
+ eventTime: { fontSize: '12.5px', color: 'var(--cz-ink3)' },
189
+ eventTitle: { fontFamily: SANS, fontSize: '13.5px', fontWeight: '700', color: 'var(--cz-ink)' },
174
190
  };
175
- const grab = (pg) => pg.evaluate(([pairs, want]) => {
191
+ const grab = (pg, pairs, base, col) => pg.evaluate(([pairs, want, base, col]) => {
176
192
  const o = {};
177
- const probe = document.createElement('div'); probe.style.position = 'absolute'; probe.style.visibility = 'hidden'; document.body.appendChild(probe);
193
+ const probe = document.createElement('div'); document.body.appendChild(probe);
178
194
  const resolve = (k, v) => { if (!/^var\(/.test(v) && v !== 'transparent') return v; probe.removeAttribute('style'); probe.style.position = 'absolute'; probe.style.visibility = 'hidden'; probe.style.setProperty(k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()), v); return getComputedStyle(probe)[k]; };
195
+ const root = document.querySelectorAll(base)[base.includes('n:src:') ? 1 : 0];
179
196
  for (const [n, s] of pairs) {
180
- const e = /^#tl/.test(s) && window.__ev ? window.__ev(s) : document.querySelector(s);
197
+ const e = !root ? null : s ? root.querySelector(s) : root;
181
198
  if (!e) { o[n] = null; continue; }
182
199
  const cs = getComputedStyle(e), v = {};
183
200
  for (const [k, w] of Object.entries(want[n])) v[k] = [resolve(k, w), cs[k]];
184
201
  o[n] = v;
185
202
  }
186
203
  probe.remove();
187
- const box = (s) => { const e = document.querySelector(s); return e ? Math.round(e.getBoundingClientRect().width) : null; };
188
- const ev = window.__ev && window.__ev('#tl .ev');
189
- o.fit = { row: [box('#rank'), box('#rank .rr:nth-child(2)')], event: [ev && ev.parentElement ? Math.round(ev.parentElement.getBoundingClientRect().width) : null, ev ? Math.round(ev.getBoundingClientRect().width) : null] };
204
+ const c = root && root.closest(col);
205
+ o.fit = [c ? Math.round(c.getBoundingClientRect().width) : null, root ? Math.round(root.getBoundingClientRect().width) : null];
190
206
  return o;
191
- }, [PAIRS, WANT]);
207
+ }, [pairs, WANT, base, col]);
208
+ const diff = (c, pairs, slack) => {
209
+ const d = [];
210
+ for (const [n] of pairs) { if (!c[n]) { d.push(n + ' missing'); continue; } for (const [k, [want, got]] of Object.entries(c[n])) if (want !== got) d.push(`${n}.${k} ${want} | ${got}`); }
211
+ const [col, got] = c.fit; if (col == null || got == null || got < col - slack || got > col + 2) d.push(`width fills ${col} | ${got}`);
212
+ return d;
213
+ };
192
214
  for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
193
215
  const R = await open({ w, h, theme: th });
194
- if (w === 390) { await R.page.click('#todayCard .folds').catch(() => {}); await R.page.evaluate(() => scrollTo(0, 0)); } // the Calendar card starts hidden on a phone (premium-calendar-card); measure it open
195
- await R.page.evaluate(() => { window.__ev = (s) => { const d = document.querySelector('#tl .ev.src-digest'); return !d ? null : / time$/.test(s) ? d.querySelector('time') : / b$/.test(s) ? d.querySelector('b') : d; }; });
216
+ // on a phone the list is the page (canvas HmPhone)
217
+ await allNeeds(R.page);
196
218
  await sleep(500);
197
- const c = await grab(R.page, PAIRS), diffs = [];
198
- for (const [n] of PAIRS) {
199
- if (!c[n]) { diffs.push(n + ' missing'); continue; }
200
- for (const [k, [want, got]] of Object.entries(c[n])) if (want !== got) diffs.push(`${n}.${k} ${want} | ${got}`);
201
- }
202
- // the row fills its list; the digest fills its column plus the hover bleed premium.css gives every Today item (margin 0 -10px, width 100% + 20px)
203
- for (const [n, [col, got]] of Object.entries(c.fit)) if (col == null || got == null || got < col - 2 || got > col + (n === 'event' ? 22 : 2)) diffs.push(`${n}.width fills ${col} | ${got}`);
219
+ const rowSel = '#hmList .hm-r[data-id^="n:src:"]';
220
+ const diffs = diff(await grab(R.page, ROWS, rowSel, '.hm-pg'), ROWS, 4); // the row fills its group (the group's own inset aside)
221
+ if (w === 390) await R.page.keyboard.press('Escape');
222
+ await moreItem(R.page, 'New for you', '#aroundDig');
223
+ await sleep(300);
224
+ diffs.push(...diff(await grab(R.page, DIGS, '#czViewer #aroundDig .ev-trow', '#aroundDig'), DIGS, 2));
204
225
  ok(`S11 the source row and the digest look like the Agreed design's at ${w} px, ${th}`, diffs.length === 0, diffs.join(' ; '));
205
226
  const ov = await R.page.evaluate(() => document.documentElement.scrollWidth - innerWidth);
206
227
  ok(`S11 no sideways scroll at ${w} px, ${th}`, ov <= 0, String(ov));