create-pmos 0.401.0 → 0.403.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 (127) hide show
  1. package/package.json +25 -30
  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/board-programs-test.js +227 -0
  8. package/workspace/board-shot.js +54 -0
  9. package/workspace/briefing-premium-adddoc-test.js +28 -22
  10. package/workspace/briefing-premium-board-test.js +107 -82
  11. package/workspace/briefing-premium-calendar-2-test.js +23 -10
  12. package/workspace/briefing-premium-calendar-3-test.js +23 -19
  13. package/workspace/briefing-premium-calendar-test.js +20 -15
  14. package/workspace/briefing-premium-initiative-test.js +25 -12
  15. package/workspace/briefing-premium-insights-test.js +31 -18
  16. package/workspace/briefing-premium-metrics-test.js +8 -8
  17. package/workspace/briefing-premium-sources-test.js +15 -10
  18. package/workspace/briefing-premium-test.js +39 -16
  19. package/workspace/changelog.json +24 -0
  20. package/workspace/fixtures/board-premium-facts.js +20 -3
  21. package/workspace/fixtures/briefing-premium-facts.js +18 -2
  22. package/workspace/fixtures/premium-viewer-fixtures.js +24 -2
  23. package/workspace/fixtures/program-ascent.js +101 -0
  24. package/workspace/guide/home.md +11 -7
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/guide/jira.md +38 -6
  27. package/workspace/guide/programs.md +37 -0
  28. package/workspace/home-rows-test.js +184 -0
  29. package/workspace/lib/briefing-premium-products.js +4 -4
  30. package/workspace/lib/briefing-premium.js +2 -2
  31. package/workspace/lib/calendar-layers.js +8 -4
  32. package/workspace/lib/initiative-layout.js +4 -3
  33. package/workspace/lib/jira-cli.js +17 -12
  34. package/workspace/lib/jira-status.js +1 -1
  35. package/workspace/lib/jira-tickets.js +126 -24
  36. package/workspace/lib/meeting-files.js +58 -0
  37. package/workspace/lib/meeting-learn.js +139 -0
  38. package/workspace/lib/meeting-material.js +12 -5
  39. package/workspace/lib/notes.js +3 -0
  40. package/workspace/lib/programs.js +129 -0
  41. package/workspace/lib/route-modules.js +1 -0
  42. package/workspace/lib/routes-brief-page.js +8 -1
  43. package/workspace/lib/routes-briefing-premium.js +1 -1
  44. package/workspace/lib/routes-calendar-views.js +24 -3
  45. package/workspace/lib/routes-meeting-material.js +38 -0
  46. package/workspace/lib/routes-meeting-points.js +23 -3
  47. package/workspace/lib/routes-programs.js +122 -0
  48. package/workspace/package-lock.json +2 -2
  49. package/workspace/package.json +1 -1
  50. package/workspace/premium-board-actions-test.js +31 -25
  51. package/workspace/premium-chat-context-test.js +1 -1
  52. package/workspace/premium-chat-goal-view-test.js +1 -1
  53. package/workspace/premium-chat-viewer-test.js +1 -1
  54. package/workspace/premium-core-doc-issue-test.js +13 -7
  55. package/workspace/premium-discuss-landing-test.js +83 -0
  56. package/workspace/premium-link-suggest-test.js +103 -0
  57. package/workspace/premium-report-read-test.js +86 -82
  58. package/workspace/premium-vw-backlog-test.js +6 -5
  59. package/workspace/premium-vw-cal-test.js +45 -19
  60. package/workspace/premium-vw-item-test.js +8 -6
  61. package/workspace/premium-vw-jira-test.js +3 -2
  62. package/workspace/premium-vw-meet-test.js +122 -66
  63. package/workspace/premium-vw-notes-test.js +7 -6
  64. package/workspace/premium-vw-rec-test.js +14 -13
  65. package/workspace/premium-vw-slides-test.js +11 -5
  66. package/workspace/program-panel-test.js +152 -0
  67. package/workspace/public/pm/bd-acts.js +24 -15
  68. package/workspace/public/pm/bd-asks.js +111 -30
  69. package/workspace/public/pm/bd-ini-panel.js +229 -0
  70. package/workspace/public/pm/bd-pop.js +2 -2
  71. package/workspace/public/pm/bd-prog-panel.js +436 -0
  72. package/workspace/public/pm/bd-prog.js +191 -0
  73. package/workspace/public/pm/bd-span.js +98 -15
  74. package/workspace/public/pm/bd-views.js +93 -29
  75. package/workspace/public/pm/cozy-board.css +214 -20
  76. package/workspace/public/pm/cozy-evui.js +4 -2
  77. package/workspace/public/pm/cozy-home-rows.css +54 -0
  78. package/workspace/public/pm/cozy-home.css +35 -0
  79. package/workspace/public/pm/cozy-insights.css +1 -2
  80. package/workspace/public/pm/cozy-mtg-present.css +160 -0
  81. package/workspace/public/pm/cozy-panel.css +155 -0
  82. package/workspace/public/pm/cozy-rec-pill.css +12 -0
  83. package/workspace/public/pm/cozy-rec-pill.js +46 -0
  84. package/workspace/public/pm/cozy-today.css +189 -0
  85. package/workspace/public/pm/cozy-viewer.js +307 -43
  86. package/workspace/public/pm/cozy-vw-mtg.css +96 -94
  87. package/workspace/public/pm/cozy-vw-rp.css +40 -25
  88. package/workspace/public/pm/cozy-vw-shell.css +127 -0
  89. package/workspace/public/pm/cozy-xv.css +51 -0
  90. package/workspace/public/pm/cozy-xv.js +34 -0
  91. package/workspace/public/pm/home-app.js +192 -72
  92. package/workspace/public/pm/home-chat.js +17 -4
  93. package/workspace/public/pm/home-data.js +1 -1
  94. package/workspace/public/pm/home-day.js +64 -0
  95. package/workspace/public/pm/home-ini-model.js +1 -1
  96. package/workspace/public/pm/home-ini.js +197 -54
  97. package/workspace/public/pm/home-list.js +100 -27
  98. package/workspace/public/pm/home-mentions.js +187 -0
  99. package/workspace/public/pm/home-rec-row.js +67 -0
  100. package/workspace/public/pm/home-review.js +20 -10
  101. package/workspace/public/pm/home-task.js +19 -18
  102. package/workspace/public/pm/home-today.js +137 -59
  103. package/workspace/public/pm/premium-board.js +294 -288
  104. package/workspace/public/pm/premium-insights.js +118 -82
  105. package/workspace/public/pm/premium-mtg-present.js +408 -100
  106. package/workspace/public/pm/premium-mtg-replay.js +70 -10
  107. package/workspace/public/pm/premium-report-read.js +118 -63
  108. package/workspace/public/pm/premium-vw-cal.js +62 -34
  109. package/workspace/public/pm/premium-vw-mtg.js +348 -192
  110. package/workspace/public/pm/program-model.js +192 -0
  111. package/workspace/public/pm/rec-state.js +63 -0
  112. package/workspace/public/pm/rp-parts.js +33 -8
  113. package/workspace/public/pm/tk-draft.js +107 -0
  114. package/workspace/public/pm/tk-model.js +134 -0
  115. package/workspace/public/pm/tk-send.js +124 -0
  116. package/workspace/public/pm/tk-tasks.css +120 -0
  117. package/workspace/public/premium-board.html +4 -2
  118. package/workspace/server.js +4 -2
  119. package/workspace/skills/jira-push.skill +3 -3
  120. package/workspace/test-lists/board-programs.json +9 -0
  121. package/workspace/test-lists/prd-to-jira.json +6 -0
  122. package/workspace/test-lists/program-hierarchy.json +11 -0
  123. package/workspace/test-lists/program-panel.json +9 -0
  124. package/workspace/test-lists/viewer-home-rows.json +9 -0
  125. package/workspace/test-lists/viewer-meetings.json +9 -0
  126. package/workspace/test-lists/viewer-shell-a.json +15 -0
  127. package/workspace/tk-tasks-test.js +199 -0
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* tk-tasks-test.js — the PRD-to-Jira tasks in Home's Viewer (kit 2, T1 to T3; canvas PgTkList, PgTkDraft, PgTkSend, PgTkSent, XvATasks).
4
+ * Serves the real page from the real server. GET /api/jira/tickets answers the view lib/jira-tickets.js builds from a synthetic repository
5
+ * (two epics, a ticket that lacks text); the writes are caught, so nothing reaches Jira or the repository. Screenshots go to SHOTS when set.
6
+ * T1 the tasks grouped by epic, the send icon, the sent state · T2 the drafted ticket · T3 the Send sheet, its one labeled Send */
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const { spawn } = require('child_process');
10
+ const { findBrowser } = require('./lib/find-browser');
11
+ const T = require('./test-run').configure({ name: 'tk-tasks' });
12
+ const IP = require('./lib/initiative-premium.js');
13
+ const F = require('./fixtures/initiative-premium-facts.js');
14
+ const BP = require('./lib/board-premium.js');
15
+ const BF = require('./fixtures/board-premium-facts.js');
16
+ const BRP = require('./lib/briefing-premium.js');
17
+ const BRF = require('./fixtures/briefing-premium-facts.js');
18
+ const TK = require('./lib/jira-tickets.js');
19
+ const { makeRepos, write } = require('./plan-test-repos');
20
+
21
+ const BASE = T.BASE;
22
+ const SHOTS = process.env.TK_SHOTS || '';
23
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
24
+ 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); } };
25
+ const results = [];
26
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
27
+ let srv = null; let browser = null;
28
+ const R = makeRepos('tk-tasks');
29
+ const finish = async (code) => {
30
+ if (browser) await browser.close().catch(() => {});
31
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
32
+ T.killTmux(); R.cleanup();
33
+ const bad = results.filter((x) => !x.cond).length;
34
+ console.log(`\n${results.length - bad}/${results.length} tk-tasks assertions passed`);
35
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
36
+ };
37
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
38
+
39
+ // the view, from a real draft of a synthetic PRD (the fixture initiative's id)
40
+ const I = 'self-serve-v2';
41
+ write(R.code, `planning/initiatives/${I}.md`, '---\ntype: Initiative\ntitle: "Descope feature parity"\ntimestamp: 2026-10-01\nlane: feature\nparent_kr: health:tech\nprd_path: planning/prd/tk.md\n---\n\n# x\n');
42
+ const story = (id, t, o = {}) => `#### ${id} · ${t}\nType: Story · Priority: High${o.est ? ' · Estimate: ' + o.est : ''}\n\nAs a customer, I want ${t.toLowerCase()}, so that nothing changes for me after the move.\n\n`
43
+ + (o.bare ? '' : '##### User Flow\n1. Open the sign-in page.\n2. Enter the email and password.\n3. Land where I was.\n\n##### Functional Requirements\n1. Same fields.\n2. Same error text.\n\n##### Acceptance Criteria\n- Email and password sign-in works for every account in the parity inventory.\n- Error text for a wrong password matches today\'s text.\n- A locked account sees the same lockout message and wait time.\n');
44
+ write(R.code, 'planning/prd/tk.md', `---\ntype: PRD\ntitle: d\ntimestamp: 2026-10-01\n---\n\n# d\n\n## User stories\n\n### Sign-in and sign-up\n\n${story('S1', 'Sign-in parity', { est: 'M' })}${story('S2', 'Sign-up parity', { est: 'M' })}${story('S3', 'Password reset parity', { est: 'S' })}${story('S4', 'Social sign-in parity', { est: 'M' })}${story('S5', 'Accounts with no email', { bare: true })}### Sessions, SSO and second factor\n\n${story('S6', 'Session and SSO parity', { est: 'L' })}${story('S7', 'Second factor by SMS and app', { est: 'M' })}`);
45
+ TK.draft(R.code, I, { now: Date.parse('2026-10-24T08:00:00Z') });
46
+ const VIEW = JSON.parse(JSON.stringify(TK.view(R.code, I)));
47
+ TK.approve(R.code, I, ['S1', 'S2', 'S3']);
48
+ TK.record(R.code, I, { epic: 'IDPF-401', group: 'sign-in-and-sign-up' });
49
+ TK.record(R.code, I, { tickets: { S1: 'IDPF-411', S2: 'IDPF-412', S3: 'IDPF-413' } });
50
+ const SENT = JSON.parse(JSON.stringify(TK.view(R.code, I)));
51
+ SENT.tickets.find((t) => t.id === 'S1').jira = { status: 'In Progress', category: 'doing', assignee: 'Rudi' };
52
+ SENT.tickets.find((t) => t.id === 'S2').jira = { status: 'To Do', category: 'todo', assignee: 'Mei' };
53
+ SENT.checkedAt = new Date(new Date().setHours(9, 2, 0, 0)).toISOString();
54
+
55
+ const mk = () => IP.build(F.facts());
56
+ const BOARD = BP.build(BF.facts());
57
+ const BRIEF = BRP.build(BRF.facts());
58
+
59
+ (async () => {
60
+ const exe = findBrowser();
61
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
62
+ let chromium;
63
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
64
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
65
+ await T.waitForServer(BASE);
66
+ browser = await chromium.launch({ executablePath: exe });
67
+
68
+ const open = async ({ w = 1440, h = 900, theme = 'light', view = VIEW, layout = {} } = {}) => {
69
+ const ctx = await browser.newContext({ viewport: { width: w, height: h } });
70
+ const page = await ctx.newPage();
71
+ const errors = [], posts = [];
72
+ let cur = view;
73
+ page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
74
+ page.on('request', (rq) => { if (rq.method() === 'POST') posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); });
75
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
76
+ await page.route('**/api/initiative-premium*', (r) => json(r, { ok: true, state: 'ready', model: mk(), as_of: Date.now() }));
77
+ await page.route(/\/api\/board-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BOARD, as_of: Date.now() }));
78
+ await page.route(/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BRIEF, as_of: Date.now() }));
79
+ await page.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
80
+ await page.route(/\/api\/initiative-layout(\?.*)?$/, (r) => (r.request().method() === 'GET' ? json(r, { ok: true, auto: true, held: [], by: 'stage', names: [], of: {}, stage: {}, sets: [], ...layout }) : json(r, { ok: true, auto: true, held: [], by: (JSON.parse(r.request().postData() || '{}').by) || 'stage', picked: true, names: [], of: {}, stage: {}, sets: [] })));
81
+ await page.route(/\/api\/jira\/tickets(\?.*)?$/, (r) => json(r, { ...cur, ws: 'w1', pushing: null, checking: null }));
82
+ await page.route(/\/api\/boards\/items(\?.*)?$/, (r) => json(r, { ok: true, ws: 'w1', board: 'w1', jiraProjects: ['IDPF'], items: [], initiatives: [] }));
83
+ await page.route(/\/api\/jira\/(push|epic|edit|draft)$/, (r) => json(r, { ok: true, session: 's1', tickets: 7 }));
84
+ await page.goto(BASE + '/premium.html?ini=' + I + '&ws=w1&board=w1&theme=' + theme);
85
+ const up = await until(() => page.evaluate(() => !!document.querySelector('.hm-card [data-hm-ov]')), 30000);
86
+ return { ctx, page, errors, posts, up, set: (v) => { cur = v; } };
87
+ };
88
+ const V = '#czViewer:not([hidden])';
89
+ const tasks = async (p) => {
90
+ if (!(await p.evaluate(() => { const b = document.querySelector('.hm-card [data-hm-ov]'); return !!b && !!b.offsetParent; }))) await p.click('#hmNeeds');
91
+ await p.click('.hm-card [data-hm-ov]');
92
+ return until(() => p.evaluate((v) => !!document.querySelector(v + ' .tk-g .tk-row'), V), 30000);
93
+ };
94
+ const shot = async (p, name) => { if (!SHOTS) return; fs.mkdirSync(SHOTS, { recursive: true }); await sleep(250); await p.screenshot({ path: path.join(SHOTS, name) }); };
95
+ const txt = (p, s) => p.evaluate((q) => ((document.querySelector(q) || {}).textContent || '').replace(/\s+/g, ' ').trim(), s);
96
+
97
+ /* T1 · desktop: shell A, grouped by epic */
98
+ const A = await open(), p = A.page;
99
+ ok('0 Home draws the initiative', A.up);
100
+ ok('T1 the Tasks open grouped by epic once tickets are drafted', await tasks(p));
101
+ const heads = await p.evaluate((v) => [...document.querySelectorAll(v + ' .tk-g .tk-ghb b')].map((b) => b.textContent), V);
102
+ ok('T1 one group per epic, in the PRD\'s order, then Your tasks', heads.join('|') === 'Sign-in and sign-up|Sessions, SSO and second factor|Your tasks', JSON.stringify(heads));
103
+ ok('T1 each epic group has its send icon; Your tasks has none', await p.evaluate((v) => [...document.querySelectorAll(v + ' .tk-g')].map((g) => !!g.querySelector('[data-tk-sendg]')).join() === 'true,true,false', V));
104
+ ok('T1 a long group shows three tasks and "N more"', await p.evaluate((v) => { const g = document.querySelector(v + ' .tk-g'); return g.querySelectorAll('.tk-row').length === 3 && /^2 more/.test(g.querySelector('.tk-fold').textContent.trim()); }, V));
105
+ ok('T1 a drafted task reads "Story · M", with no status square', /Sign-in parity\s*Story · M/.test(await txt(p, V + ' .tk-row')) && !(await p.$(V + ' .tk-row .tk-sq')));
106
+ ok('T1 the summary card comes first, with one primary, Send to Jira', /drafted, not in Jira/.test(await txt(p, V + ' .czs-sum')) && (await txt(p, V + ' .czs-sum .czs-pri')) === 'Send to Jira' && (await p.$$(V + ' .czs-pri')).length === 1);
107
+ ok('T1 no Tasks | Documents | Stage switch on a desktop: they sit under ⋯', !(await p.$(V + ' [data-hi-view]')));
108
+ await p.click(V + ' .tk-g .tk-fold');
109
+ ok('T1 "N more" shows the rest, with the marker on the task that lacks text', await until(() => p.evaluate((v) => { const g = document.querySelector(v + ' .tk-g'); const m = g.querySelector('.tk-mk.warn'); return g.querySelectorAll('.tk-row').length === 5 && m && /Missing/.test(m.getAttribute('aria-label')); }, V)));
110
+ await shot(p, 'tasks-1440.png');
111
+
112
+ /* T3 · the Send sheet from a group's send icon */
113
+ await p.click(V + ' .tk-g [data-tk-sendg]');
114
+ const sheet = await until(() => p.evaluate(() => { const s = document.querySelector('.tk-sheet'); return s && s.querySelector('[data-tk-go]') ? s.textContent.replace(/\s+/g, ' ') : null; }));
115
+ ok('T3 the sheet names the project and the new epic after the group', !!sheet && /Project\s*IDPF/.test(sheet) && /Epic\s*New: Sign-in and sign-up/.test(sheet), sheet);
116
+ ok('T3 the complete tickets are ticked, the one that lacks text is not', await p.evaluate(() => [...document.querySelectorAll('.tk-sheet [data-tk-tick]')].map((b) => b.getAttribute('aria-checked') + (b.getAttribute('aria-disabled') ? '!' : '')).join() === 'true,true,true,true,false!'));
117
+ ok('T3 the one labeled press is "Send 4"', (await txt(p, '.tk-sheet [data-tk-go]')) === 'Send 4');
118
+ await shot(p, 'send-1440.png');
119
+ await p.click('.tk-sheet [data-tk-tick="S4"]');
120
+ ok('T3 a tick comes off, and Send counts it', (await txt(p, '.tk-sheet [data-tk-go]')) === 'Send 3');
121
+ await p.click('.tk-sheet [data-tk-change]');
122
+ await p.fill('.tk-sheet [data-tk-key]', 'https://acme.atlassian.net/browse/IDPF-400');
123
+ await p.click('.tk-sheet [data-tk-use]');
124
+ const ep = await until(() => A.posts.find((x) => x.path === '/api/jira/epic'));
125
+ ok('T3 Change writes the group\'s epic, as a page press', !!ep && ep.body.group === 'sign-in-and-sign-up' && ep.body.mode === 'existing' && /IDPF-400/.test(ep.body.key), JSON.stringify(ep));
126
+ ok('T3 nothing was sent before Send', !A.posts.some((x) => x.path === '/api/jira/push'));
127
+ await p.click('.tk-sheet [data-tk-go]');
128
+ const push = await until(() => A.posts.find((x) => x.path === '/api/jira/push'));
129
+ ok('T3 Send sends exactly the ticked tickets, with the project', !!push && push.body.ids.join() === 'S1,S2,S3' && push.body.initiative === I && push.body.ws === 'w1' && push.body.project === 'IDPF', JSON.stringify(push && push.body));
130
+ ok('T3 the sheet closes after the send', await until(() => p.evaluate(() => !document.querySelector('.tk-sheet'))));
131
+
132
+ /* T2 · one drafted ticket */
133
+ await p.click(V + ' .tk-row[data-tk-open="S1"]');
134
+ const dr = await until(() => p.evaluate((v) => { const b = document.querySelector(v + ' .tk-draft'); return b ? b.textContent.replace(/\s+/g, ' ') : null; }, V));
135
+ ok('T2 the drafted ticket: its four fields', !!dr && /Type\s*Story/.test(dr) && /Priority\s*High/.test(dr) && /Estimate\s*M/.test(dr) && /Depends on\s*Nothing/.test(dr), dr);
136
+ ok('T2 User story and Acceptance criteria shown, the criteria numbered', /User story\s*As a customer/.test(dr) && (await p.$$(V + ' .tk-ac')).length === 3);
137
+ ok('T2 the other sections fold with a count', /User flow\s*3 steps/.test(dr) && /Functional requirements\s*2/.test(dr) && /Refs\s*PRD/.test(dr));
138
+ ok('T2 one send icon, and ← back to the tasks', !!(await p.$(V + ' [data-tk-send]')) && !!(await p.$('#czViewer [data-cz-vw="back"]')));
139
+ await shot(p, 'draft-1440.png');
140
+ await p.click(V + ' [data-tk-field="priority"]');
141
+ await p.click('.hi-pop [role="menuitemradio"]:has-text("Highest")');
142
+ const ed = await until(() => A.posts.find((x) => x.path === '/api/jira/edit'));
143
+ ok('T2 a field changes in place: an edit of the draft, never Jira', !!ed && ed.body.id === 'S1' && ed.body.patch.priority === 'Highest', JSON.stringify(ed));
144
+ await p.click(V + ' [data-tk-fold="flow"]');
145
+ await p.click(V + ' [data-tk-edit="flow"]');
146
+ await p.fill(V + ' #tkEd', '1. Open the page.\n2. Sign in.');
147
+ await p.click(V + ' [data-tk-save="flow"]');
148
+ const ed2 = await until(() => A.posts.filter((x) => x.path === '/api/jira/edit')[1]);
149
+ ok('T2 a section is edited in place', !!ed2 && ed2.body.patch.sections && /Sign in/.test(ed2.body.patch.sections.flow), JSON.stringify(ed2));
150
+ await p.click(V + ' [data-tk-send]');
151
+ ok('T2 the send icon opens the sheet with this ticket ticked', await until(() => p.evaluate(() => [...document.querySelectorAll('.tk-sheet [data-tk-tick][aria-checked="true"]')].map((b) => b.dataset.tkTick).join() === 'S1')));
152
+ await p.keyboard.press('Escape');
153
+ await p.click('#czViewer [data-cz-vw="back"]');
154
+ ok('T2 ← returns to the tasks, still pressable', await until(() => p.evaluate((v) => !!document.querySelector(v + ' .tk-g .tk-row'), V)));
155
+ await p.click(V + ' [data-czs-act="tk-sendall"]');
156
+ ok('T3 the summary\'s Send to Jira opens the same sheet with every group', await until(() => p.evaluate(() => document.querySelectorAll('.tk-sheet .tk-sec').length === 2)));
157
+ await p.keyboard.press('Escape');
158
+ ok('0 no page error', !A.errors.length, A.errors.join(' | '));
159
+ await A.ctx.close();
160
+
161
+ /* T1 · after the send, and the phone */
162
+ {
163
+ const B = await open({ w: 390, h: 844, view: SENT }), q = B.page;
164
+ ok('T1 phone: the Tasks open grouped by epic', await tasks(q));
165
+ ok('T1 phone: the Tasks | Documents | Stage switch stays', !!(await q.$(V + ' [data-hi-view="tasks"]')));
166
+ const row = await q.evaluate((v) => { const r = document.querySelector(v + ' .tk-row'); return r ? { t: r.textContent.replace(/\s+/g, ' ').trim(), sq: (r.querySelector('.tk-sq') || {}).className, av: (r.querySelector('.tk-av') || {}).textContent, lab: (r.querySelector('.tk-ck') || {}).getAttribute && r.querySelector('.tk-ck').getAttribute('aria-label') } : null; }, V);
167
+ ok('T1 after the send: the key, a status square and the assignee', !!row && /Sign-in parity\s*IDPF-411/.test(row.t) && /doing/.test(row.sq) && row.av === 'Ru' && row.lab === 'In Jira: In Progress', JSON.stringify(row));
168
+ ok('T1 "Jira read at 9:02" is said once', (await q.$$eval(V + ' .tk-read', (n) => n.map((x) => x.textContent))).join() === 'Jira read at 9:02');
169
+ ok('T1 a group keeps its send icon while a task in it is not in Jira', await q.evaluate((v) => [...document.querySelectorAll(v + ' .tk-g')].slice(0, 2).map((g) => !!g.querySelector('[data-tk-sendg]')).join() === 'true,true', V));
170
+ await shot(q, 'sent-390.png');
171
+ await B.ctx.close();
172
+ const C = await open({ w: 390, h: 844 }), c = C.page;
173
+ await tasks(c);
174
+ await shot(c, 'tasks-390.png');
175
+ await c.click(V + ' .tk-g [data-tk-sendg]');
176
+ await until(() => c.evaluate(() => !!document.querySelector('.tk-sheet.phone [data-tk-go]')));
177
+ ok('T3 phone: the sheet rises from the bottom', await c.evaluate(() => { const r = document.querySelector('.tk-sheet').getBoundingClientRect(); return Math.abs(r.bottom - innerHeight) < 2 && r.left === 0; }));
178
+ await shot(c, 'send-390.png');
179
+ await c.keyboard.press('Escape');
180
+ await c.click(V + ' .tk-row[data-tk-open="S1"]');
181
+ await until(() => c.evaluate((v) => !!document.querySelector(v + ' .tk-draft'), V));
182
+ await shot(c, 'draft-390.png');
183
+ ok('0 phone: no page error', !C.errors.length && !B.errors.length, C.errors.concat(B.errors).join(' | '));
184
+ await C.ctx.close();
185
+ const D = await open({ theme: 'dark' }), d = D.page;
186
+ await tasks(d);
187
+ await shot(d, 'tasks-1440-dark.png');
188
+ await D.ctx.close();
189
+ }
190
+
191
+ /* the PM chose another grouping: it stays */
192
+ {
193
+ const E = await open({ layout: { by: 'mine', picked: true, names: ['Design'] } }), e = E.page;
194
+ await e.click('.hm-card [data-hm-ov]');
195
+ ok('T1 a grouping the PM chose wins over the Epic default', await until(() => e.evaluate((v) => !!document.querySelector(v + ' .hi-tg') && !document.querySelector(v + ' .tk-row'), V)));
196
+ await E.ctx.close();
197
+ }
198
+ finish();
199
+ })();