create-pmos 0.396.0 → 0.398.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/scripts/nine-stages.js +49 -20
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +103 -74
- package/workspace/briefing-premium-board-test.js +316 -154
- package/workspace/briefing-premium-calendar-2-test.js +135 -195
- package/workspace/briefing-premium-calendar-3-test.js +143 -413
- package/workspace/briefing-premium-calendar-test.js +86 -185
- package/workspace/briefing-premium-doc-edit-test.js +95 -83
- package/workspace/briefing-premium-initiative-test.js +166 -294
- package/workspace/briefing-premium-insights-test.js +351 -214
- package/workspace/briefing-premium-metrics-test.js +53 -118
- package/workspace/briefing-premium-products-test.js +40 -27
- package/workspace/briefing-premium-sources-test.js +91 -52
- package/workspace/briefing-premium-test.js +150 -633
- package/workspace/briefing-premium-work-test.js +88 -269
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/board-premium-facts.js +2 -1
- package/workspace/fixtures/board-premium-jira.js +28 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/initiative-premium-facts.js +2 -1
- package/workspace/fixtures/initiatives-api/list.json +30 -42
- package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
- package/workspace/fixtures/initiatives-api/sheet.json +10 -14
- package/workspace/fixtures/insights-premium-facts.js +11 -2
- package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +47 -0
- package/workspace/guide/index.md +2 -0
- package/workspace/guide/lifecycle.md +51 -0
- package/workspace/home-shot.js +38 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-premium.js +160 -3
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/engine/boards.js +15 -14
- package/workspace/lib/engine/nine-stages.js +49 -20
- package/workspace/lib/engine/signals/detectors.js +13 -11
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +126 -1
- package/workspace/lib/insights-records.js +101 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-board-premium.js +3 -2
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-initiatives.js +1 -1
- package/workspace/lib/routes-insights-premium.js +19 -3
- package/workspace/lib/routes-insights-records.js +129 -0
- package/workspace/lib/routes-notes.js +1 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/transcript-steps.js +123 -0
- package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
- package/workspace/lib/viewer-meeting.js +205 -0
- package/workspace/lib/viewer-report.js +89 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-agreed-viewer-shots.js +76 -0
- package/workspace/premium-board-actions-test.js +85 -73
- package/workspace/premium-briefing-depth-test.js +66 -53
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +35 -36
- package/workspace/premium-chat-context-test.js +22 -19
- package/workspace/premium-chat-goal-view-test.js +28 -26
- package/workspace/premium-chat-notes-test.js +29 -33
- package/workspace/premium-chat-report-tab-test.js +35 -25
- package/workspace/premium-chat-term-test.js +16 -14
- package/workspace/premium-chat-viewer-test.js +60 -53
- package/workspace/premium-core-doc-issue-test.js +50 -41
- package/workspace/premium-html-viewer-test.js +17 -18
- package/workspace/premium-phone-card-test.js +8 -2
- package/workspace/premium-phone-room-test.js +42 -31
- package/workspace/premium-report-read-test.js +115 -197
- package/workspace/premium-viewer-download-test.js +19 -22
- package/workspace/premium-viewer-flicker-test.js +11 -16
- package/workspace/premium-viewer-share-test.js +6 -9
- package/workspace/premium-viewer-test.js +41 -60
- package/workspace/premium-vw-backlog-test.js +53 -31
- package/workspace/premium-vw-cal-test.js +82 -123
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +12 -11
- package/workspace/premium-vw-item-test.js +50 -48
- package/workspace/premium-vw-jira-test.js +55 -26
- package/workspace/premium-vw-meet-test.js +118 -187
- package/workspace/premium-vw-notes-test.js +85 -107
- package/workspace/premium-vw-rec-test.js +72 -193
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +63 -51
- package/workspace/public/pm/bd-acts.js +305 -0
- package/workspace/public/pm/bd-span.js +224 -0
- package/workspace/public/pm/bd-stages.js +47 -0
- package/workspace/public/pm/c3-doc-sheet.js +1 -1
- package/workspace/public/pm/c3-md.js +3 -395
- package/workspace/public/pm/c3-phone-detail.js +1 -1
- package/workspace/public/pm/c3-phone-model.js +3 -68
- package/workspace/public/pm/chat-term.js +3 -3
- package/workspace/public/pm/cozy-board.css +640 -0
- package/workspace/public/pm/cozy-home.css +580 -0
- package/workspace/public/pm/cozy-home.js +172 -0
- package/workspace/public/pm/cozy-initiative.css +138 -0
- package/workspace/public/pm/cozy-insights.css +421 -0
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +65 -0
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-viewer.css +143 -0
- package/workspace/public/pm/cozy-viewer.js +144 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +254 -0
- package/workspace/public/pm/home-adddoc.js +48 -0
- package/workspace/public/pm/home-app.js +905 -0
- package/workspace/public/pm/home-around.js +515 -0
- package/workspace/public/pm/home-chat.js +459 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-more.js +249 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-work.js +519 -0
- package/workspace/public/pm/lifecycle-lens-model.js +45 -27
- package/workspace/public/pm/lifecycle-lens.js +22 -11
- package/workspace/public/pm/phone-moment.js +69 -0
- package/workspace/public/pm/pm-work-view.js +1 -1
- package/workspace/public/pm/premium-attach.js +4 -0
- package/workspace/public/pm/premium-board.js +544 -253
- package/workspace/public/pm/premium-brief.js +1 -1
- package/workspace/public/pm/premium-chart-tab.js +110 -62
- package/workspace/public/pm/premium-chat.js +17 -10
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +25 -21
- package/workspace/public/pm/premium-initiative-head.js +138 -0
- package/workspace/public/pm/premium-initiative.js +28 -4
- package/workspace/public/pm/premium-insights.js +950 -440
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-notes.js +1 -1
- package/workspace/public/pm/premium-report-frame.css +20 -0
- package/workspace/public/pm/premium-report-read.js +509 -480
- package/workspace/public/pm/premium-report-tab.js +87 -63
- package/workspace/public/pm/premium-shell.js +107 -124
- package/workspace/public/pm/premium-viewer.js +27 -1
- package/workspace/public/pm/premium-vw-cal.js +187 -48
- package/workspace/public/pm/premium-vw-doc.css +6 -0
- package/workspace/public/pm/premium-vw-doc.js +40 -2
- package/workspace/public/pm/premium-vw-file.js +2 -2
- package/workspace/public/pm/premium-vw-jira-model.js +22 -5
- package/workspace/public/pm/premium-vw-jira.css +11 -0
- package/workspace/public/pm/premium-vw-jira.js +11 -4
- package/workspace/public/pm/premium-vw-meet.js +6 -83
- package/workspace/public/pm/premium-vw-mtg.js +731 -0
- package/workspace/public/pm/premium-vw-notes.js +56 -69
- package/workspace/public/pm/premium-vw-open.js +35 -0
- package/workspace/public/pm/premium-vw-page.js +16 -0
- package/workspace/public/pm/premium-vw-rec.js +11 -215
- package/workspace/public/pm/premium-vw-slides.css +5 -0
- package/workspace/public/pm/premium-vw-slides.js +44 -8
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +57 -64
- package/workspace/public/premium-chat.html +7 -33
- package/workspace/public/premium-initiative.html +8 -41
- package/workspace/public/premium-insights.html +63 -62
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium-work.html +6 -72
- package/workspace/public/premium.html +21 -66
- package/workspace/public/vendor/nunito-var.woff2 +0 -0
- package/workspace/server.js +25 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/premium-agreed-viewer.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/third-party/README.md +1 -0
- package/workspace/public/pm/premium-work.js +0 -719
- package/workspace/public/pm/premium.js +0 -1133
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
/* briefing-premium-metrics-test.js — the Metrics card of the premium Board (initiative briefing-premium-metrics; planning/prd/briefing-premium-metrics-prd.md M1 to M10).
|
|
4
4
|
* Serves the real page from the real server. The Board's answer and the card's answer are served from fixtures (the card's model is built by
|
|
5
5
|
* lib/board-metrics-premium.js from made-up runs, commits and initiatives); the last blocks ask the real route and compare the card with the mockup.
|
|
6
|
-
* C1 place
|
|
6
|
+
* C1 place · C2 tiles · C4 definition and values by week · C5 pending and failure · C6 floors · C7 the real route · C9 targets on the Board · C10 the Insights twin
|
|
7
|
+
* Re-pointed for the Agreed Board (premium-agreed-design): the Agreed design has no Metrics frame, so the Board keeps the card's function as a plain
|
|
8
|
+
* panel (pm/bd-acts.js), tagged "Waiting for design", opened from the quiet Metrics link under the stage track. The charts, the week reader (C3), the
|
|
9
|
+
* dialog with its agent (C4) and the card's geometry (C8) were parts of the retired card: the definition and the values by week stay, in a fold;
|
|
10
|
+
* charts, targets and longer ranges live on Insights (Delivery trends), which C10 checks. */
|
|
7
11
|
const fs = require('fs');
|
|
8
12
|
const path = require('path');
|
|
9
13
|
const { spawn } = require('child_process');
|
|
10
14
|
const { findBrowser } = require('./lib/find-browser');
|
|
11
|
-
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
12
|
-
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
13
15
|
const T = require('./test-run').configure({ name: 'briefing-premium-metrics' });
|
|
14
16
|
const BP = require('./lib/board-premium.js');
|
|
15
17
|
const MP = require('./lib/board-metrics-premium.js');
|
|
@@ -31,7 +33,6 @@ const finish = async (code) => {
|
|
|
31
33
|
};
|
|
32
34
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
33
35
|
|
|
34
|
-
const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html');
|
|
35
36
|
const NOW = Date.now(), W = MP.weeksTo(NOW);
|
|
36
37
|
const runsIn = (wk, count, corr) => Array.from({ length: count }, (_, k) => ({ created_at: new Date(W[wk].from + (k + 1) * 60000).toISOString(), human_corrections: k < corr ? 1 : 0 }));
|
|
37
38
|
const I = (id, o) => Object.assign({ id, accepted: false, stopped: false, steps: [], last_activity: new Date(NOW - 3 * 86400000).toISOString() }, o);
|
|
@@ -47,179 +48,113 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
|
|
|
47
48
|
await T.waitForServer(BASE);
|
|
48
49
|
browser = await chromium.launch({ executablePath: exe });
|
|
49
50
|
|
|
50
|
-
const open = async ({ w = 1280, h = 900, theme = 'light', answers = null } = {}) => {
|
|
51
|
+
const open = async ({ w = 1280, h = 900, theme = 'light', answers = null, url = '/premium-board.html' } = {}) => {
|
|
51
52
|
const ctx = await browser.newContext({ viewport: { width: w, height: h } });
|
|
52
|
-
await ctx.addInitScript(() => { try { localStorage.setItem('pmos.premium.openAs', 'popup'); } catch { /* none */ } });
|
|
53
53
|
const page = await ctx.newPage();
|
|
54
|
-
const errors = []
|
|
54
|
+
const errors = []; let calls = 0;
|
|
55
55
|
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
56
56
|
await page.route('**/api/board-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.facts()), as_of: Date.now() }) }));
|
|
57
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: '{"ok":false}' }));
|
|
57
58
|
await page.route('**/api/board-metrics-premium*', (r) => { calls++; const a = answers ? answers(calls) : ready(metrics()); return r.fulfill({ status: a.status, contentType: 'application/json', body: JSON.stringify(a.body) }); });
|
|
58
|
-
await page.
|
|
59
|
-
await page.route('**/api/briefing-premium/**', (r) => { const rq = r.request(); if (rq.method() === 'GET') return r.fulfill({ contentType: 'application/json', body: JSON.stringify(thread) }); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); return r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
60
|
-
await page.goto(BASE + '/premium-board.html?theme=' + theme);
|
|
59
|
+
await page.goto(BASE + url + (url.includes('?') ? '&' : '?') + 'theme=' + theme);
|
|
61
60
|
await until(() => page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 20000);
|
|
62
|
-
|
|
61
|
+
if (await page.isVisible('#moreBtn')) { await page.click('#moreBtn'); await page.click('#bdMetrics'); } else await page.click('#ibBody [data-open="metrics"]'); // re-pointed: Metrics is in the ⋯ menu (desktop) or the phone's plain row
|
|
62
|
+
return { ctx, page, errors, calls: () => calls };
|
|
63
63
|
};
|
|
64
|
+
const tilesOf = (pg) => pg.evaluate(() => [...document.querySelectorAll('#peek .bd-met')].map((t) => ({ k: t.dataset.met, s: [...t.querySelector('summary').children].map((c) => c.textContent), look: t.classList.contains('look') })));
|
|
64
65
|
|
|
65
66
|
/* C1 */
|
|
66
67
|
const A = await open(), p = A.page;
|
|
67
|
-
const shown = await until(() =>
|
|
68
|
-
ok('C1
|
|
68
|
+
const shown = await until(async () => { const t = await tilesOf(p); return t.length === 4 ? t : null; });
|
|
69
|
+
ok('C1 the Metrics link under the track opens the board\'s four measures in the side panel', !!shown);
|
|
69
70
|
if (!shown) return finish(1);
|
|
70
|
-
const place = await p.evaluate(() => ({
|
|
71
|
-
ok('C1
|
|
71
|
+
const place = await p.evaluate(() => ({ t: document.querySelector('#pkTitle').textContent, tag: (document.querySelector('#peek .bd-wtag') || {}).textContent, cap: document.querySelector('#metW .bd-amut').textContent, ins: (document.querySelector('#metW a[href^="/premium-insights.html"]') || {}).textContent, dlg: !!document.querySelector('#dlg.on') }));
|
|
72
|
+
ok('C1 it is a plain panel tagged "Waiting for design", says which repository it counts and links to Insights; no old dialog', place.t === 'Metrics' && place.tag === 'Waiting for design' && /^counted from idpf/.test(place.cap) && /Targets and longer ranges are on Insights/.test(place.ins || '') && !place.dlg, JSON.stringify(place));
|
|
72
73
|
|
|
73
74
|
/* C2 */
|
|
74
|
-
const
|
|
75
|
-
ok('C2 the first tile is the latest week with its run count, and how it changed',
|
|
76
|
-
ok('C2 merges, blocked and idle are counted; blocked and idle
|
|
77
|
-
|
|
78
|
-
ok('C2 only Week is available; Day and Month are disabled', per === 'Day:false:true|Week:true:|Month:false:true', per);
|
|
79
|
-
ok('C2 Day and Month hold no count, so only Week shows, as one quiet chip (premium-calmer-first-screen)', await p.evaluate(() => [...document.querySelectorAll('#perTabs button')].filter((b) => getComputedStyle(b).display !== 'none').map((b) => b.textContent).join() === 'Week'));
|
|
80
|
-
ok('C2 no target, on-target chip, dashed line or demo label is drawn; the lead line says no measure has a target', await p.evaluate(() => !document.querySelector('#cMet .mchip.ok, #cMet .tg, #cMet .tgl') && !/on target|demo|dashed/i.test(document.querySelector('#metBody').textContent) && /No measure here has a target/.test(document.querySelector('#metHint').textContent)));
|
|
81
|
-
const look = await p.evaluate(() => ({ chips: [...document.querySelectorAll('#metBody .mt1')].map((t) => (t.querySelector('.mchip') || {}).textContent || ''), off: [...document.querySelectorAll('#metBody .mt1')].map((t) => t.classList.contains('off')), lead: (document.querySelector('#metHint .mflag') || {}).textContent || '', ins: (document.querySelector('#metHint a#metIns') || {}).getAttribute ? document.querySelector('#metHint a#metIns').getAttribute('href') : '' }));
|
|
82
|
-
ok('C2 the tiles that need a look carry the chip and the orange outline; the lead line counts them and links to Insights', JSON.stringify(look.off) === JSON.stringify(tiles.map((t) => /\b(warn|bad)\b/.test(t.cls))) && look.chips.every((c, i) => (c === 'Needs a look') === look.off[i]) && look.lead === look.off.filter(Boolean).length + ' of 4 need a look.' && /^\/premium-insights\.html\?ws=/.test(look.ins), JSON.stringify(look));
|
|
75
|
+
const t0 = shown;
|
|
76
|
+
ok('C2 the first tile is the latest week with its run count, and how it changed', t0[0].k === 'corrections' && t0[0].s[0] === 'Corrections per 100 runs' && t0[0].s[1] === '10.0' && /^week to .+, 10 runs$/.test(t0[0].s[2]) && t0[0].s[3] === 'Down 15.0 vs last week', JSON.stringify(t0[0]));
|
|
77
|
+
ok('C2 merges, blocked and idle are counted; blocked and idle say plainly that their history starts today', t0[1].s[1] === '3' && t0[2].s[1] === '1' && t0[2].s[2] === 'of 3 open · history starts today' && t0[3].s[1] === '1' && t0[3].s[2] === 'of 3 open · history starts today', JSON.stringify(t0));
|
|
78
|
+
ok('C2 no target and no on-target chip is drawn when none is set; a measure that needs a look says so', !t0.some((x) => x.s.some((y) => /target/i.test(y))) && t0.filter((x) => x.look).every((x) => x.s.includes('Needs a look')), JSON.stringify(t0));
|
|
83
79
|
{
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
ok('C2 a source that cannot be read says Not read and why, with no number and no chart', t.length === 4 && t.every((x) => x.startsWith('Not read/')) && /agent-runs\.jsonl could not be read in idpf/.test(t[0]) && !(await R.page.evaluate(() => document.querySelector('#metBody svg'))), JSON.stringify(t));
|
|
80
|
+
const R = await open({ answers: () => ready(metrics({ runs: null, commits: null, inits: null })) });
|
|
81
|
+
const t = await until(async () => { const a = await tilesOf(R.page); return a.length === 4 ? a : null; }) || [];
|
|
82
|
+
ok('C2 a source that cannot be read says Not read and why, with no number', t.length === 4 && t.every((x) => x.s[1] === 'Not read') && /agent-runs\.jsonl could not be read in idpf/.test(t[0].s[2]), JSON.stringify(t));
|
|
88
83
|
await R.ctx.close();
|
|
89
84
|
}
|
|
90
85
|
|
|
91
|
-
/*
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
ok('
|
|
96
|
-
const mid = await at(0.841);
|
|
97
|
-
ok('C3 moving over a counted week reads its value and run count', /^\d+\.\d$/.test(mid.v) && / · 12 runs$/.test(mid.c), JSON.stringify(mid));
|
|
98
|
-
await p.mouse.move(5, 5); await sleep(200);
|
|
99
|
-
const back = await p.evaluate(() => ({ v: document.querySelector('#metBody .mch .mval').textContent, hv: document.querySelector('#metBody .mch').classList.contains('hv') }));
|
|
100
|
-
ok('C3 leaving the chart returns to the latest week', back.v === '10.0' && !back.hv, JSON.stringify(back));
|
|
101
|
-
await p.locator('#metBody .mch').first().focus(); await p.keyboard.press('ArrowLeft'); await sleep(100);
|
|
102
|
-
ok('C3 the arrow keys read the week before', await p.evaluate(() => document.querySelector('#metBody .mch .mval').textContent === '25.0' || /^\d+\.\d$/.test(document.querySelector('#metBody .mch .mval').textContent)));
|
|
103
|
-
await p.locator('#metBody .mch').first().blur();
|
|
104
|
-
|
|
105
|
-
/* C4 */
|
|
106
|
-
await p.locator('#metBody .mt1').first().click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
|
|
107
|
-
const dlg = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, sub: document.querySelector('#dSub').textContent, grid: [...document.querySelectorAll('#oMain .kv2 span')].map((s) => s.textContent).join('|'), vals: document.querySelectorAll('#oMain .vtb div').length, def: document.querySelector('#oMain .lede').textContent, ask: document.querySelector('#askF').hidden }));
|
|
108
|
-
ok('C4 a tile opens its definition, its values by week and the repository it counted, with the read-only agent beside it', dlg.title === 'Corrections per 100 runs' && dlg.sub === 'idpf' && /Now\|10\.0/.test(dlg.grid) && /Better when\|Lower/.test(dlg.grid) && /Source\|idpf/.test(dlg.grid) && dlg.vals === 8 && /per 100 agent runs/.test(dlg.def) && dlg.ask === false, JSON.stringify(dlg));
|
|
109
|
-
ok('C4 the dialog holds no press that records anything', await p.evaluate(() => !document.querySelector('#oMain button, #oMain .dmcta')));
|
|
110
|
-
A.setThread({ ok: true, working: false, turns: [] }); await p.fill('#askIn', 'Why did it fall?'); const n0 = A.posts.length; await p.press('#askIn', 'Enter');
|
|
111
|
-
ok('C4 a question posts the metric\'s key and the text', await until(() => A.posts.length > n0 && A.posts[A.posts.length - 1].path === '/api/briefing-premium/ask' && A.posts[A.posts.length - 1].body.key === 'board:metric-corrections' && A.posts[A.posts.length - 1].body.text === 'Why did it fall?'), JSON.stringify(A.posts.slice(-1)));
|
|
112
|
-
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
113
|
-
await p.locator('#metBody .mt1').nth(2).click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(400);
|
|
114
|
-
ok('C4 Blocked opens its definition, and the weeks before its history started read Not kept yet', await p.evaluate(() => { const v = [...document.querySelectorAll('#oMain .vtb div b')].map((b) => b.textContent); return document.querySelector('#dTitle').textContent === 'Blocked' && /blocked step/.test(document.querySelector('#oMain .lede').textContent) && v.length === 8 && v.slice(0, 7).every((x) => x === 'Not kept yet') && v[7] === '1'; }));
|
|
115
|
-
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
116
|
-
await p.$eval('#perTabs [data-per="day"]', (b) => b.click()); ok('C4 a disabled period says why and changes nothing', await until(() => p.evaluate(() => /by week only/.test(document.querySelector('#toast').textContent))) && await p.evaluate(() => document.querySelector('#perTabs [data-per="week"]').getAttribute('aria-pressed') === 'true'));
|
|
86
|
+
/* C4 the definition and the values by week */
|
|
87
|
+
await p.click('#peek .bd-met[data-met="corrections"] summary');
|
|
88
|
+
const d = await p.evaluate(() => { const t = document.querySelector('#peek .bd-met[data-met="corrections"]'); return { open: t.open, def: t.querySelector(':scope > .bd-amut').textContent, wk: t.querySelectorAll('.bd-kv b').length, vals: [...t.querySelectorAll('.bd-kv b')].map((b) => b.textContent) }; });
|
|
89
|
+
ok('C4 a measure opens its definition and its values by week; a week with too few runs is not kept', d.open && /per 100 agent runs/.test(d.def) && d.wk === 8 && d.vals[7] === '10' && d.vals[0] === 'Not kept yet', JSON.stringify(d));
|
|
90
|
+
ok('C4 the panel holds no press that records anything', await p.evaluate(() => !document.querySelector('#peek form, #peek [data-act]')));
|
|
117
91
|
ok('0 no page error', A.errors.length === 0, A.errors.join(' | '));
|
|
118
92
|
await A.ctx.close();
|
|
119
93
|
|
|
120
94
|
/* C5 */
|
|
121
95
|
{
|
|
122
96
|
const R = await open({ answers: (c) => (c < 2 ? ready(metrics({ inits: null, initsPending: true })) : ready(metrics())) });
|
|
123
|
-
const idle =
|
|
124
|
-
ok('C5 while the workflow is derived Blocked
|
|
97
|
+
const idle = async () => { const t = await tilesOf(R.page); return t[2] ? t[2].s[1] : ''; };
|
|
98
|
+
ok('C5 while the workflow is derived Blocked says Reading, and the panel asks again until it is filled', await until(async () => /^Reading/.test(await idle())) && await until(async () => (await idle()) === '1', 9000) && R.calls() >= 2, String(R.calls()));
|
|
125
99
|
await R.ctx.close();
|
|
126
100
|
const F2 = await open({ answers: () => ({ status: 500, body: { ok: false, state: 'error', error: 'the repository could not be read' } }) });
|
|
127
|
-
ok('C5 a failed read says why and draws no tile', await until(() => F2.page.evaluate(() =>
|
|
101
|
+
ok('C5 a failed read says why and draws no tile', await until(() => F2.page.evaluate(() => /The reason: the repository could not be read/.test((document.querySelector('#metW') || {}).textContent || '') && !document.querySelector('#peek .bd-met'))));
|
|
128
102
|
await F2.ctx.close();
|
|
129
103
|
}
|
|
130
104
|
|
|
131
105
|
/* C6 */
|
|
132
106
|
for (const theme of ['light', 'dark']) {
|
|
133
107
|
const R = await open({ w: 390, h: 844, theme }), q = R.page;
|
|
134
|
-
await until(() =>
|
|
135
|
-
const m = await q.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#
|
|
136
|
-
ok(`C6 at 390 px (${theme}) the
|
|
108
|
+
await until(async () => (await tilesOf(q)).length === 4);
|
|
109
|
+
const m = await q.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#peek .bd-met summary')].filter((b) => b.getBoundingClientRect().height < 44).length }));
|
|
110
|
+
ok(`C6 at 390 px (${theme}) the panel does not scroll sideways and every measure is 44 px or more`, !m.over && m.small === 0, JSON.stringify(m));
|
|
111
|
+
ok(`C6 no page error at 390 px (${theme})`, R.errors.length === 0, R.errors.join(' | '));
|
|
137
112
|
await R.ctx.close();
|
|
138
113
|
}
|
|
139
114
|
|
|
140
115
|
/* C7 the real route */
|
|
141
116
|
{
|
|
142
117
|
const home = await fetch(BASE + '/api/board-metrics-premium').then((r) => r.json());
|
|
143
|
-
ok('C7 the real route gives the home workspace
|
|
118
|
+
ok('C7 the real route gives the home workspace its measures', home.ok === true && home.state === 'ready', JSON.stringify(home).slice(0, 300));
|
|
144
119
|
const post = await fetch(BASE + '/api/board-metrics-premium', { method: 'POST', headers: await T.pressHeaders(BASE), body: '{}' }).then((r) => r.status);
|
|
145
120
|
ok('C7 the route is read-only', post === 405, String(post));
|
|
146
121
|
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), pg = await ctx.newPage(), errs = [];
|
|
147
122
|
pg.on('pageerror', (e) => errs.push(String(e)));
|
|
148
123
|
await pg.goto(BASE + '/premium-board.html');
|
|
149
|
-
await until(() => pg.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 40000); await sleep(
|
|
150
|
-
|
|
124
|
+
await until(() => pg.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 40000); await sleep(800);
|
|
125
|
+
await pg.click('#moreBtn'); await pg.click('#bdMetrics');
|
|
126
|
+
ok('C7 the real PMOS board opens its Metrics panel with four measures and no script error', await until(() => pg.evaluate(() => document.querySelectorAll('#peek .bd-met').length === 4), 30000) && errs.length === 0, errs.join(' | '));
|
|
151
127
|
await ctx.close();
|
|
152
128
|
}
|
|
153
129
|
|
|
154
|
-
/* C9 a target set on Insights
|
|
130
|
+
/* C9 a target set on Insights shows on the Board */
|
|
155
131
|
{
|
|
156
132
|
const R = await open({ answers: () => ready(metrics({ targets: { corrections: { target: 12 }, merges: { target: 5 } } })) }), q = R.page;
|
|
157
|
-
await until(() => q
|
|
158
|
-
|
|
159
|
-
ok('C9 a measure
|
|
160
|
-
ok('C9 a measure
|
|
161
|
-
ok('C9 a measure with no target draws no dashed line, and the lead line says the line is the target set on Insights', !t[2].tg && !t[3].tg && await q.evaluate(() => /The dashed line is the target set on Insights/.test(document.querySelector('#metHint').textContent)), JSON.stringify(t.slice(2)));
|
|
162
|
-
await q.locator('#metBody .mt1').first().click(); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(300);
|
|
163
|
-
ok('C9 the dialog names the target and the gap', await q.evaluate(() => { const g = [...document.querySelectorAll('#oMain .kv2 span')].map((s) => s.textContent).join('|'); return /Target\|12\.0/.test(g) && /Gap\|On target/.test(g); }));
|
|
133
|
+
const t = await until(async () => { const a = await tilesOf(q); return a.length === 4 ? a : null; }) || [];
|
|
134
|
+
ok('C9 a measure on target says On target with its target', t[0] && t[0].s.includes('On target · target 12.0') && !t[0].look, JSON.stringify(t[0]));
|
|
135
|
+
ok('C9 a measure off target says its gap and is outlined', t[1] && t[1].s.includes('2 short · target 5') && t[1].look, JSON.stringify(t[1]));
|
|
136
|
+
ok('C9 a measure with no target shows none', t[2] && !t[2].s.some((y) => /target/.test(y)) && !t[3].s.some((y) => /target/.test(y)), JSON.stringify(t.slice(2)));
|
|
164
137
|
ok('C9 no page error', R.errors.length === 0, R.errors.join(' | '));
|
|
165
138
|
await R.ctx.close();
|
|
166
139
|
}
|
|
167
140
|
|
|
168
|
-
/* C10 the Insights page shows the same measures, and a target saved there is sent for the Board */
|
|
141
|
+
/* C10 the Insights page shows the same measures (Delivery trends), and a target saved there is sent for the Board */
|
|
169
142
|
{
|
|
170
143
|
const IP = require('./lib/insights-premium.js'), IF = require('./fixtures/insights-premium-facts.js');
|
|
171
|
-
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), q = await ctx.newPage(), errs = [], saves = []
|
|
172
|
-
let tg = {};
|
|
144
|
+
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), q = await ctx.newPage(), errs = [], saves = [];
|
|
173
145
|
q.on('pageerror', (e) => errs.push(String((e && e.message) || e)));
|
|
174
146
|
await q.route('**/api/insights-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: IP.build(IF.facts()), as_of: 1 }) }));
|
|
175
|
-
await q.route('**/api/board-metrics-premium*', (r) =>
|
|
176
|
-
await q.route('**/api/board-metric-targets/save', (r) => {
|
|
147
|
+
await q.route('**/api/board-metrics-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(ready(metrics()).body) }));
|
|
148
|
+
await q.route('**/api/board-metric-targets/save', (r) => { saves.push(JSON.parse(r.request().postData() || '{}')); return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, targets: {} }) }); });
|
|
177
149
|
await q.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: '{"ok":true,"turns":[],"working":false}' }));
|
|
178
150
|
await q.goto(BASE + '/premium-insights.html');
|
|
179
|
-
const
|
|
180
|
-
ok('C10 Insights
|
|
181
|
-
|
|
182
|
-
await q.
|
|
183
|
-
ok('C10 a
|
|
184
|
-
await q.locator('#bmBody .mt1').nth(1).click(); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(300);
|
|
185
|
-
ok('C10 the measure popup reads its numbers first and says when the trunk was fetched', await q.evaluate(() => { const say = document.querySelector('#dBody .stream').textContent, g = [...document.querySelectorAll('#oMain .kv2 span')].map((x) => x.textContent).join('|'); return /Merged a week is 3, to the trunk, week to \d+ \w+\. Up 1 vs last week\. origin\/main was last fetched 14 Oct \d\d:00\./.test(say) && /No target is set/.test(say) && /Trunk read\|origin\/main, fetched 14 Oct \d\d:00/.test(g); }));
|
|
186
|
-
await q.fill('#bmT', '5'); await q.click('#bmGo');
|
|
187
|
-
ok('C10 Save target sends the measure and the number for this board', await until(() => saves.length === 1) && saves[0].ws === 'w1' && saves[0].key === 'merges' && saves[0].target === '5', JSON.stringify(saves));
|
|
188
|
-
ok('C10 the card redraws with the target: its gap chip, dashed line and outline', await until(() => q.evaluate(() => { const t = document.querySelectorAll('#bmBody .mt1')[1]; return t && (t.querySelector('.mchip') || {}).textContent === '2 short' && !!t.querySelector('svg .tg') && t.classList.contains('off'); })));
|
|
151
|
+
const v = await until(async () => { const x = await q.evaluate(() => Object.fromEntries([...document.querySelectorAll('#bmBody [data-tile]')].map((e) => [e.dataset.tile, e.querySelector('.v').textContent]))); return x.corrections && x.corrections !== 'Reading' ? x : null; }, 20000);
|
|
152
|
+
ok('C10 Insights\' Delivery trends show the Board\'s measures with the same values', !!v && v.corrections === '10.0' && v.merges === '3' && v.idle === '1', JSON.stringify(v));
|
|
153
|
+
await q.click('#bmBody [data-tile="merges"]'); await until(() => q.evaluate(() => !!document.querySelector('#czViewer [data-tgf]')));
|
|
154
|
+
await q.fill('#czViewer [data-tgf] [name="tg"]', '5'); await q.click('#czViewer [data-tgf] button[type="submit"]');
|
|
155
|
+
ok('C10 a target saved on Insights goes to the Board\'s target route, for this board', await until(() => saves.length === 1) && saves[0].key === 'merges' && saves[0].target === 5, JSON.stringify(saves));
|
|
189
156
|
ok('C10 no page error', errs.length === 0, errs.join(' | '));
|
|
190
157
|
await ctx.close();
|
|
191
158
|
}
|
|
192
|
-
|
|
193
|
-
/* C8 fidelity against the mockup */
|
|
194
|
-
if (!fs.existsSync(MOCKUP)) ok('C8 the mockup is in the repository', false, MOCKUP);
|
|
195
|
-
else {
|
|
196
|
-
const SEL = [['card', '#cMet'], ['heading', '#hMet'], ['hint', '#cMet .mhint'], ['note', '#cMet .note'], ['t1', '#cMet .mt1:nth-child(1)'], ['t1val', '#cMet .mt1:nth-child(1) .mval'], ['t1cap', '#cMet .mt1:nth-child(1) .mwk'], ['t1chg', '#cMet .mt1:nth-child(1) .mchg'], ['t1svg', '#cMet .mt1:nth-child(1) svg'], ['t1line', '#cMet .mt1:nth-child(1) .ln2'], ['t1dot', '#cMet .mt1:nth-child(1) .dt'], ['t1foot', '#cMet .mt1:nth-child(1) .mfoot'], ['t3', '#cMet .mt1:nth-child(3)'], ['t3val', '#cMet .mt1:nth-child(3) .mval'], ['t3cap', '#cMet .mt1:nth-child(3) .mwk'], ['t4', '#cMet .mt1:nth-child(4)'], ['t4lab', '#cMet .mt1:nth-child(4) span']];
|
|
197
|
-
const SKIP_W = new Set(['hint', 'note', 't1val', 't1cap', 't1chg', 't1foot', 't3val', 't3cap', 't4lab', 'heading']);
|
|
198
|
-
const SKIP_L = new Set(['t1val', 't1cap', 't1chg', 't1foot', 't3val', 't3cap', 't4lab', 'hint', 'note']);
|
|
199
|
-
const PROPS = ['fontSize', 'fontWeight', 'fontFamily', 'color', 'backgroundColor', 'borderRadius', 'paddingTop', 'paddingLeft', 'letterSpacing', 'lineHeight', 'boxShadow', 'stroke', 'strokeWidth', 'fill', 'marginTop'];
|
|
200
|
-
const grab = (pg) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s] of pairs) { const e = document.querySelector('main.stage:not([hidden]) ' + s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [SEL, PROPS]);
|
|
201
|
-
for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
202
|
-
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
203
|
-
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
204
|
-
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
|
|
205
|
-
await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="init"]').click(); }, th);
|
|
206
|
-
await until(() => m.evaluate(() => document.querySelectorAll('#cMet .mt1').length > 0));
|
|
207
|
-
await m.evaluate(() => { drawBoardPage(BOARDS.find((b) => b.real)); }); // the mockup's one board that is read from a repository: four tiles, none with a target
|
|
208
|
-
await until(() => m.evaluate(() => document.querySelectorAll('#cMet .mt1').length === 4 && !!document.querySelector('#cMet .note'))); await sleep(900);
|
|
209
|
-
const R = await open({ w, h, theme: th }); await until(() => R.page.evaluate(() => document.querySelectorAll('#metBody .mt1').length === 4)); await sleep(500);
|
|
210
|
-
const a = await grab(m), c = await grab(R.page), diffs = [];
|
|
211
|
-
for (const [n] of SEL) {
|
|
212
|
-
if (!a[n] || !c[n]) { diffs.push(n + ' missing'); continue; }
|
|
213
|
-
for (const k of Object.keys(a[n])) {
|
|
214
|
-
const geom = k === 'left' || k === 'width';
|
|
215
|
-
if (geom && ((k === 'width' && SKIP_W.has(n)) || (k === 'left' && SKIP_L.has(n)))) continue;
|
|
216
|
-
if (k === 'boxShadow' && /^t[1-4]$/.test(n)) continue; // a tile that needs a look carries the orange outline here; the mockup's real board draws it only off target
|
|
217
|
-
if (geom ? Math.abs(a[n][k] - c[n][k]) > 2 : a[n][k] !== c[n][k]) diffs.push(`${n}.${k} ${a[n][k]} | ${c[n][k]}`);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
ok(`C8 styles and geometry match the mockup at ${w} px, ${th}`, diffs.length === 0, diffs.join(' ; '));
|
|
221
|
-
await m.context().close(); await R.ctx.close();
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
159
|
return finish();
|
|
225
160
|
})().catch((e) => { console.error(e); finish(1); });
|
|
@@ -21,6 +21,9 @@ const T = require('./test-run').configure({ name: 'briefing-premium-products' })
|
|
|
21
21
|
|
|
22
22
|
const BASE = T.BASE;
|
|
23
23
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
24
|
+
/* premium-agreed-design: Home has no header line and no picker chip. The product picker is Home's minimal Products card in the Viewer
|
|
25
|
+
* (home-more.js openProducts, "Waiting for design"), opened from the place menu's More; it holds the header's line (#hxSnap), the count
|
|
26
|
+
* (#hxCount), one switch per workspace and Back to the default. The rows are Home's Needs-you rows; a row's product leads its hint. */
|
|
24
27
|
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); } };
|
|
25
28
|
const results = [];
|
|
26
29
|
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 300) : ''}`); };
|
|
@@ -80,43 +83,52 @@ const product = (name, cond) => {
|
|
|
80
83
|
const page = await ctx.newPage(); const errors = [];
|
|
81
84
|
page.on('pageerror', (e) => errors.push(String(e.message || e)));
|
|
82
85
|
await page.goto(BASE + '/premium.html' + q, { waitUntil: 'domcontentloaded' });
|
|
83
|
-
await page.waitForSelector('#
|
|
86
|
+
await page.waitForSelector('#hmList .hm-g', { state: 'attached', timeout: 30000 });
|
|
84
87
|
return { ctx, page, errors };
|
|
85
88
|
};
|
|
86
|
-
//
|
|
89
|
+
// the picker: the place menu's More, then Products; the card opens in the Viewer and reads the products
|
|
87
90
|
const pick = async (page) => {
|
|
88
|
-
if (!(await page.isVisible('#
|
|
89
|
-
|
|
91
|
+
if (!(await page.isVisible('#czViewer #hxCount'))) {
|
|
92
|
+
await page.click('#czFab'); await page.click('[data-cz-more]');
|
|
93
|
+
await page.click('#hmMenu [role="menuitem"]:has-text("Products")');
|
|
94
|
+
await page.waitForSelector('#czViewer #hxCount', { state: 'visible', timeout: 10000 });
|
|
95
|
+
}
|
|
90
96
|
};
|
|
91
|
-
const
|
|
97
|
+
const pickText = (page) => page.textContent('#czViewer #hxCount');
|
|
98
|
+
const rowsOf = (page) => page.$$eval('#hmList .hm-r[data-id^="n:decision:"]', (els) => els.map((e) => ({ key: e.dataset.id.slice(2), tag: ((e.querySelector('.hm-rt em') || {}).textContent || '').split(' · ')[0], title: e.querySelector('.hm-rt b').textContent })));
|
|
92
99
|
|
|
93
100
|
{
|
|
94
101
|
const { ctx, page, errors } = await open();
|
|
95
102
|
await until(async () => (await rowsOf(page)).length === 2, 20000);
|
|
96
103
|
const rows = await rowsOf(page);
|
|
97
104
|
ok('P6 each row carries its product', rows.length === 2 && rows.map((r) => r.tag).sort().join() === 'IDPF,microsites', JSON.stringify(rows));
|
|
98
|
-
const snap = await page.textContent('#snap');
|
|
99
|
-
ok('P1 the header names what is read and what is not', /IDPF and microsites/.test(snap) && /not included/.test(snap) && /\b[Pp][Mm][Oo][Ss]\b|pmos/i.test(snap), snap);
|
|
100
|
-
ok('P2 the picker says how many of the workspaces are on', (await page.textContent('#pick')).replace(/\s+/g, '') === 'Products2of3', await page.textContent('#pick'));
|
|
101
105
|
await pick(page);
|
|
102
|
-
const
|
|
103
|
-
ok('
|
|
104
|
-
|
|
105
|
-
ok('
|
|
106
|
+
const snap = await until(async () => { const t = await page.textContent('#czViewer #hxSnap').catch(() => ''); return t || null; }, 10000) || '';
|
|
107
|
+
ok('P1 the Products card names what is read and what is not', /IDPF and microsites/.test(snap) && /not included/.test(snap) && /\b[Pp][Mm][Oo][Ss]\b|pmos/i.test(snap), snap);
|
|
108
|
+
ok('P1 the Products card is marked Waiting for design', /Waiting for design/.test(await page.textContent('#czViewer')));
|
|
109
|
+
ok('P2 the picker says how many of the workspaces are on', (await pickText(page)).replace(/\s+/g, '') === 'Products2of3', await pickText(page));
|
|
110
|
+
const items = await page.$$eval('#czViewer .hx-sw[data-ws]', (els) => els.map((e) => ({ name: e.getAttribute('aria-label'), on: e.getAttribute('aria-checked'), h: Math.round(e.closest('.hx-row').getBoundingClientRect().height) })));
|
|
111
|
+
ok('P2 the card lists every workspace, the home one included, switched off', items.length === 3 && items.filter((i) => i.on === 'true').length === 2 && items.some((i) => i.on === 'false' && /home/.test(i.name)), JSON.stringify(items));
|
|
112
|
+
ok('P13 each workspace\'s line is at least 42 px high', items.every((i) => i.h >= 42), JSON.stringify(items.map((i) => i.h)));
|
|
106
113
|
// untick microsites: its row leaves, the setting is saved
|
|
107
|
-
await page.click(`#
|
|
114
|
+
await page.click(`#czViewer .hx-sw[data-ws="${wB.id}"]`);
|
|
108
115
|
ok('P4 an unticked product\'s row leaves the list', await until(async () => { const r = await rowsOf(page); return r.length === 1 && r[0].tag === 'IDPF'; }, 20000));
|
|
109
116
|
const saved = (await json('GET', '/api/settings')).body.settings.find((s) => s.key === 'ws.briefing.include');
|
|
110
117
|
ok('P3 the choice is saved as a list of workspace ids', saved && JSON.stringify(saved.value) === JSON.stringify([wA.id]), JSON.stringify(saved));
|
|
111
|
-
ok('P2 the count in the picker follows', (await
|
|
112
|
-
|
|
118
|
+
ok('P2 the count in the picker follows', !!(await until(async () => (await pickText(page)).replace(/\s+/g, '') === 'Products1of3', 10000)), await pickText(page));
|
|
119
|
+
await page.focus(`#czViewer .hx-sw[data-ws="${wA.id}"]`); await page.keyboard.press('Enter');
|
|
120
|
+
ok('P13 keyboard: Enter on a switch flips it', !!(await until(async () => (await page.getAttribute(`#czViewer .hx-sw[data-ws="${wA.id}"]`, 'aria-checked')) === 'false', 10000)));
|
|
121
|
+
await page.focus(`#czViewer .hx-sw[data-ws="${wA.id}"]`).catch(() => {}); await page.keyboard.press('Enter');
|
|
122
|
+
await until(async () => (await page.getAttribute(`#czViewer .hx-sw[data-ws="${wA.id}"]`, 'aria-checked')) === 'true', 10000);
|
|
123
|
+
await page.keyboard.press('Escape');
|
|
124
|
+
ok('P13 keyboard: Escape closes the card', !!(await until(() => page.evaluate(() => !window.czViewer.isOpen()), 3000)));
|
|
113
125
|
ok('P3 the choice survives a reload', await (async () => { await page.reload({ waitUntil: 'domcontentloaded' }); return until(async () => { const r = await rowsOf(page); return r.length === 1 && r[0].tag === 'IDPF' ? 1 : 0; }, 20000); })());
|
|
114
126
|
// tick the home workspace
|
|
115
|
-
await pick(page); await page.click(`#
|
|
116
|
-
ok('P3
|
|
127
|
+
await pick(page); await page.click(`#czViewer .hx-sw[data-ws="${home.id}"]`);
|
|
128
|
+
ok('P3 switching the home workspace on reads it', await until(async () => (await page.getAttribute(`#czViewer .hx-sw[data-ws="${home.id}"]`, 'aria-checked')) === 'true' && new RegExp(home.name + ' and IDPF|IDPF and ' + home.name, 'i').test(await page.textContent('#czViewer #hxSnap')), 20000), await page.textContent('#czViewer #hxSnap').catch(() => ''));
|
|
117
129
|
// back to the default
|
|
118
|
-
await page.click('#
|
|
119
|
-
ok('P3 Back to the default reads every product but the home one again', await until(async () => (await rowsOf(page)).length === 2
|
|
130
|
+
await page.click('#czViewer [data-reset]');
|
|
131
|
+
ok('P3 Back to the default reads every product but the home one again', await until(async () => (await rowsOf(page)).length === 2 && (await pickText(page)).replace(/\s+/g, '') === 'Products2of3', 20000), await pickText(page));
|
|
120
132
|
ok('P3 and the saved choice is gone', (await json('GET', '/api/settings')).body.settings.find((s) => s.key === 'ws.briefing.include').changed === false);
|
|
121
133
|
ok('no page error', errors.length === 0, errors.join(' | '));
|
|
122
134
|
await ctx.close();
|
|
@@ -127,11 +139,11 @@ const product = (name, cond) => {
|
|
|
127
139
|
const { ctx, page } = await open();
|
|
128
140
|
await until(async () => (await rowsOf(page)).length === 2, 20000);
|
|
129
141
|
const key = (await rowsOf(page)).find((r) => r.tag === 'IDPF').key;
|
|
130
|
-
await page.click(`#
|
|
131
|
-
await page.waitForSelector('#
|
|
132
|
-
await page.click('#
|
|
133
|
-
await page.fill('#
|
|
134
|
-
await page.click('#
|
|
142
|
+
await page.click(`#hmList [data-hm-sel="n:${key}"]`);
|
|
143
|
+
await page.waitForSelector('#czViewer [data-hv-opt]');
|
|
144
|
+
await page.click('#czViewer [data-hv-opt="extend"]');
|
|
145
|
+
await page.fill('#hvWhy', 'IDPF moves the date.');
|
|
146
|
+
await page.click('#czViewer [data-hv-rec]');
|
|
135
147
|
ok('P9 the press is recorded and the IDPF row leaves, the microsites row stays', await until(async () => { const r = await rowsOf(page); return r.length === 1 && r[0].tag === 'microsites' ? 1 : 0; }, 20000), JSON.stringify(await rowsOf(page)));
|
|
136
148
|
const dA = fs.readFileSync(path.join(rootA, 'pm-decisions.md'), 'utf8'), dB = fs.readFileSync(path.join(rootB, 'pm-decisions.md'), 'utf8');
|
|
137
149
|
ok('P9 the decision is in IDPF\'s journal and not in the other product\'s or the home one\'s', /KC9/.test(dA) && /IDPF moves the date/.test(dA) && !/KC9/.test(dB) && !/IDPF moves the date/.test(fs.readFileSync(path.join(home.root, 'pm-decisions.md'), 'utf8')));
|
|
@@ -158,15 +170,16 @@ const product = (name, cond) => {
|
|
|
158
170
|
const { ctx, page } = await open({ w, h: 800, theme: th });
|
|
159
171
|
await until(async () => (await rowsOf(page)).length >= 1, 20000);
|
|
160
172
|
await pick(page);
|
|
161
|
-
const o = await page.evaluate(() => ({ sw: document.documentElement.scrollWidth, cw: document.documentElement.clientWidth, menu: (() => { const r = document.querySelector('#
|
|
162
|
-
ok(`P13 at ${w} px, ${th}: no sideways scroll with the
|
|
173
|
+
const o = await page.evaluate(() => ({ sw: document.documentElement.scrollWidth, cw: document.documentElement.clientWidth, menu: (() => { const r = document.querySelector('#czViewer').getBoundingClientRect(); return { l: Math.round(r.left), r: Math.round(r.right) }; })() }));
|
|
174
|
+
ok(`P13 at ${w} px, ${th}: no sideways scroll with the Products card open, and the card stays on screen`, o.sw <= o.cw && o.menu.l >= 0 && o.menu.r <= o.cw, JSON.stringify(o));
|
|
163
175
|
await ctx.close();
|
|
164
176
|
}
|
|
165
177
|
|
|
166
178
|
{
|
|
167
179
|
// the narrowed view (P12): the one-workspace page, with a way back
|
|
168
180
|
const { ctx, page } = await open({ q: '?ws=' + encodeURIComponent(wB.id) });
|
|
169
|
-
|
|
181
|
+
await pick(page);
|
|
182
|
+
ok('P12 ?ws= shows that one workspace and a link back to the picked products', await until(async () => (await page.$('#czViewer #pickAll')) !== null, 20000) && (await page.getAttribute('#czViewer #pickAll', 'href')) === '/premium.html');
|
|
170
183
|
await ctx.close();
|
|
171
184
|
}
|
|
172
185
|
return finish();
|