create-pmos 0.443.0 → 0.445.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/adler-moments-test.js +8 -0
- package/workspace/adler-seasons-art-test.js +3 -0
- package/workspace/board-columns-test.js +168 -0
- package/workspace/board-programs-test.js +1 -1
- package/workspace/briefing-premium-board-test.js +91 -8
- package/workspace/briefing-premium-insights-test.js +83 -38
- package/workspace/briefing-premium-test.js +2 -1
- package/workspace/calm-timeline-test.js +3 -1
- package/workspace/changelog.json +24 -0
- package/workspace/goals-clear-ui-test.js +34 -20
- package/workspace/guide/home.md +5 -0
- package/workspace/guide/jira.md +13 -1
- package/workspace/guide/ready-made-dashboards.md +2 -2
- package/workspace/intel-report-ui-test.js +1 -1
- package/workspace/lib/board-fold.js +33 -5
- package/workspace/lib/board-premium.js +1 -1
- package/workspace/lib/console-state.js +5 -1
- package/workspace/lib/engine/boards.js +9 -2
- package/workspace/lib/factory-join.js +46 -14
- package/workspace/lib/freshness.js +14 -1
- package/workspace/lib/initiative-rows.js +38 -4
- package/workspace/lib/issues.js +8 -1
- package/workspace/lib/jira-cli.js +18 -2
- package/workspace/lib/jira-moves.js +119 -0
- package/workspace/lib/jira-tickets.js +23 -4
- package/workspace/lib/notes.js +4 -2
- package/workspace/lib/offloop.js +75 -29
- package/workspace/lib/page-build.js +97 -0
- package/workspace/lib/plan-items.js +24 -3
- package/workspace/lib/plan-tree.js +62 -9
- package/workspace/lib/ready-reports.js +22 -8
- package/workspace/lib/refresh.js +14 -2
- package/workspace/lib/routes-board-premium.js +9 -1
- package/workspace/lib/routes-boards.js +114 -16
- package/workspace/lib/routes-brief-page.js +3 -1
- package/workspace/lib/routes-calendar-import.js +13 -1
- package/workspace/lib/routes-ready-reports.js +28 -5
- package/workspace/lib/task-links.js +12 -1
- package/workspace/lib/workflows-store.js +14 -3
- package/workspace/live-pill-round-test.js +178 -0
- package/workspace/milestone-pins-test.js +1 -1
- package/workspace/okr-goals-ui-test.js +21 -19
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/panels-test.js +375 -0
- package/workspace/premium-rec-tab-test.js +2 -1
- package/workspace/premium-vw-item-test.js +10 -2
- package/workspace/premium-vw-jira-test.js +3 -0
- package/workspace/program-panel-test.js +6 -6
- package/workspace/public/pm/bd-cols.js +149 -0
- package/workspace/public/pm/bd-ini-panel.js +3 -2
- package/workspace/public/pm/bd-pane.js +41 -0
- package/workspace/public/pm/bd-span.js +29 -11
- package/workspace/public/pm/cozy-adler.js +21 -0
- package/workspace/public/pm/cozy-board.css +45 -0
- package/workspace/public/pm/cozy-divider.css +32 -0
- package/workspace/public/pm/cozy-divider.js +45 -0
- package/workspace/public/pm/cozy-insights.css +22 -0
- package/workspace/public/pm/cozy-live-pill.css +17 -22
- package/workspace/public/pm/cozy-live-pill.js +38 -18
- package/workspace/public/pm/cozy-panels.css +80 -0
- package/workspace/public/pm/cozy-panels.js +691 -0
- package/workspace/public/pm/cozy-viewer.js +148 -70
- package/workspace/public/pm/dash-view.js +5 -2
- package/workspace/public/pm/goals-clear.js +9 -2
- package/workspace/public/pm/home-app.js +30 -19
- package/workspace/public/pm/home-ini.js +9 -3
- package/workspace/public/pm/home-today.js +4 -2
- package/workspace/public/pm/ini-edit.js +405 -0
- package/workspace/public/pm/ini-tasks.js +175 -46
- package/workspace/public/pm/ini-versions.js +18 -4
- package/workspace/public/pm/ini-view-model.js +12 -7
- package/workspace/public/pm/ini-view.css +162 -26
- package/workspace/public/pm/ini-view.js +44 -13
- package/workspace/public/pm/ini-wf-model.js +9 -0
- package/workspace/public/pm/ini-wf.js +14 -9
- package/workspace/public/pm/ins-pane.js +55 -0
- package/workspace/public/pm/jira-move.js +50 -0
- package/workspace/public/pm/live-model.js +3 -2
- package/workspace/public/pm/pn-narrow.js +76 -0
- package/workspace/public/pm/premium-board.js +85 -32
- package/workspace/public/pm/premium-insights.js +211 -43
- package/workspace/public/pm/task-card.css +2 -0
- package/workspace/public/pm/task-card.js +4 -1
- package/workspace/public/premium-board.html +2 -0
- package/workspace/ready-dash-ui-test.js +4 -4
- package/workspace/server.js +71 -20
- package/workspace/skills/jira-move.skill +35 -0
- package/workspace/stage-card-tasks-test.js +397 -0
- package/workspace/stage-card-test.js +1 -1
- package/workspace/task-delete-test.js +9 -1
- package/workspace/task-links-test.js +1 -0
- package/workspace/task-milestones-test.js +3 -3
- package/workspace/task-plans-test.js +1 -1
- package/workspace/task-press-test.js +12 -4
- package/workspace/task-views-test.js +166 -13
- package/workspace/test-lists/batch18-live-pill-round.json +10 -0
- package/workspace/test-lists/batch18-panels.json +9 -0
- package/workspace/test-lists/board-columns.json +5 -0
- package/workspace/test-lists/jira-moves.json +11 -0
- package/workspace/test-lists/page-speed-fold.json +5 -0
- package/workspace/test-lists/page-speed-reads.json +5 -0
- package/workspace/test-lists/stage-card-tasks.json +6 -0
- package/workspace/timeline-holds-test.js +1 -1
|
@@ -75,7 +75,7 @@ const ITEMS = [
|
|
|
75
75
|
PIN.set(b.task, b.pinned);
|
|
76
76
|
return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, from: { pinned: null }, item: null }) });
|
|
77
77
|
});
|
|
78
|
-
await page.addInitScript(([s]) => { try { if (!sessionStorage.getItem('set')) { sessionStorage.setItem('set', '1'); for (const [k, v] of Object.entries(s)) localStorage.setItem(k, v); } } catch { /* none */ } }, [{ 'pmos.board.view': o.view || 'time', 'pmos.board.pview': o.view || 'time', 'pmos.board.span': 'year' }]);
|
|
78
|
+
await page.addInitScript(([s]) => { try { if (!sessionStorage.getItem('set')) { sessionStorage.setItem('set', '1'); for (const [k, v] of Object.entries(s)) localStorage.setItem(k, v); } } catch { /* none */ } }, [{ 'pmos.board.tlcols': '[]', 'pmos.board.view': o.view || 'time', 'pmos.board.pview': o.view || 'time', 'pmos.board.span': 'year' }]);
|
|
79
79
|
await page.goto(BASE + '/premium-board.html?ws=w1&board=w1');
|
|
80
80
|
await page.waitForSelector('#ibBody [data-row]', { timeout: 15000 });
|
|
81
81
|
await page.waitForTimeout(400);
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* GsMetrics, GsMetricsTree, GsNotify). Serves the real page from the real server; GET /api/insights-premium answers the model lib/insights-premium.js
|
|
5
5
|
* builds from its fixture, with the fields lib/goal-status.js adds (reading, recipe, who, notify, was, history, defn, okr) set on some goals, and
|
|
6
6
|
* GET /api/metric-drafts answers drafts that sit under their goal. The write routes are stubbed here so each press can be read back.
|
|
7
|
-
* L the
|
|
8
|
-
*
|
|
7
|
+
* L the dashboard (re-pointed, batch 18 item 11 gap: Iq8Overview with GcJ2FirstMonday): the ✦ line, the North Star card, Key results, Health
|
|
8
|
+
* budgets, in that order; a row is the outcome, Now of target, So far, By its date and Moved by; a goal with no reading shows a dash
|
|
9
9
|
* D a draft sits under the row it repairs with ✕ / ✎ / ✓; ✓✓ in the ✦ line keeps them all; ✓ posts the row; the ✦ line never says "no insight"
|
|
10
|
-
* R a broken limit turns the ✦ line red (the one time) and pulses
|
|
10
|
+
* R a broken limit turns the ✦ line red (the one time) and pulses the North Star's dot
|
|
11
11
|
* V the goal Viewer: the reading against its line, the chart, why, and the folds How I read it, What it counts, History
|
|
12
12
|
* N the Viewer's ⋯: Notify me, Only in Intelligence (✦ my pick, on), Quiet; a press posts /api/goals/notify
|
|
13
13
|
* M ⋯ › Metrics: one list, goals first then "watch"; one switch shows the tree
|
|
14
|
-
* P on a phone: no sideways scroll,
|
|
14
|
+
* P on a phone: no sideways scroll, each key result a card with its drafts. PMOS_SHOTS=<dir> also saves screenshots. */
|
|
15
15
|
const path = require('path');
|
|
16
16
|
const fs = require('fs');
|
|
17
17
|
const { spawn } = require('child_process');
|
|
@@ -85,28 +85,29 @@ const ROWS = [
|
|
|
85
85
|
for (const k of ['keep', 'keep-all', 'drop', 'edit', 'undo', 'start']) await page.route('**/api/metric-drafts/' + k, (r) => { posts.push({ path: '/api/metric-drafts/' + k, body: JSON.parse(r.request().postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: JSON.stringify(k === 'keep' ? { ok: true, rid: 'r1' } : { ok: true, kept: 3 }) }); });
|
|
86
86
|
await page.route('**/api/goals/notify', (r) => { posts.push({ path: '/api/goals/notify', body: JSON.parse(r.request().postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
87
87
|
await page.goto(BASE + '/premium-intelligence.html?theme=' + theme);
|
|
88
|
-
await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .
|
|
88
|
+
await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0), 20000);
|
|
89
89
|
await until(() => page.evaluate(() => !!document.querySelector('#goalTbl .okr-dr')), 6000);
|
|
90
90
|
return { ctx, page, errors, posts };
|
|
91
91
|
};
|
|
92
92
|
const txt = (p, s) => p.evaluate((x) => { const e = document.querySelector(x); return e ? e.textContent.replace(/\s+/g, ' ').trim() : ''; }, s);
|
|
93
93
|
|
|
94
|
-
/* L · the
|
|
94
|
+
/* L · the dashboard (re-pointed, batch 18 item 11 gap: the agreed goals dashboard is Iq8Overview again, GcJ2FirstMonday and GcJ4Full: the
|
|
95
|
+
* North Star card with its line and its inputs, then one table of key results and health budgets; the owner is on the work in Moved by) */
|
|
95
96
|
const R = await open(), p = R.page;
|
|
96
|
-
const order = await p.evaluate(() => [...document.querySelectorAll('#insHero, #nsRow .
|
|
97
|
+
const order = await p.evaluate(() => [...document.querySelectorAll('#insHero, #nsRow .ins-nsc .ins-lbl2, #goalTbl .ins-th [role="columnheader"]:first-child, #goalTbl .ins-grp [role="cell"]')].filter((e) => e.offsetParent !== null).map((e) => e.id === 'insHero' ? '✦' : e.childNodes[0].textContent.trim()).filter((x) => !/^Objective/.test(x)));
|
|
97
98
|
ok('L1 top to bottom: the ✦ line, North Star, Key results, Health budgets', order.join('|') === '✦|North Star|Key results|Health budgets', order.join('|'));
|
|
98
|
-
const rows = await p.evaluate(() => [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => ({ id: r.dataset.goal,
|
|
99
|
+
const rows = await p.evaluate(() => [...document.querySelectorAll('#goalTbl .ins-row[data-goal]')].map((r) => ({ id: r.dataset.goal, now: r.querySelector('.val').textContent.replace(/\s+/g, ' ').trim(), sofar: !!r.querySelector('.sofar svg, .sofar .ins-one, .sofar .note'), pace: r.querySelector('.pace').textContent.replace(/\s+/g, ' ').trim(), mv: !!r.querySelector('.mv') })));
|
|
99
100
|
const act = rows.find((r) => r.id === 'krm-act') || {}, churn = rows.find((r) => r.id === 'krm-churn') || {};
|
|
100
|
-
ok('L2 a row is the
|
|
101
|
-
ok('L3
|
|
102
|
-
ok('L4 a goal with no reading
|
|
103
|
-
|
|
104
|
-
ok('L6 the North Star is
|
|
101
|
+
ok('L2 a row is the outcome, Now of target, So far, By its date and Moved by', rows.length >= 4 && rows.every((r) => r.sofar && r.mv && r.pace), JSON.stringify(rows));
|
|
102
|
+
ok('L3 a key result says its reading of its target and its pace by its date', /of \+?30|of 50%/.test(act.now) && /by Dec 31/.test(act.pace), JSON.stringify(act));
|
|
103
|
+
ok('L4 a goal with no reading shows a dash and says so', /—/.test(churn.now) && /No reading yet/i.test(JSON.stringify(churn)) , JSON.stringify(churn));
|
|
104
|
+
const ns = await txt(p, '#nsRow .ins-nsc');
|
|
105
|
+
ok('L6 the North Star is its own card with its number, its change and its line', /North Star Partner uptime/.test(ns) && /99\.6%/.test(ns) && !!(await p.$('#nsRow .ins-nsch')), ns);
|
|
105
106
|
await shot(p, 'okr-desktop-light');
|
|
106
107
|
|
|
107
108
|
/* D · drafts */
|
|
108
|
-
const under = await p.evaluate(() => ({ chase: !!document.querySelector('[data-
|
|
109
|
-
acts: [...document.querySelectorAll('[data-draft="d-chase"] .acts button')].map((b) => b.getAttribute('aria-label').split(':')[0]), old: (document.querySelector('[data-draft="d-out"] .okr-old') || {}).textContent || '' }));
|
|
109
|
+
const under = await p.evaluate(() => ({ chase: !!document.querySelector('[data-drafts-for="krm-act"] [data-draft="d-chase"]'), out: !!document.querySelector('[data-drafts-for="krm-ttfc"] [data-draft="d-out"]'), kr: !!document.querySelector('#draftBox [data-gc-row="d-kr"]') && !document.querySelector('#goalTbl [data-draft-row="d-kr"]'),
|
|
110
|
+
acts: [...document.querySelectorAll('#goalTbl [data-draft="d-chase"] .acts button')].map((b) => b.getAttribute('aria-label').split(':')[0]), old: (document.querySelector('[data-draft="d-out"] .okr-old') || {}).textContent || '' }));
|
|
110
111
|
// batch 18 item 11 (GcJ1aTable): a drafted key result is a row of the drafts table, no longer a hollow row in the list
|
|
111
112
|
ok('D1 each draft sits under the row it repairs; a drafted key result is a row of the drafts table', under.chase && under.out && under.kr, JSON.stringify(under));
|
|
112
113
|
ok('D2 a draft has ✕ / ✎ / ✓, and ✓ says its act (Send)', under.acts.join('|') === 'Not now|Edit|Send', under.acts.join('|'));
|
|
@@ -125,7 +126,7 @@ const ROWS = [
|
|
|
125
126
|
ok('D8 ✓ on the edit posts what was typed (a fix row posts its text, lib/metric-drafts.js editOf)', await until(() => R.posts.some((x) => x.path === '/api/metric-drafts/edit' && x.body.row === 'd-out' && x.body.text === 'New partners call us within 3 days' && x.body.name === undefined)));
|
|
126
127
|
|
|
127
128
|
/* V · the goal Viewer */
|
|
128
|
-
await p.click('#goalTbl [data-goal="krm-act"] .
|
|
129
|
+
await p.click('#goalTbl [data-goal="krm-act"] .nm');
|
|
129
130
|
const v = await until(() => p.evaluate(() => { const V = document.querySelector('#czViewer'); if (!V || V.hidden) return null; return { title: (V.querySelector('.cz-vw-title') || {}).textContent || '', head: (V.querySelector('.okr-vh') || {}).textContent || '', chart: !!V.querySelector('.ins-gbig svg'), why: (V.querySelector('.okr-why') || {}).textContent || '', folds: [...V.querySelectorAll('.czs-row b')].map((b) => b.textContent) }; }), 5000);
|
|
130
131
|
ok('V1 the Viewer opens on the goal with its reading against its line and the owner', v && /Partner activation/.test(v.title) && /\+8 of \+30 points/.test(v.head) && /its line says \+18/.test(v.head) && /RP/.test(v.head), JSON.stringify(v));
|
|
131
132
|
ok('V2 then the chart and why it moved', v && v.chart && /catches up about 3 weeks/.test(v.why), JSON.stringify(v));
|
|
@@ -160,7 +161,7 @@ const ROWS = [
|
|
|
160
161
|
|
|
161
162
|
/* R · a broken limit */
|
|
162
163
|
const C = await open({ m: model({ crit: true }), rows: [] });
|
|
163
|
-
const cr = await C.page.evaluate(() => ({ crit: document.querySelector('#insHero').classList.contains('crit'), t: document.querySelector('#brief').textContent, pulse: !!document.querySelector('#nsRow
|
|
164
|
+
const cr = await C.page.evaluate(() => ({ crit: document.querySelector('#insHero').classList.contains('crit'), t: document.querySelector('#brief').textContent, pulse: !!document.querySelector('#nsRow .ins-nsc .cz-dot.m-crit') }));
|
|
164
165
|
ok('R1 a broken limit is the one time the ✦ line turns red, and its dot pulses', cr.crit && /fell under its floor/.test(cr.t) && cr.pulse, JSON.stringify(cr));
|
|
165
166
|
await shot(C.page, 'okr-crit', '#stage');
|
|
166
167
|
await C.ctx.close();
|
|
@@ -168,8 +169,9 @@ const ROWS = [
|
|
|
168
169
|
/* P · a phone */
|
|
169
170
|
for (const theme of ['light', 'dark']) {
|
|
170
171
|
const Q = await open({ w: 390, h: 844, theme });
|
|
171
|
-
const ph = await Q.page.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1,
|
|
172
|
-
|
|
172
|
+
const ph = await Q.page.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, cards: document.querySelectorAll('#goalCards .ins-card').length, drafts: document.querySelectorAll('#goalCards > .okr-dr').length }));
|
|
173
|
+
// re-pointed (batch 18 item 11 gap, Iq8Phone): on a phone each key result is a card, its drafts under it
|
|
174
|
+
ok('P1 on a phone (' + theme + ') the key results are cards with their drafts, with no sideways scroll', !ph.over && ph.cards >= 4 && ph.drafts >= 2, JSON.stringify(ph));
|
|
173
175
|
await shot(Q.page, 'okr-phone-' + theme);
|
|
174
176
|
await Q.ctx.close();
|
|
175
177
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.445.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.445.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* panels-test.js — panels side by side on Home, like a tablet (feedback batch 18 item 15, build 15-A; canvas TbT1Split … TbT9Divider;
|
|
4
|
+
* public/pm/cozy-panels.js, cozy-viewer.js several Viewers, home-app.js mountPanels).
|
|
5
|
+
* Serves the real page from the real server; GET /api/briefing-premium answers the fixture model (as home-railcard-test.js does).
|
|
6
|
+
* N1 an initiative opens as today's split: the chat, one divider (a separator), the Viewer; ⧉ before × on both headers, no ⤢ on Home
|
|
7
|
+
* N2 a drag of the divider near the middle snaps it at ½; double-click resets it; ← and → move it 24 px
|
|
8
|
+
* N3 a drag of the divider to the left edge slides the chat away: the Viewer is whole and the list folds to a rail
|
|
9
|
+
* N4 ⧉ opens Full screen, Split, Slide over (44 px icons, the current one checked); Split brings the chat back beside
|
|
10
|
+
* N5 Slide over floats the chat over the right side (400 px, a grab bar); a drag off the right edge puts it away; slideOver() brings it back
|
|
11
|
+
* N6 a list row dragged to the far right edge shows the blue drop zone; on the drop it opens in a Viewer of its own beside (TbT6TwoViewers):
|
|
12
|
+
* two Viewers side by side at 1440, the chat slides over; a third replaces the Viewer used least recently
|
|
13
|
+
* N7 at 1920 the chat and two Viewers sit side by side with two dividers (TbT8Wide)
|
|
14
|
+
* N8 the initiative reopens with its last panels (the chat put away is remembered across a reload)
|
|
15
|
+
* N9 Present in a recording slides the chat away; Stop brings it back
|
|
16
|
+
* N10 a phone keeps today's one panel: no divider, no ⧉; dark uses the tokens; no page error anywhere
|
|
17
|
+
* Board and Intelligence (panels on Board and Intelligence, P-A; canvas BiB1Split … BiB9DropOn, BiI1Split … BiI4Wide): the page is the first panel
|
|
18
|
+
* P1 a row opens a split (no float), the Viewer no wider than fit() leaves; ⧉ in place of ⤢ P2 the snap at ½ makes the page narrow
|
|
19
|
+
* (cz-pn-narrow); only the share is kept P3 ⧉ Slide over, put away, the Live pill brings it back P4 ⌘/Ctrl-click opens beside (slides
|
|
20
|
+
* over at 1440), the active edge, a plain click replaces the Viewer used last P5 a drop on a Viewer replaces it P6 the divider to the
|
|
21
|
+
* left edge: full screen; Split brings the page back; to the right edge: the Viewer closes P7 a reload reopens nothing; the share holds;
|
|
22
|
+
* Home resets it P8 1920: a drop at the far edge opens beside, three panels P9 Intelligence: split, ⌘-click P10 a phone as today
|
|
23
|
+
* Screenshots go to PMOS_SHOTS when it is set. Every wait polls the page. */
|
|
24
|
+
const fs = require('fs');
|
|
25
|
+
const path = require('path');
|
|
26
|
+
const { spawn } = require('child_process');
|
|
27
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
28
|
+
const T = require('./test-run').configure({ name: 'panels' });
|
|
29
|
+
const B = require('./lib/briefing-premium.js');
|
|
30
|
+
const F = require('./fixtures/briefing-premium-facts.js');
|
|
31
|
+
const BP = require('./lib/board-premium.js');
|
|
32
|
+
const BF = require('./fixtures/board-premium-facts.js');
|
|
33
|
+
const IP = require('./lib/insights-premium.js');
|
|
34
|
+
const IF = require('./fixtures/insights-premium-facts.js');
|
|
35
|
+
|
|
36
|
+
const BASE = T.BASE;
|
|
37
|
+
const SHOTS = process.env.PMOS_SHOTS || '';
|
|
38
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
39
|
+
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
40
|
+
const results = [];
|
|
41
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
42
|
+
let srv = null; let browser = null;
|
|
43
|
+
const finish = async (code) => {
|
|
44
|
+
if (browser) await browser.close().catch(() => {});
|
|
45
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
46
|
+
T.killTmux();
|
|
47
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
48
|
+
console.log(`\n${results.length - bad}/${results.length} panels assertions passed`);
|
|
49
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
50
|
+
};
|
|
51
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
52
|
+
|
|
53
|
+
(async () => {
|
|
54
|
+
const exe = findBrowser();
|
|
55
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the panels suite cannot run'); return finish(1); }
|
|
56
|
+
let chromium;
|
|
57
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed — the panels suite cannot run'); return finish(1); }
|
|
58
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
59
|
+
await T.waitForServer(BASE);
|
|
60
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
61
|
+
|
|
62
|
+
const open = async ({ w = 1440, h = 900, dark = false, ctx = null, q = '', at = '/premium.html', ready = () => !!window.czPanels && document.querySelectorAll('#hmList .hv-r.ini .hm-rm').length > 2 } = {}) => {
|
|
63
|
+
ctx = ctx || await browser.newContext({ viewport: { width: w, height: h }, colorScheme: dark ? 'dark' : 'light' });
|
|
64
|
+
const page = await ctx.newPage();
|
|
65
|
+
const errors = [];
|
|
66
|
+
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
67
|
+
const json = (r, b) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(b) });
|
|
68
|
+
await page.route(/\/api\/board-premium(\?.*)?$/, (r) => { const ws = new URL(r.request().url()).searchParams.get('ws') || 'idpf'; return json(r, { ok: true, state: 'ready', model: BP.build(BF.programFacts(ws)), as_of: Date.now() }); });
|
|
69
|
+
await page.route(/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: B.buildMany(F.programFacts()), as_of: Date.now() }));
|
|
70
|
+
await page.route('**/api/programs', (r) => json(r, { ok: true, programs: F.programs() }));
|
|
71
|
+
await page.route('**/api/insights-premium*', (r) => json(r, { ok: true, state: 'ready', model: IP.build(IF.facts({ pinned: 'all' })), as_of: 1 }));
|
|
72
|
+
await page.route('**/api/board-metrics-premium*', (r) => json(r, { ok: true, state: 'ready', model: { tiles: [] } }));
|
|
73
|
+
await page.goto(BASE + at + q);
|
|
74
|
+
const up = await until(() => page.evaluate(ready), 20000);
|
|
75
|
+
const close = async () => { await ctx.unrouteAll({ behavior: 'ignoreErrors' }).catch(() => {}); await ctx.close().catch(() => {}); };
|
|
76
|
+
return { ctx, page, errors, up, close };
|
|
77
|
+
};
|
|
78
|
+
const shot = async (page, name) => { if (!SHOTS) return; await sleep(400); fs.mkdirSync(SHOTS, { recursive: true }); await page.screenshot({ path: path.join(SHOTS, name + '.png') }); };
|
|
79
|
+
/** what the page shows: each panel's box and mode, the dividers, the rail */
|
|
80
|
+
const lay = (page) => page.evaluate(() => {
|
|
81
|
+
const box = (el) => { if (!el) return null; const r = el.getBoundingClientRect(); return { l: Math.round(r.left), r: Math.round(r.right), w: Math.round(r.width), shown: r.width > 0 && getComputedStyle(el).display !== 'none' }; };
|
|
82
|
+
const P = window.czPanels.list();
|
|
83
|
+
return {
|
|
84
|
+
panels: P.map((p) => ({ ...p, box: box(p.id === 'chat' ? document.getElementById('hmChat') : document.querySelector(`[data-cz-panel="${p.id}"]`)) })),
|
|
85
|
+
divs: [...document.querySelectorAll('.cz-pn-div')].map((d) => ({ ...box(d), role: d.getAttribute('role'), first: d.dataset.k === '0' })),
|
|
86
|
+
rail: window.czViewer.railOn(), list: Math.round(document.getElementById('hmList').getBoundingClientRect().width),
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
const P = (l, id) => l.panels.find((p) => p.id === id) || null;
|
|
90
|
+
const rows = (page) => page.evaluate(() => [...document.querySelectorAll('#hmList .hv-r.ini .hm-rm[data-hm-sel]')].map((b) => b.dataset.hmSel));
|
|
91
|
+
/** drag from the centre of a selector's element to (x, y) in steps, as a mouse does */
|
|
92
|
+
const drag = async (page, from, x, y, { hold } = {}) => {
|
|
93
|
+
const r = typeof from === 'string' ? await page.evaluate((s) => { const b = document.querySelector(s).getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2 }; }, from) : from;
|
|
94
|
+
await page.mouse.move(r.x, r.y); await page.mouse.down();
|
|
95
|
+
for (let i = 1; i <= 12; i++) { await page.mouse.move(r.x + (x - r.x) * i / 12, r.y + (y - r.y) * i / 12); await sleep(16); }
|
|
96
|
+
if (hold) await hold();
|
|
97
|
+
await page.mouse.up();
|
|
98
|
+
};
|
|
99
|
+
const divAt = (page, k = 0) => page.evaluate((i) => { const d = document.querySelectorAll('.cz-pn-div')[i]; const r = d.getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2 }; }, k);
|
|
100
|
+
|
|
101
|
+
/* ── 1440: the split, the divider, ⧉, slide over ── */
|
|
102
|
+
const A = await open();
|
|
103
|
+
ok('0 Home draws its rows and window.czPanels', !!A.up);
|
|
104
|
+
const R = await rows(A.page);
|
|
105
|
+
await A.page.click(`#hmList .hm-rm[data-hm-sel="${R[0]}"]`);
|
|
106
|
+
const l1 = await until(() => lay(A.page).then((l) => (P(l, 'v0') && P(l, 'v0').box.shown && l.divs.length === 1 ? l : null)));
|
|
107
|
+
ok('N1 today\'s split: the chat, one divider (a separator), the Viewer', !!l1 && P(l1, 'chat').mode === 'split' && P(l1, 'v0').mode === 'split' && l1.divs[0].role === 'separator'
|
|
108
|
+
&& P(l1, 'chat').box.r <= l1.divs[0].l + 12 && l1.divs[0].r <= P(l1, 'v0').box.l + 12, JSON.stringify(l1));
|
|
109
|
+
const heads = await A.page.evaluate(() => ({ vw: [...document.querySelectorAll('#czViewer .cz-vw-hd [data-cz-vw]')].map((b) => b.dataset.czVw), chat: [...document.querySelectorAll('#hmChat .cz-pn-ct button')].map((b) => b.getAttribute('aria-label')) }));
|
|
110
|
+
ok('N1 ⧉ before × on the Viewer\'s header and on the chat; no ⤢ on Home', heads.vw.slice(-2).join() === 'place,close' && !heads.vw.includes('wide') && heads.chat.join('|') === 'Arrange the chat|Put the chat away', JSON.stringify(heads));
|
|
111
|
+
await shot(A.page, 'n1-split-1440');
|
|
112
|
+
|
|
113
|
+
// N2 the divider: near the middle it snaps at ½ of the row
|
|
114
|
+
const d0 = await divAt(A.page);
|
|
115
|
+
const mid = (P(l1, 'chat').box.l + P(l1, 'v0').box.r) / 2;
|
|
116
|
+
await drag(A.page, d0, mid + 9, d0.y);
|
|
117
|
+
const l2 = await until(() => lay(A.page).then((l) => { const c = P(l, 'chat').box, v = P(l, 'v0').box; return Math.abs(c.w - v.w) <= 4 ? l : null; }), 3000);
|
|
118
|
+
ok('N2 a drag near the middle snaps the divider at ½ (the chat and the Viewer as wide)', !!l2, JSON.stringify(l2 && [P(l2, 'chat').box, P(l2, 'v0').box]));
|
|
119
|
+
await A.page.focus('.cz-pn-div');
|
|
120
|
+
const w0 = (await lay(A.page)).panels.find((p) => p.id === 'v0').box.w;
|
|
121
|
+
await A.page.keyboard.press('ArrowLeft');
|
|
122
|
+
const w1 = await until(() => lay(A.page).then((l) => { const w = P(l, 'v0').box.w; return w !== w0 ? w : null; }), 3000);
|
|
123
|
+
ok('N2 ← moves the divider 24 px (the Viewer grows)', w1 === w0 + 24, JSON.stringify([w0, w1]));
|
|
124
|
+
{ const d = await divAt(A.page); await A.page.mouse.dblclick(d.x, d.y); } // the divider is 0 wide: its hit area is 20 px around it
|
|
125
|
+
const l2b = await until(() => lay(A.page).then((l) => (Math.abs(P(l, 'chat').box.w - P(l, 'v0').box.w) <= 30 ? l : null)), 3000);
|
|
126
|
+
ok('N2 double-click resets it to about ½', !!l2b, JSON.stringify(l2b && [P(l2b, 'chat').box, P(l2b, 'v0').box]));
|
|
127
|
+
|
|
128
|
+
// N3 to the left edge: the chat slides away, the Viewer is whole, the list folds to a rail
|
|
129
|
+
const d1 = await divAt(A.page);
|
|
130
|
+
await drag(A.page, d1, P(l1, 'chat').box.l + 30, d1.y);
|
|
131
|
+
const l3 = await until(() => lay(A.page).then((l) => (P(l, 'chat').mode === 'away' ? l : null)), 3000);
|
|
132
|
+
ok('N3 a drag to the left edge slides the chat away; the Viewer is whole; the list folds to a rail; no divider', !!l3 && !P(l3, 'chat').box.shown && P(l3, 'v0').full && l3.rail && l3.divs.length === 0 && P(l3, 'v0').box.w > 1100, JSON.stringify(l3));
|
|
133
|
+
await shot(A.page, 'n3-full-1440');
|
|
134
|
+
|
|
135
|
+
// N4 ⧉: three icons, Full checked; Split brings the chat back beside
|
|
136
|
+
await A.page.click('#czViewer [data-cz-vw="place"]');
|
|
137
|
+
const m4 = await until(() => A.page.evaluate(() => { const m = document.querySelector('.cz-pn-menu'); if (!m) return null; return [...m.querySelectorAll('button')].map((b) => ({ n: b.getAttribute('aria-label'), on: b.getAttribute('aria-checked'), w: Math.round(b.getBoundingClientRect().width), h: Math.round(b.getBoundingClientRect().height), text: b.textContent.trim() })); }));
|
|
138
|
+
ok('N4 ⧉ opens Full screen, Split, Slide over: icons only, 44 px, Full screen checked', !!m4 && m4.map((b) => b.n).join('|') === 'Full screen|Split|Slide over' && m4.every((b) => b.w === 44 && b.h === 44 && !b.text) && m4[0].on === 'true', JSON.stringify(m4));
|
|
139
|
+
await shot(A.page, 'n4-menu-1440');
|
|
140
|
+
await A.page.click('.cz-pn-menu [data-cz-pn-place="split"]');
|
|
141
|
+
const l4 = await until(() => lay(A.page).then((l) => (P(l, 'chat').mode === 'split' && P(l, 'chat').box.shown ? l : null)), 3000);
|
|
142
|
+
ok('N4 Split brings the chat back beside the Viewer, with its divider', !!l4 && l4.divs.length === 1 && !P(l4, 'v0').full, JSON.stringify(l4));
|
|
143
|
+
|
|
144
|
+
// N5 slide over: the chat floats over the right side; a drag off the right edge puts it away; slideOver() brings it back
|
|
145
|
+
await A.page.click('#hmChat .cz-pn-ct [data-cz-pn-chat="place"]');
|
|
146
|
+
await until(() => A.page.$('.cz-pn-menu'));
|
|
147
|
+
await A.page.click('.cz-pn-menu [data-cz-pn-place="over"]');
|
|
148
|
+
const l5 = await until(() => lay(A.page).then((l) => (P(l, 'chat').mode === 'over' ? l : null)), 3000);
|
|
149
|
+
const vw5 = await A.page.evaluate(() => innerWidth);
|
|
150
|
+
ok('N5 Slide over: the chat floats 400 px wide at the right, over a whole Viewer, with a grab bar', !!l5 && P(l5, 'chat').box.w === 400 && vw5 - P(l5, 'chat').box.r < 40 && P(l5, 'v0').full
|
|
151
|
+
&& await A.page.evaluate(() => !!document.querySelector('#hmChat.cz-pn-over > .cz-pn-grab')), JSON.stringify(l5));
|
|
152
|
+
await shot(A.page, 'n5-over-1440');
|
|
153
|
+
const g = await A.page.evaluate(() => { const r = document.querySelector('#hmChat > .cz-pn-grab').getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2 }; });
|
|
154
|
+
await drag(A.page, g, g.x + 200, g.y);
|
|
155
|
+
const l5b = await until(() => lay(A.page).then((l) => (P(l, 'chat').mode === 'away' ? l : null)), 3000);
|
|
156
|
+
ok('N5 a drag off the right edge puts it away; czPanels.away() names it; nothing else opens', !!l5b && !P(l5b, 'chat').box.shown && await A.page.evaluate(() => window.czPanels.away() === 'chat'), JSON.stringify(l5b));
|
|
157
|
+
ok('N5 czPanels.slideOver() brings it back over', await A.page.evaluate(() => window.czPanels.slideOver()) && !!(await until(() => lay(A.page).then((l) => (P(l, 'chat').mode === 'over' && P(l, 'chat').box.shown ? l : null)), 3000)));
|
|
158
|
+
await A.page.evaluate(() => window.czPanels.place('chat', 'split'));
|
|
159
|
+
|
|
160
|
+
// N6 open beside: drag a list row to the right half
|
|
161
|
+
await until(() => lay(A.page).then((l) => (l.divs.length === 1 && !l.rail ? l : null)), 3000);
|
|
162
|
+
const v0r = (await lay(A.page)).panels.find((p) => p.id === 'v0').box;
|
|
163
|
+
let zone = null;
|
|
164
|
+
await A.page.click('#czViewer .cz-vw-hd'); // the Viewer is the panel used last: the chat gives way
|
|
165
|
+
await drag(A.page, `#hmList .hm-rm[data-hm-sel="${R[1]}"]`, v0r.r - 60, 450, { hold: async () => { zone = await A.page.evaluate(() => { const z = document.querySelector('.cz-pn-drop:not([hidden])'); if (!z) return null; const r = z.getBoundingClientRect(); return { side: z.dataset.side, l: Math.round(r.left), w: Math.round(r.width), bg: getComputedStyle(z).backgroundColor }; }); await shot(A.page, 'n6-drag-1440'); } });
|
|
166
|
+
ok('N6 dragging a row to the far right edge shows the blue drop zone there (open beside)', !!zone && zone.side === 'right' && zone.w >= 100 && zone.l + zone.w >= v0r.r - 2, JSON.stringify(zone));
|
|
167
|
+
const l6 = await until(() => lay(A.page).then((l) => (P(l, 'v1') && P(l, 'v1').box.shown && P(l, 'v0').box.shown ? l : null)), 6000);
|
|
168
|
+
ok('N6 on the drop the row opens in a second Viewer on the right; at 1440 the two Viewers sit side by side and the chat slides over', !!l6 && P(l6, 'v1').box.l > P(l6, 'v0').box.l && P(l6, 'chat').mode === 'over' && l6.divs.length === 1, JSON.stringify(l6));
|
|
169
|
+
const t6 = await A.page.evaluate(() => [...document.querySelectorAll('.cz-vw:not([hidden]) .cz-vw-title')].map((h) => h.textContent));
|
|
170
|
+
ok('N6 each Viewer shows its own item; czViewer.current() is the one opened last', t6.length === 2 && t6[0] !== t6[1] && await A.page.evaluate((t) => window.czViewer.current().title === t, t6[1]), JSON.stringify(t6));
|
|
171
|
+
const act6 = await A.page.evaluate(() => [...document.querySelectorAll('.cz-vw:not([hidden])')].map((v) => ({ id: v.id, on: v.classList.contains('cz-pn-active'), sh: getComputedStyle(v).boxShadow })));
|
|
172
|
+
ok('N6 with two Viewers the one a plain click replaces (used last) has the thin blue edge; the other has none', act6.length === 2 && act6.filter((v) => v.on).length === 1 && act6.find((v) => v.on).id === 'czViewer2' && /2px/.test(act6.find((v) => v.on).sh), JSON.stringify(act6));
|
|
173
|
+
{ const r = await A.page.evaluate(() => { const b = document.querySelector('#czViewer .cz-vw-body').getBoundingClientRect(); return { x: b.left + 60, y: b.top + 80 }; }); await A.page.mouse.move(r.x, r.y); await A.page.mouse.wheel(0, 40); }
|
|
174
|
+
ok('N6 a scroll in the other Viewer moves the edge to it', !!(await until(() => A.page.evaluate(() => document.querySelector('#czViewer').classList.contains('cz-pn-active') && !document.querySelector('#czViewer2').classList.contains('cz-pn-active')), 3000)));
|
|
175
|
+
await A.page.click('#czViewer2 .cz-vw-hd', { position: { x: 30, y: 20 } });
|
|
176
|
+
await shot(A.page, 'n6-two-viewers-1440');
|
|
177
|
+
// a third row: it replaces the Viewer used least recently (v0, as v1 was used last)
|
|
178
|
+
await A.page.click('#czViewer2 .cz-vw-hd', { position: { x: 30, y: 20 } });
|
|
179
|
+
await A.page.evaluate(() => window.czPanels.putAway());
|
|
180
|
+
await A.page.click('[data-cz-vw-rail="show"]'); // two Viewers fold the list to a rail; its list button brings the rows back
|
|
181
|
+
await until(() => lay(A.page).then((l) => (!l.rail ? l : null)), 3000);
|
|
182
|
+
const v1r = (await lay(A.page)).panels.find((p) => p.id === 'v1').box;
|
|
183
|
+
await drag(A.page, `#hmList .hm-rm[data-hm-sel="${R[2]}"]`, v1r.r - 60, 450);
|
|
184
|
+
const l6c = await until(() => lay(A.page).then((l) => { const t = l.panels.filter((p) => p.kind === 'viewer' && p.box.shown); return t.length === 2 && t.some((p) => p.title !== t6[0] && p.title !== t6[1]) ? l : null; }), 6000);
|
|
185
|
+
const t6c = l6c ? l6c.panels.filter((p) => p.kind === 'viewer' && p.box.shown).map((p) => p.title) : []; // the one giving way closes a moment later
|
|
186
|
+
ok('N6 a third Viewer at 1440 replaces the one used least recently (still two side by side)', !!l6c && !t6c.includes(t6[0]) && t6c.includes(t6[1]), JSON.stringify([t6c, await lay(A.page)]));
|
|
187
|
+
ok('0 no page error at 1440', A.errors.length === 0, A.errors.join(' | '));
|
|
188
|
+
await A.close();
|
|
189
|
+
|
|
190
|
+
/* ── 1920: three side by side ── */
|
|
191
|
+
const W = await open({ w: 1920, h: 1080 });
|
|
192
|
+
await W.page.click(`#hmList .hm-rm[data-hm-sel="${R[0]}"]`);
|
|
193
|
+
await until(() => lay(W.page).then((l) => (P(l, 'v0') && P(l, 'v0').box.shown ? l : null)));
|
|
194
|
+
const v0w = (await lay(W.page)).panels.find((p) => p.id === 'v0').box;
|
|
195
|
+
await drag(W.page, `#hmList .hm-rm[data-hm-sel="${R[1]}"]`, v0w.r - 60, 500);
|
|
196
|
+
const l7 = await until(() => lay(W.page).then((l) => (P(l, 'v1') && P(l, 'v1').box.shown && l.divs.length === 2 ? l : null)), 6000);
|
|
197
|
+
ok('N7 at 1920 the chat and two Viewers sit side by side with two dividers; only the first is first', !!l7 && P(l7, 'chat').mode === 'split' && P(l7, 'chat').box.r < P(l7, 'v0').box.l && P(l7, 'v0').box.r < P(l7, 'v1').box.l && l7.divs.filter((d) => d.first).length === 1, JSON.stringify(l7 || await lay(W.page)));
|
|
198
|
+
await shot(W.page, 'n7-three-1920');
|
|
199
|
+
ok('0 no page error at 1920', W.errors.length === 0, W.errors.join(' | '));
|
|
200
|
+
await W.close();
|
|
201
|
+
|
|
202
|
+
/* ── remembered per initiative: the chat put away comes back put away after a reload ── */
|
|
203
|
+
const ctx8 = await browser.newContext({ viewport: { width: 1440, height: 900 } });
|
|
204
|
+
const M = await open({ ctx: ctx8 });
|
|
205
|
+
await M.page.click(`#hmList .hm-rm[data-hm-sel="${R[0]}"]`);
|
|
206
|
+
await until(() => lay(M.page).then((l) => (P(l, 'v0') && P(l, 'v0').box.shown ? l : null)));
|
|
207
|
+
await M.page.evaluate(() => window.czPanels.place('v0', 'full'));
|
|
208
|
+
await until(() => lay(M.page).then((l) => (P(l, 'chat').mode === 'away' ? l : null)), 3000);
|
|
209
|
+
const ini = await M.page.evaluate(() => new URL(location.href).searchParams.get('ini'));
|
|
210
|
+
const kept = await M.page.evaluate((id) => { try { return JSON.parse(localStorage.getItem('cz-pn:' + id)); } catch { return null; } }, ini);
|
|
211
|
+
ok('N8 the initiative\'s panels are kept in localStorage (cz-pn:<initiative id>)', !!ini && !!kept && kept.chat === 'away', JSON.stringify([ini, kept]));
|
|
212
|
+
await M.page.close();
|
|
213
|
+
const M2 = await open({ ctx: ctx8, q: '?ini=' + encodeURIComponent(ini || '') });
|
|
214
|
+
const l8 = await until(() => lay(M2.page).then((l) => (P(l, 'v0') && P(l, 'v0').box.shown && P(l, 'chat').mode === 'away' ? l : null)), 8000);
|
|
215
|
+
ok('N8 reopening the initiative restores its panels (the Viewer whole, the chat put away)', !!l8, JSON.stringify(await lay(M2.page)));
|
|
216
|
+
|
|
217
|
+
/* ── Present: the chat slides away while a recording presents, and comes back on Stop ── */
|
|
218
|
+
await M2.page.evaluate(() => window.czPanels.place('chat', 'split'));
|
|
219
|
+
await until(() => lay(M2.page).then((l) => (P(l, 'chat').mode === 'split' ? l : null)), 3000);
|
|
220
|
+
await M2.page.evaluate(() => { const c = new BroadcastChannel('pmos-present'); c.postMessage({ t: 'show', show: { mat: { title: 'Award recommendation' } } }); c.close(); });
|
|
221
|
+
ok('N9 Present in a recording slides the chat away by itself', !!(await until(() => lay(M2.page).then((l) => (P(l, 'chat').mode === 'away' ? l : null)), 3000)));
|
|
222
|
+
await M2.page.evaluate(() => { const c = new BroadcastChannel('pmos-present'); c.postMessage({ t: 'off' }); c.close(); });
|
|
223
|
+
ok('N9 Stop brings it back beside', !!(await until(() => lay(M2.page).then((l) => (P(l, 'chat').mode === 'split' && P(l, 'chat').box.shown ? l : null)), 3000)));
|
|
224
|
+
ok('0 no page error when restoring', M.errors.length === 0 && M2.errors.length === 0, [...M.errors, ...M2.errors].join(' | '));
|
|
225
|
+
await M2.close();
|
|
226
|
+
|
|
227
|
+
/* ── a phone keeps one panel; dark uses the tokens ── */
|
|
228
|
+
const Ph = await open({ w: 390, h: 844 });
|
|
229
|
+
await Ph.page.evaluate(() => { const b = document.querySelector('#hmList .hv-r.ini .hm-rm'); if (b) b.click(); });
|
|
230
|
+
await until(() => Ph.page.evaluate(() => !!document.querySelector('#czViewer:not([hidden])')));
|
|
231
|
+
const ph = await Ph.page.evaluate(() => ({ divs: [...document.querySelectorAll('.cz-pn-div')].filter((d) => d.getBoundingClientRect().width > 0 || getComputedStyle(d).display !== 'none').length, place: !!document.querySelector('#czViewer [data-cz-vw="place"]'), ct: !!document.querySelector('#hmChat .cz-pn-ct'), wide: document.documentElement.scrollWidth <= innerWidth + 1 }));
|
|
232
|
+
ok('N10 a phone keeps today\'s one panel: no divider, no ⧉, no page scroll sideways', ph.divs === 0 && !ph.place && !ph.ct && ph.wide, JSON.stringify(ph));
|
|
233
|
+
ok('0 no page error on a phone', Ph.errors.length === 0, Ph.errors.join(' | '));
|
|
234
|
+
await Ph.close();
|
|
235
|
+
const Dk = await open({ dark: true });
|
|
236
|
+
await Dk.page.click(`#hmList .hm-rm[data-hm-sel="${R[0]}"]`);
|
|
237
|
+
await until(() => lay(Dk.page).then((l) => (l.divs.length === 1 ? l : null)));
|
|
238
|
+
await Dk.page.click('#czViewer [data-cz-vw="place"]');
|
|
239
|
+
await until(() => Dk.page.$('.cz-pn-menu'));
|
|
240
|
+
const dk = await Dk.page.evaluate(() => ({ menu: getComputedStyle(document.querySelector('.cz-pn-menu')).backgroundColor, body: getComputedStyle(document.body).backgroundColor }));
|
|
241
|
+
ok('N10 dark: the ⧉ menu takes the dark card colour from the tokens', /rgb\((\d+), (\d+), (\d+)\)/.test(dk.menu) && dk.menu.match(/\d+/g).slice(0, 3).every((n) => +n < 90), JSON.stringify(dk));
|
|
242
|
+
await shot(Dk.page, 'n10-dark-1440');
|
|
243
|
+
ok('0 no page error in dark', Dk.errors.length === 0, Dk.errors.join(' | '));
|
|
244
|
+
await Dk.close();
|
|
245
|
+
|
|
246
|
+
/* ── Board and Intelligence: the page is the first panel (BiB1Split … BiB9DropOn, BiI1Split … BiI4Wide) ── */
|
|
247
|
+
const boardReady = () => !!window.czPanels && document.querySelectorAll('.ini2[data-key]:not(.bd-bc)').length > 2;
|
|
248
|
+
const pl = (page) => page.evaluate(() => {
|
|
249
|
+
const box = (el) => { if (!el) return null; const r = el.getBoundingClientRect(); return { l: Math.round(r.left), r: Math.round(r.right), w: Math.round(r.width), shown: r.width > 0 && getComputedStyle(el).display !== 'none' }; };
|
|
250
|
+
const P = window.czPanels.list(), pg = document.getElementById('stage');
|
|
251
|
+
return {
|
|
252
|
+
panels: P.map((p) => ({ ...p, box: box(p.id === 'page' ? pg : document.querySelector(`[data-cz-panel="${p.id}"]`)) })),
|
|
253
|
+
divs: [...document.querySelectorAll('.cz-pn-div')].map((d) => ({ ...box(d), first: d.dataset.k === '0', sprout: !!d.querySelector('.cz-dv-top') })),
|
|
254
|
+
narrow: pg.classList.contains('cz-pn-narrow'), float: !!document.querySelector('.cz-vw.cz-vw-float'),
|
|
255
|
+
active: [...document.querySelectorAll('.cz-vw.cz-pn-active')].map((v) => v.dataset.czPanel), ww: innerWidth,
|
|
256
|
+
};
|
|
257
|
+
});
|
|
258
|
+
const keys = (page) => page.evaluate(() => [...document.querySelectorAll('.ini2[data-key]:not(.bd-bc)')].map((b) => b.dataset.key));
|
|
259
|
+
const nm = (k) => `.ini2[data-key="${k}"]:not(.bd-bc)`;
|
|
260
|
+
const ctxB = await browser.newContext({ viewport: { width: 1440, height: 900 } });
|
|
261
|
+
const Bd = await open({ ctx: ctxB, at: '/premium-board.html', ready: boardReady });
|
|
262
|
+
ok('P0 the Board draws its rows and window.czPanels; the page is the one panel', !!Bd.up && (await pl(Bd.page)).panels.map((p) => p.id + ':' + p.mode).join() === 'page:split');
|
|
263
|
+
const K = await keys(Bd.page);
|
|
264
|
+
await Bd.page.click(nm(K[0]));
|
|
265
|
+
const b1 = await until(() => pl(Bd.page).then((l) => (P(l, 'v0') && P(l, 'v0').box.shown && l.divs.length === 1 ? l : null)));
|
|
266
|
+
ok('P1 a row opens a split: the page, one divider with the sprout, the Viewer; nothing floats over the page', !!b1 && !b1.float && P(b1, 'page').box.r <= b1.divs[0].l + 12 && b1.divs[0].r <= P(b1, 'v0').box.l + 12 && b1.divs[0].sprout, JSON.stringify(b1));
|
|
267
|
+
ok('P1 the Viewer opens no wider than leaves the page its view whole (fit 880 at 1440: the Viewer 506 px, under 560); the page is not narrow', !!b1 && P(b1, 'page').box.w >= 878 && Math.abs(P(b1, 'v0').box.w - 506) <= 4 && !b1.narrow, JSON.stringify(b1 && [P(b1, 'page').box, P(b1, 'v0').box]));
|
|
268
|
+
const bh = await Bd.page.evaluate(() => [...document.querySelectorAll('#czViewer .cz-vw-hd [data-cz-vw]')].map((b) => b.dataset.czVw));
|
|
269
|
+
ok('P1 ⧉ before × on the Viewer\'s header, in place of ⤢', bh.slice(-2).join() === 'place,close' && !bh.includes('wide'), JSON.stringify(bh));
|
|
270
|
+
await shot(Bd.page, 'p1-board-split-1440');
|
|
271
|
+
// the divider near the middle snaps at ½: the page goes to its narrow form; only the share is kept
|
|
272
|
+
{ const d = await divAt(Bd.page); await drag(Bd.page, d, (16 + 1424) / 2 + 8, d.y); }
|
|
273
|
+
const b2 = await until(() => pl(Bd.page).then((l) => (Math.abs(P(l, 'page').box.w - P(l, 'v0').box.w) <= 4 ? l : null)), 3000);
|
|
274
|
+
const keptB = await Bd.page.evaluate(() => { try { return JSON.parse(localStorage.getItem('cz-pn:board')); } catch { return null; } });
|
|
275
|
+
ok('P2 a drag near the middle snaps the divider at ½; the page panel is narrower than fit() and gets cz-pn-narrow', !!b2 && b2.narrow, JSON.stringify(b2 && [P(b2, 'page').box, P(b2, 'v0').box, b2.narrow]));
|
|
276
|
+
ok('P2 only the divider share is kept (cz-pn:board), not the kind\'s width', !!keptB && keptB.v === 2 && Math.abs(keptB.share - 0.5) < 0.02 && !Object.keys(await Bd.page.evaluate(() => ({ ...localStorage }))).some((k) => /^cz-vw-w:/.test(k)), JSON.stringify(keptB));
|
|
277
|
+
await shot(Bd.page, 'p2-board-half-1440');
|
|
278
|
+
// ⧉: slide over floats the Viewer over the whole page; a drag off the right edge puts it away; the Live pill brings it back
|
|
279
|
+
await Bd.page.click('#czViewer [data-cz-vw="place"]');
|
|
280
|
+
await until(() => Bd.page.$('.cz-pn-menu'));
|
|
281
|
+
const m3 = await Bd.page.evaluate(() => [...document.querySelectorAll('.cz-pn-menu button')].map((b) => b.getAttribute('aria-label') + (b.getAttribute('aria-checked') === 'true' ? '*' : '')).join('|'));
|
|
282
|
+
ok('P3 ⧉ opens Full screen, Split, Slide over; Split is checked', m3 === 'Full screen|Split*|Slide over', m3);
|
|
283
|
+
await Bd.page.click('.cz-pn-menu [data-cz-pn-place="over"]');
|
|
284
|
+
const b3 = await until(() => pl(Bd.page).then((l) => (P(l, 'v0').mode === 'over' ? l : null)), 3000);
|
|
285
|
+
ok('P3 Slide over: the Viewer floats 560 px at the right with a grab bar; the page is whole again, with no divider', !!b3 && P(b3, 'v0').box.w === 560 && P(b3, 'page').box.w > 1300 && b3.divs.length === 0 && !b3.narrow
|
|
286
|
+
&& await Bd.page.evaluate(() => !!document.querySelector('#czViewer.cz-pn-over > .cz-pn-grab')), JSON.stringify(b3));
|
|
287
|
+
await shot(Bd.page, 'p3-board-over-1440');
|
|
288
|
+
{ const g = await Bd.page.evaluate(() => { const r = document.querySelector('#czViewer > .cz-pn-grab').getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2 }; }); await drag(Bd.page, g, g.x + 200, g.y); }
|
|
289
|
+
const b3b = await until(() => pl(Bd.page).then((l) => (P(l, 'v0').mode === 'away' && !P(l, 'v0').box.shown ? l : null)), 3000);
|
|
290
|
+
ok('P3 a drag off the right edge puts it away', !!b3b, JSON.stringify(await pl(Bd.page)));
|
|
291
|
+
await Bd.page.click('#czLive');
|
|
292
|
+
const lvRow = await until(() => Bd.page.$('#czLiveList a[data-lv="pn:v0"]'), 3000);
|
|
293
|
+
ok('P3 the Live pill lists the Viewer put away', !!lvRow);
|
|
294
|
+
if (lvRow) await Bd.page.click('#czLiveList a[data-lv="pn:v0"]');
|
|
295
|
+
ok('P3 its row brings it back over', !!(await until(() => pl(Bd.page).then((l) => (P(l, 'v0').mode === 'over' && P(l, 'v0').box.shown ? l : null)), 3000)));
|
|
296
|
+
await Bd.page.evaluate(() => window.czPanels.place('v0', 'split'));
|
|
297
|
+
await until(() => pl(Bd.page).then((l) => (l.divs.length === 1 ? l : null)), 3000);
|
|
298
|
+
// ⌘/Ctrl-click: on a laptop the second item slides over; the edge marks the active one; a press in the other moves it
|
|
299
|
+
await Bd.page.click(nm(K[1]), { modifiers: ['Control'] });
|
|
300
|
+
const b4 = await until(() => pl(Bd.page).then((l) => (P(l, 'v1') && P(l, 'v1').box.shown ? l : null)), 4000);
|
|
301
|
+
ok('P4 ⌘/Ctrl-click on a row opens it beside: at 1440 it slides over, the split under it stays', !!b4 && P(b4, 'v1').mode === 'over' && P(b4, 'v0').mode === 'split' && P(b4, 'v0').box.shown, JSON.stringify(b4));
|
|
302
|
+
ok('P4 two Viewers: the one a plain click replaces has the blue edge', !!b4 && b4.active.join() === 'v1', JSON.stringify(b4 && b4.active));
|
|
303
|
+
await Bd.page.evaluate(() => window.czPanels.putAway());
|
|
304
|
+
await Bd.page.click('#czViewer .cz-vw-body', { position: { x: 30, y: 30 } }).catch(() => {});
|
|
305
|
+
await Bd.page.click(nm(K[2]));
|
|
306
|
+
const b4b = await until(() => Bd.page.evaluate(() => document.querySelector('#czViewer .cz-vw-title').textContent), 3000);
|
|
307
|
+
ok('P4 a plain click replaces the Viewer used last', !!b4b && (await Bd.page.evaluate(() => window.czViewer.current().title)) === b4b, b4b);
|
|
308
|
+
// a drop on a Viewer replaces that Viewer
|
|
309
|
+
const v0b = (await pl(Bd.page)).panels.find((p) => p.id === 'v0').box;
|
|
310
|
+
let z5 = null;
|
|
311
|
+
const t0 = await Bd.page.evaluate(() => document.querySelector('#czViewer .cz-vw-title').textContent);
|
|
312
|
+
await drag(Bd.page, nm(K[0]), v0b.l + 120, 400, { hold: async () => { z5 = await Bd.page.evaluate(() => { const z = document.querySelector('.cz-pn-drop:not([hidden])'); if (!z) return null; const r = z.getBoundingClientRect(); return { on: z.dataset.on, l: Math.round(r.left), w: Math.round(r.width) }; }); await shot(Bd.page, 'p5-board-drop-on-1440'); } });
|
|
313
|
+
ok('P5 a row dragged onto a Viewer turns that Viewer blue (the zone is its box)', !!z5 && z5.on === 'v0' && Math.abs(z5.l - v0b.l) <= 2 && Math.abs(z5.w - v0b.w) <= 2, JSON.stringify([z5, v0b]));
|
|
314
|
+
const b5 = await until(() => Bd.page.evaluate((t) => { const x = document.querySelector('#czViewer .cz-vw-title').textContent; return x !== t ? x : null; }, t0), 4000);
|
|
315
|
+
ok('P5 the drop replaces that Viewer; no new panel opens', !!b5 && (await pl(Bd.page)).panels.filter((p) => p.kind === 'viewer' && p.box.shown).length === 1, JSON.stringify([t0, b5]));
|
|
316
|
+
// to the right edge the divider closes the Viewer; to the left edge the Viewer takes the screen, and the page never closes
|
|
317
|
+
{ const d = await divAt(Bd.page); await drag(Bd.page, d, 16 + 30, d.y); }
|
|
318
|
+
const b6 = await until(() => pl(Bd.page).then((l) => (P(l, 'v0').full ? l : null)), 3000);
|
|
319
|
+
ok('P6 a drag of the divider to the left edge makes the Viewer full screen; the page is hidden, not closed', !!b6 && P(b6, 'v0').box.w > 1300 && !P(b6, 'page').box.shown && b6.panels.some((p) => p.id === 'page'), JSON.stringify(b6));
|
|
320
|
+
await Bd.page.evaluate(() => window.czPanels.place('v0', 'split'));
|
|
321
|
+
const b6b = await until(() => pl(Bd.page).then((l) => (P(l, 'page').box.shown && l.divs.length === 1 ? l : null)), 3000);
|
|
322
|
+
ok('P6 Split brings the page back first', !!b6b && P(b6b, 'page').box.l < P(b6b, 'v0').box.l, JSON.stringify(b6b));
|
|
323
|
+
{ const d = await divAt(Bd.page); await drag(Bd.page, d, 1440 - 30, d.y); }
|
|
324
|
+
const b6c = await until(() => pl(Bd.page).then((l) => (!l.panels.some((p) => p.kind === 'viewer') ? l : null)), 3000);
|
|
325
|
+
ok('P6 a drag to the right edge closes the Viewer; the page is whole', !!b6c && P(b6c, 'page').box.w > 1300 && b6c.divs.length === 0, JSON.stringify(b6c || await pl(Bd.page)));
|
|
326
|
+
ok('0 no page error on the Board', Bd.errors.length === 0, Bd.errors.join(' | '));
|
|
327
|
+
await Bd.page.close();
|
|
328
|
+
// a reload opens nothing by itself; the next Viewer opens at the kept share
|
|
329
|
+
const Bd2 = await open({ ctx: ctxB, at: '/premium-board.html', ready: boardReady });
|
|
330
|
+
await sleep(600);
|
|
331
|
+
ok('P7 after a reload no Viewer reopens by itself', (await pl(Bd2.page)).panels.length === 1);
|
|
332
|
+
await Bd2.page.click(nm(K[0]));
|
|
333
|
+
const b7 = await until(() => pl(Bd2.page).then((l) => (P(l, 'v0') && P(l, 'v0').box.shown ? l : null)), 4000);
|
|
334
|
+
ok('P7 the next Viewer opens at the kept share (½)', !!b7 && Math.abs(P(b7, 'page').box.w - P(b7, 'v0').box.w) <= 4, JSON.stringify(b7));
|
|
335
|
+
await Bd2.page.focus('.cz-pn-div'); await Bd2.page.keyboard.press('Home');
|
|
336
|
+
const b7b = await until(() => Bd2.page.evaluate(() => { try { return JSON.parse(localStorage.getItem('cz-pn:board')); } catch { return null; } }), 2000);
|
|
337
|
+
ok('P7 Home on the divider resets it to ½', !!b7b && Math.abs(b7b.share - 0.5) < 0.01, JSON.stringify(b7b));
|
|
338
|
+
await Bd2.close();
|
|
339
|
+
// 1920: the page and two Viewers side by side; a drop at the far edge opens beside
|
|
340
|
+
const Bw = await open({ w: 1920, h: 1080, at: '/premium-board.html', ready: boardReady });
|
|
341
|
+
await Bw.page.click(nm(K[0]));
|
|
342
|
+
await until(() => pl(Bw.page).then((l) => (P(l, 'v0') && P(l, 'v0').box.shown ? l : null)));
|
|
343
|
+
let z8 = null;
|
|
344
|
+
await drag(Bw.page, nm(K[1]), 1920 - 40, 500, { hold: async () => { z8 = await Bw.page.evaluate(() => { const z = document.querySelector('.cz-pn-drop:not([hidden])'); return z ? z.dataset.side : null; }); } });
|
|
345
|
+
const b8 = await until(() => pl(Bw.page).then((l) => (P(l, 'v1') && P(l, 'v1').box.shown && l.divs.length === 2 ? l : null)), 5000);
|
|
346
|
+
ok('P8 at 1920 a drop at the far edge opens beside: the page and two Viewers, two dividers, the sprout on the first only', z8 === 'right' && !!b8 && P(b8, 'page').box.r < P(b8, 'v0').box.l && P(b8, 'v0').box.r < P(b8, 'v1').box.l && b8.divs.filter((d) => d.sprout).length === 1, JSON.stringify([z8, b8 || await pl(Bw.page)]));
|
|
347
|
+
ok('P8 the edge marks the Viewer opened last', !!b8 && b8.active.join() === 'v1', JSON.stringify(b8 && b8.active));
|
|
348
|
+
await shot(Bw.page, 'p8-board-three-1920');
|
|
349
|
+
ok('0 no page error on the Board at 1920', Bw.errors.length === 0, Bw.errors.join(' | '));
|
|
350
|
+
await Bw.close();
|
|
351
|
+
// Intelligence: a goal row opens a split; ⌘-click opens beside
|
|
352
|
+
const In = await open({ at: '/premium-intelligence.html', ready: () => !!window.czPanels && document.querySelectorAll('#goalTbl .ins-row[data-goal]').length > 1 });
|
|
353
|
+
ok('P9 Intelligence draws its goal rows and window.czPanels', !!In.up);
|
|
354
|
+
const G = await In.page.evaluate(() => [...document.querySelectorAll('#goalTbl .ins-row[data-goal]')].map((r) => r.dataset.goal));
|
|
355
|
+
await In.page.click(`#goalTbl .ins-row[data-goal="${G[0]}"]`);
|
|
356
|
+
const i1 = await until(() => pl(In.page).then((l) => (P(l, 'v0') && P(l, 'v0').box.shown && l.divs.length === 1 ? l : null)), 5000);
|
|
357
|
+
ok('P9 a goal opens a split on Intelligence: the page keeps 880 px, nothing floats over it', !!i1 && !i1.float && P(i1, 'page').box.w >= 878 && !i1.narrow, JSON.stringify(i1));
|
|
358
|
+
await shot(In.page, 'p9-intel-split-1440');
|
|
359
|
+
await In.page.click(`#goalTbl .ins-row[data-goal="${G[1]}"]`, { modifiers: ['Control'] });
|
|
360
|
+
const i2 = await until(() => pl(In.page).then((l) => (P(l, 'v1') && P(l, 'v1').box.shown ? l : null)), 4000);
|
|
361
|
+
ok('P9 ⌘/Ctrl-click on a goal row opens it beside (slides over at 1440)', !!i2 && P(i2, 'v1').mode === 'over', JSON.stringify(i2));
|
|
362
|
+
ok('0 no page error on Intelligence', In.errors.length === 0, In.errors.join(' | '));
|
|
363
|
+
await In.close();
|
|
364
|
+
// a phone: the page as today
|
|
365
|
+
for (const [at, ready, row] of [['/premium-board.html', boardReady, '.ini2[data-key]:not(.bd-bc)'], ['/premium-intelligence.html', () => !!window.czPanels && document.querySelectorAll('[data-goal]').length > 1, '#goalCards .ins-card[data-goal]']]) {
|
|
366
|
+
const Q = await open({ w: 390, h: 844, at, ready });
|
|
367
|
+
await Q.page.evaluate((s) => { const b = document.querySelector(s); if (b) b.click(); }, row);
|
|
368
|
+
await until(() => Q.page.evaluate(() => !!document.querySelector('#czViewer:not([hidden])')), 5000);
|
|
369
|
+
const q = await Q.page.evaluate(() => ({ divs: [...document.querySelectorAll('.cz-pn-div')].filter((d) => getComputedStyle(d).display !== 'none').length, place: !!document.querySelector('#czViewer [data-cz-vw="place"]'), narrow: document.getElementById('stage').classList.contains('cz-pn-narrow'), full: Math.round(document.querySelector('#czViewer').getBoundingClientRect().width) === innerWidth, flex: getComputedStyle(document.body).display, side: document.documentElement.scrollWidth <= innerWidth + 1 }));
|
|
370
|
+
ok(`P10 a phone keeps ${at} as today: the Viewer covers the screen, no divider, no ⧉, no cz-pn-narrow, no sideways scroll`, q.divs === 0 && !q.place && !q.narrow && q.full && q.flex !== 'flex' && q.side, JSON.stringify(q));
|
|
371
|
+
ok('0 no page error on a phone ' + at, Q.errors.length === 0, Q.errors.join(' | '));
|
|
372
|
+
await Q.close();
|
|
373
|
+
}
|
|
374
|
+
finish();
|
|
375
|
+
})();
|
|
@@ -102,7 +102,8 @@ async function context(o = {}) {
|
|
|
102
102
|
await walk('/premium-insights.html');
|
|
103
103
|
await walk('/premium-board.html');
|
|
104
104
|
ok('T2 moving between Board, Insights and Board in the other tab never pauses the meeting', posted(A.S, '/api/notes/pause').length === 0 && await tab.evaluate(() => document.getElementById('rt').dataset.mode === 'room' && window.__stay === 1));
|
|
105
|
-
|
|
105
|
+
// batch 18 item 15 (TbT1Split): the pill is a round number with a red corner dot; the running clock is in its tooltip and the list
|
|
106
|
+
ok('T2 Board\'s Live pill shows the red corner dot, and the running clock in its tooltip', await until(() => p.evaluate(() => { const l = document.getElementById('czLive'); return !!l && !l.hidden && l.classList.contains('recp') && !!l.querySelector('.lv-rd:not(.paused)') && /^\d+$/.test(l.textContent.trim()) && /Recording \d+:\d{2}/.test(l.title); }), 15000));
|
|
106
107
|
await p.$eval('#czLive', (b) => b.click());
|
|
107
108
|
await until(() => p.$('#czLiveList [data-lv^="rec:"]'));
|
|
108
109
|
const row = await p.evaluate(() => { const a = document.querySelector('#czLiveList [data-lv^="rec:"]'); return { href: a.getAttribute('href'), btns: a.querySelectorAll('button').length }; });
|
|
@@ -52,7 +52,15 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
52
52
|
return { page, ctx, S };
|
|
53
53
|
};
|
|
54
54
|
const viaMore = async (pg, label) => { const it = (l) => `#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${l}"))`, more = async () => { await pg.click('#czViewer:not([hidden]) [data-cz-vw="more"]'); await until(() => pg.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); }, view = (v) => until(() => pg.evaluate((x) => !!document.querySelector(`#czViewer:not([hidden]) [data-hi-v="${x}"]`), v)); if ((await pg.$('#czViewer:not([hidden]) [data-hi-v="page"]')) && (await pg.$('#czViewer:not([hidden]) [data-iv-docs]')) && !['Split into a new initiative', 'Merge into', 'Program', 'Open on the Board', 'Copy', 'The record', 'Delete'].includes(label)) { await pg.click('#czViewer:not([hidden]) [data-iv-docs]'); await view('docs'); if (label === 'Documents') return; } await more(); for (let i = 0; i < 20 && !(await pg.$(it(label))) && !(await pg.$(it('Stage'))); i++) { await pg.keyboard.press('Escape'); await pg.waitForTimeout(250); await more(); } if (!(await pg.$(it(label))) && (await pg.$(it('Stage')))) { await pg.click(it('Stage')); await view('stage'); if (label === 'Stage') return; await more(); } await pg.click(it(label)); }; // batch 16 item 5c: the page's ⋯ is short; Documents opens from its fold, and the Documents view's ⋯ holds Stage, whose ⋯ holds Documents, Open the full record and Sprint
|
|
55
|
-
|
|
55
|
+
// batch 18 item 16: with quick changes on, a title press opens the row in place; the task card is under its ⋯ (Open the task card)
|
|
56
|
+
const openCard = async (pg, uid, V = '#czViewer') => {
|
|
57
|
+
if (await pg.$(`${V} [data-iv-task="${uid}"]`)) return pg.click(`${V} [data-iv-task="${uid}"]`);
|
|
58
|
+
await pg.click(`${V} [data-iv-edit="${uid}"]`);
|
|
59
|
+
await pg.click(`${V} .iv-ed[data-iv-open="${uid}"] [data-iv-more]`);
|
|
60
|
+
await pg.waitForSelector('.tkc.ivq [data-ive-card]', { timeout: 8000 });
|
|
61
|
+
return pg.click('.tkc.ivq [data-ive-card]');
|
|
62
|
+
};
|
|
63
|
+
const overview = async (page) => { await (async (g) => { const P = '#czViewer:not([hidden]) [data-hi-v="page"]', r = '#hmList [data-hm-sel^="i:"][aria-current="true"]'; for (let i = 0; i < 4 && !(await g.$(P)) && (await g.$('#czViewer:not([hidden]) [data-cz-vw="back"]')); i++) { await g.click('#czViewer [data-cz-vw="back"]'); await g.waitForTimeout(150); } if (await g.$(P)) return; if (await g.$(r)) await g.click(r); else await g.reload(); await g.waitForSelector(P + ' .iv', { timeout: 30000 }); })(page); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */ /* the page holds the Tasks (batch 11 item 20) */ return until(() => page.evaluate(() => !!document.querySelector('#czViewer [data-cz-vw="more"]') && !!document.querySelector('#czViewer :is([data-iv-task="t1"], [data-iv-edit="t1"])'))); };
|
|
56
64
|
const cur = (page) => page.evaluate(() => { const p = document.querySelector('#czViewer:not([hidden]) .obody.vw'); return { on: p ? p.dataset.vw : null, title: (document.querySelector('#czVwTitle') || {}).textContent || '', n: document.querySelectorAll('#czViewer .obody.vw').length }; });
|
|
57
65
|
const paneTxt = (page, id) => page.evaluate((k) => { const p = document.querySelector(`#czViewer .obody.vw[data-vw="${CSS.escape(k)}"]`); return p ? p.textContent.replace(/\s+/g, ' ') : ''; }, id);
|
|
58
66
|
const INI = 'item:ini:self-serve-v2';
|
|
@@ -79,7 +87,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
79
87
|
await page.click(`#czViewer .obody.vw[data-vw="${TK}"] [data-tkc="ini"]`);
|
|
80
88
|
s = await cur(page);
|
|
81
89
|
ok('R9 the initiative link brings the record back, not a second one', await until(async () => (await cur(page)).on === INI) && (await cur(page)).n === 1, JSON.stringify(s));
|
|
82
|
-
ok('R9 the task press in the Overview opens the same task view', await overview(page) && await page
|
|
90
|
+
ok('R9 the task press in the Overview opens the same task view', await overview(page) && await openCard(page, 't1').then(() => until(async () => (await cur(page)).on === TK && /Oct 20 → 27/.test(await paneTxt(page, TK)))), JSON.stringify(await cur(page)));
|
|
83
91
|
ok('R9 the old dialog never opens', await page.evaluate(() => { const d = document.querySelector('#dlg'); return !d || !d.classList.contains('on'); }));
|
|
84
92
|
ok('R9 no page error', S.errors.length === 0, S.errors.join(' | '));
|
|
85
93
|
await ctx.close();
|
|
@@ -181,6 +181,9 @@ const TICKETS = {
|
|
|
181
181
|
{
|
|
182
182
|
const I = await open();
|
|
183
183
|
// batch 11 item 20: the page's Tasks draw the stage's Jira tickets; a ticket press opens its ticket in the Viewer (the old All tasks panel is gone)
|
|
184
|
+
// batch 18 item 16: a ticket row's title opens the row in place; its Open the ticket sits there, after the dates
|
|
185
|
+
await I.page.waitForSelector('#czViewer [data-iv-ticket="PMOS-142"], #czViewer [data-iv-edit="PMOS-142"]');
|
|
186
|
+
if (!(await I.page.$('#czViewer [data-iv-ticket="PMOS-142"]'))) await I.page.click('#czViewer [data-iv-edit="PMOS-142"]');
|
|
184
187
|
await I.page.click('#czViewer [data-iv-ticket="PMOS-142"]');
|
|
185
188
|
ok('I2 a Jira ticket in the page\'s Tasks opens its ticket in the Viewer', !!(await until(async () => /^jira:PMOS-142$/.test(String(await curId(I.page))))), JSON.stringify(await curId(I.page)));
|
|
186
189
|
await I.page.goto(BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1');
|