${secH('Settings', 'every setting, with where its value comes from')}
${settingsList(org, { business, settings, instances, noRuns, orgCount: list ? list.length : null })}
This Console only reads ${esc(orgName)}. It can not message or stop its agents.
`;
+ // SP18: the agents read lists only roles a run holds now, and thread.claims only conversations a run
+ // holds now; each row carries that run and when it took the role or the conversation. A claim counts
+ // only when the instances read lists its run as running, so a claim left by a run that ended does not
+ // date a stopped agent. Last activity is the latest such time. No read keeps when a run ended or when
+ // the agent last sent a message (a thread's messages read pages from the oldest message), so neither is shown.
+ const runs = !unknown && runsRead(item) ? item.running : null;
+ const claims = [a.s ? { ...a.s, what: 'the role' } : null, ...arr(body?.sessions).filter(x => x?.kind === 'thread' && x.org === org && x.instance === key).map(x => ({ ...x, what: 'the conversation' }))]
+ .filter(c => c && msOf(c.claimedAt) !== null && (!runs || runs.includes(c.run))).sort((x, y) => msOf(y.claimedAt) - msOf(x.claimedAt));
+ const last = claims[0], claimWhy = notRead(['agents', 'claims']);
+ // With the runs not read, nothing checked the claim against a live run, so the line says "a run".
+ const activity = last ? `${!runs ? 'a run' : runs.length > 1 ? `one of its ${runs.length} runs` : 'its run'} took ${last.what} `
+ : `${claimWhy ? `not read: ${esc(claimWhy)}`
+ : runs?.length ? `not recorded: ${runs.length > 1 ? 'its runs hold' : 'its run holds'} no role or conversation yet`
+ : !runs ? 'not recorded: the agents and claims reads show no run holding its role or a conversation, and its runs were not read'
+ : 'not recorded: no run holds it now, and no read keeps when its last run ended'}`;
const fields = [
field('org', 'Organization', orgChip(o, org)),
// A pack hire's pack is named once, in Hired from; the Role row says only that it was hired.
@@ -1358,11 +1372,7 @@
model ? field('model', 'Model', `${esc(model)}`) : '',
project ? field('project', 'Project', `${esc(project.name || project.key || project.id)}${project.from ? ` ${project.from}` : ''}`) : '',
task ? field('task', 'Task', `${esc(task.title || task.ref)}${task.title ? ` ${esc(task.ref)}` : ''}`) : '',
- // SP16: no read the Console makes carries the time of a role agent's last message or run. The agents
- // read's time is when it took the role and `since` is when its present state began, so neither is shown.
- // An agent holding a conversation has its messages in that thread's messages read, but that read pages
- // from the oldest message, so its last message is a walk of every page away; the drawer does not make it.
- field('activity', 'Last activity', `${thread?.thread ? 'not shown: reading it means reading the whole conversation' : 'not recorded'}`),
+ field('activity', 'Last activity', activity),
].join('');
return shell(a.name, `
${fields}
Open tasks
${tasksBody}${tasksAll}
@@ -1377,6 +1387,16 @@
history.replaceState(unmarked(), '', sansAgent());
document.dispatchEvent(new CustomEvent('mosaic-workspace-render'));
}
+ // SP18: below 701 px the open drawer is a sheet and shell.css holds the page under it to one screen, which
+ // scrolls the page to the top. The page's place is kept while no drawer is open, with the page the sheet
+ // opened over. It is put back only when the drawer closes onto that same page (Close, Escape or Back); a
+ // link in the sheet goes to another page, which starts at its top, and the kept place is dropped. Some
+ // pages a link opens (a project, the Assistant) are drawn without afterPaint, so the place is dropped as
+ // soon as the address leaves the page under the sheet.
+ const SHEET = window.matchMedia('(max-width:700px)');
+ let pageY = 0, sheetOver = null;
+ window.addEventListener('scroll', () => { if (!document.querySelector('#bus-view [data-ws-drawer]')) pageY = window.scrollY; }, { passive: true });
+ window.addEventListener('hashchange', () => { if (sheetOver !== null && sansAgent() !== sheetOver) { sheetOver = null; pageY = 0; } });
// bus.js calls this after each paint: focus moves into a drawer a row opened, and back to the row
// when the drawer has closed and focus was left nowhere.
function afterPaint() {
@@ -1384,8 +1404,13 @@
const view = document.getElementById('bus-view'), d = view?.querySelector('[data-ws-drawer]');
const now = d?.dataset.wsDrawer || null, was = drawerShown;
drawerShown = now;
+ if (now) sheetOver = sansAgent();
if (d && drawerFocus) { drawerFocus = false; d.querySelector('h2')?.focus({ preventScroll: true }); return; }
drawerFocus = false;
+ if (!now && sheetOver !== null) {
+ if (SHEET.matches && pageY && sheetOver === sansAgent()) window.scrollTo(0, pageY);
+ sheetOver = null; pageY = window.scrollY;
+ }
if (!now && was) {
const a = document.activeElement;
if (!a || a === document.body || !view?.contains(a)) view?.querySelector(`[data-focus-key="${CSS.escape(`agent:${was}`)}"]`)?.focus({ preventScroll: true });
diff --git a/packages/webui/tests/agent-drawer-browser.test.mjs b/packages/webui/tests/agent-drawer-browser.test.mjs
index ea2564ef6..62773fce1 100644
--- a/packages/webui/tests/agent-drawer-browser.test.mjs
+++ b/packages/webui/tests/agent-drawer-browser.test.mjs
@@ -18,7 +18,7 @@ const at = minutesAgo => new Date(Date.now() - minutesAgo * 60000).toISOString()
const HIRE = '0f3c1a2b-4d5e-4f60-8a7b-9c0d1e2f3a4b';
const THREAD = '7b1e2c3d-4f50-4a61-8b72-9c83d4e5f6a7';
-function fixture() {
+function fixture(tweak) {
const LIST = [
{ id: 'acme', label: 'Acme Studio', theme: 'cobalt' },
{ id: 'beta', label: 'Beta Works', theme: 'grove' },
@@ -52,6 +52,7 @@ function fixture() {
model: {},
},
};
+ tweak?.(DATA);
const value = (id, name) => Promise.resolve(DATA[id]?.[name] ?? (['usage', 'limits'].includes(name) ? {} : []));
const opts = id => ({
bus: { inbox: () => value(id, 'inbox'), agents: () => value(id, 'agents'), 'thread.claims': () => value(id, 'claims'), tasks: () => value(id, 'tasks'), usage: () => value(id, 'usage'), limits: () => value(id, 'limits'), decisions: () => value(id, 'decisions') },
@@ -115,8 +116,8 @@ const STUB = `(() => {
};
})();`;
-async function setup(t, { viewport = [1440, 900], hash = '#/agents', stub = true, scripts = [] } = {}) {
- const server = await startServer({ port: 0, sso: createDevOwner(), organizations: fixture(), log: () => {} });
+async function setup(t, { viewport = [1440, 900], hash = '#/agents', stub = true, scripts = [], data } = {}) {
+ const server = await startServer({ port: 0, sso: createDevOwner(), organizations: fixture(data), log: () => {} });
t.after(() => close(server));
const b = await browser({ machine: false }); t.after(() => b.close());
await b.viewport(...viewport);
@@ -185,9 +186,12 @@ test('the drawer shows each field from its read: name, organization, role and so
// Decisions waiting on a human that it raised, each into the Inbox. Chief's is not its own.
const decisions = await b.evaluate(`[...document.querySelectorAll('${d} [data-drawer-decisions] li a')].map(a => [a.textContent.trim(), a.getAttribute("href")])`);
assert.deepEqual(decisions, [['Ship the hero copy?', '#/inbox?d=acme%3Adec-1']]);
- // SP16: no read gives the time of an agent's last activity. The agents read's time (when it took the
- // role) and `since` (when its present state began) are not that, so the drawer says not recorded.
- assert.equal(await text(`${d} [data-drawer-activity]`), 'not recorded');
+ // SP18: the agents read lists only roles a run holds now, and its time is when that run took the role,
+ // so Last activity is when coder's running run took the role, 40 minutes before the read, with the time itself.
+ assert.match(await text(`${d} [data-drawer-activity]`), /^its run took the role 4[01] min ago$/);
+ const started = await attr(`${d} [data-drawer-activity] time`, 'datetime');
+ assert.ok(Math.abs(Date.now() - Date.parse(started) - 40 * 60000) < 90000, started);
+ assert.match(await attr(`${d} [data-drawer-activity] time`, 'title'), /\d/);
assert.equal(await b.evaluate(`document.querySelector('${d} [data-drawer-activity]').closest('.ws-drawer-f').querySelector('dt').textContent`), 'Last activity');
// Not a pack hire: no packs read, and no Hired from line.
assert.equal(await has(`${d} [data-drawer-hired]`), false);
@@ -209,6 +213,53 @@ test('a hired agent shows where its role came from; a not-running agent says not
assert.match(await text(`${d} [data-drawer-source]`), new RegExp(`hire decision ${HIRE}`));
assert.match(await text(`${d} [data-drawer-state]`), /(^|\s)not running$/);
assert.equal(await has(`${d} [data-drawer-model]`), false);
+ // SP18: no run holds it, and no read keeps the time of a run that ended: one plain line, no time.
+ assert.equal(await text(`${d} [data-drawer-activity]`), 'not recorded: no run holds it now, and no read keeps when its last run ended');
+ assert.equal(await has(`${d} [data-drawer-activity] time`), false);
+});
+
+// SP18 review: a claim dates the agent only when the instances read lists its run as running.
+test('SP18 review: Last activity counts only a claim whose run is running', async t => {
+ // Coder runs run-2, but the role is still held by run-1, whose process ended: nothing dates run-2 yet.
+ {
+ const { wait, text, has } = await setup(t, { hash: '#/agents?agent=acme%3Acoder', data: d => { d.acme.instances.coder.running = ['run-2']; } });
+ const d = '[data-ws-drawer="acme:coder"]';
+ await wait(`${open('acme:coder')} && /running$/.test(document.querySelector('${d} [data-drawer-state]')?.textContent ?? '')`);
+ assert.equal(await text(`${d} [data-drawer-activity]`), 'not recorded: its run holds no role or conversation yet');
+ assert.equal(await has(`${d} [data-drawer-activity] time`), false);
+ }
+ // Coder runs nothing, and a claim from three days ago is left: not running, and no time from that claim.
+ {
+ const { wait, text, has } = await setup(t, { hash: '#/agents?agent=acme%3Acoder', data: d => { d.acme.instances.coder.running = []; d.acme.agents[0].at = at(3 * 24 * 60); d.acme.agents[0].working = null; } });
+ const d = '[data-ws-drawer="acme:coder"]';
+ await wait(`${open('acme:coder')} && /not running$/.test(document.querySelector('${d} [data-drawer-state]')?.textContent ?? '')`);
+ assert.equal(await text(`${d} [data-drawer-activity]`), 'not recorded: no run holds it now, and no read keeps when its last run ended');
+ assert.equal(await has(`${d} [data-drawer-activity] time`), false);
+ }
+ // Two runs, one holding the role: no read says which run is newer, so the line says one of them.
+ {
+ const { wait, text } = await setup(t, { hash: '#/agents?agent=acme%3Acoder', data: d => { d.acme.instances.coder.running = ['run-1', 'run-2']; } });
+ const d = '[data-ws-drawer="acme:coder"]';
+ await wait(`${open('acme:coder')} && !!document.querySelector('${d} [data-drawer-activity] time')`);
+ assert.match(await text(`${d} [data-drawer-activity]`), /^one of its 2 runs took the role 4[01] min ago$/);
+ }
+ // The instances read fails: nothing checked the claim against a live run, so the line says "a run".
+ {
+ const fail = `(() => { const f = window.fetch; window.fetch = (u, i) => /\\/api\\/orgs\\/acme\\/bus\\/instances$/.test(String(u)) ? Promise.resolve(new Response('{}', { status: 503 })) : f(u, i); })();`;
+ const { wait, text } = await setup(t, { hash: '#/agents?agent=acme%3Acoder', scripts: [fail] });
+ const d = '[data-ws-drawer="acme:coder"]';
+ await wait(`${open('acme:coder')} && /^State not read/.test(document.querySelector('${d} [data-drawer-state]')?.textContent ?? '')`);
+ assert.match(await text(`${d} [data-drawer-activity]`), /^a run took the role 4[01] min ago$/);
+ }
+ // The same failed read for chief, which holds no role and no conversation: the line names both gaps.
+ {
+ const fail = `(() => { const f = window.fetch; window.fetch = (u, i) => /\\/api\\/orgs\\/acme\\/bus\\/instances$/.test(String(u)) ? Promise.resolve(new Response('{}', { status: 503 })) : f(u, i); })();`;
+ const { wait, text, has } = await setup(t, { hash: '#/agents?agent=acme%3Achief', scripts: [fail] });
+ const d = '[data-ws-drawer="acme:chief"]';
+ await wait(`${open('acme:chief')} && /^State not read/.test(document.querySelector('${d} [data-drawer-state]')?.textContent ?? '')`);
+ assert.equal(await text(`${d} [data-drawer-activity]`), 'not recorded: the agents and claims reads show no run holding its role or a conversation, and its runs were not read');
+ assert.equal(await has(`${d} [data-drawer-activity] time`), false);
+ }
});
test('SP16: a pack hire names its pack and the template the packs read gives; a refused read says so', async t => {
@@ -501,8 +552,8 @@ test('Message opens the agent\'s thread in an Assistant pane; Stop asks first an
assert.equal(await attr('[data-ws-drawer="acme:assistant"] [data-drawer-message]', 'href'), `#/assistant?add=acme%3A${THREAD}`);
// SP16: Message is offered, so no line says why it is not.
assert.equal(await has('[data-ws-drawer="acme:assistant"] [data-drawer-nomessage]'), false);
- // It holds a conversation, whose messages read pages from the oldest message: the drawer says it does not read it.
- assert.equal(await text('[data-ws-drawer="acme:assistant"] [data-drawer-activity]'), 'not shown: reading it means reading the whole conversation');
+ // SP18: a conversation agent's run took its conversation 5 minutes before the read (thread.claims' time).
+ assert.match(await text('[data-ws-drawer="acme:assistant"] [data-drawer-activity]'), /^its run took the conversation [56] min ago$/);
// A role agent holds no thread to open, so it has no Message; it can still be stopped.
await b.evaluate('location.hash = "#/agents?agent=acme%3Acoder"');
await wait(`${open('acme:coder')} && document.querySelector('[data-ws-drawer="acme:coder"] [data-drawer-stop]')`);
@@ -578,6 +629,71 @@ test('at 390 wide the drawer is a full-width sheet', async t => {
assert.ok(box[3] <= box[2], `no horizontal page scroll: ${box[3]} > ${box[2]}`);
});
+// SP18: the sheet is fixed to the screen, but the page under it kept its own height, so the page still
+// scrolled behind the sheet and a full-page shot showed the sheet stretched down a long blank area. With the
+// sheet open the page is one screen tall; Close puts the page back where the reader left it.
+test('SP18: at 390 wide the open sheet is the whole screen, the page under it does not scroll, and Close keeps the place', async t => {
+ const { b, wait } = await setup(t, { viewport: [390, 844], hash: '#/orgs/acme/organization' });
+ const link = JSON.stringify(sessionLink('acme:coder'));
+ await wait(`document.querySelector(${link}) && document.querySelectorAll("[data-org-settings] [data-org-setting]").length > 10`);
+ await b.evaluate(`document.querySelector(${link}).scrollIntoView({ block: 'center' })`);
+ const at = await b.evaluate('Math.round(scrollY)');
+ assert.ok(at > 100, `the row is down the page: ${at}`);
+ await b.evaluate(`document.querySelector(${link}).click()`);
+ await wait(open('acme:coder'));
+ await b.evaluate('new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)))');
+ const m = await b.evaluate(`(() => { const r = ${drawer('acme:coder')}.getBoundingClientRect(), e = document.documentElement; return { top: Math.round(r.top), bottom: Math.round(r.bottom), left: Math.round(r.left), width: Math.round(r.width), vh: innerHeight, vw: e.clientWidth, docH: e.scrollHeight, bodyH: Math.round(document.body.getBoundingClientRect().height), sw: e.scrollWidth }; })()`);
+ assert.equal(m.top, 0, JSON.stringify(m));
+ assert.equal(m.bottom, m.vh, `the sheet ends at the screen's foot: ${JSON.stringify(m)}`);
+ assert.equal(m.left, 0); assert.equal(m.width, m.vw);
+ assert.ok(m.docH <= m.vh && m.bodyH <= m.vh, `the page under the sheet is one screen tall, nothing below to scroll to: ${JSON.stringify(m)}`);
+ assert.ok(m.sw <= m.vw, 'no sideways scroll');
+ // A scroll on the page does nothing while the sheet is open.
+ await b.evaluate('window.scrollTo(0, 2000)');
+ assert.equal(await b.evaluate('Math.round(scrollY)'), 0);
+ await b.evaluate(`${drawer('acme:coder')}.querySelector("[data-drawer-close]").click()`);
+ await wait(noDrawer);
+ await b.evaluate('new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)))');
+ assert.ok(Math.abs(await b.evaluate('Math.round(scrollY)') - at) <= 1, `Close puts the page back at ${at}: ${await b.evaluate('Math.round(scrollY)')}`);
+ assert.ok(await b.evaluate('document.documentElement.scrollHeight') > 844, 'the page is its full height again');
+ // At 1440 the drawer is a side panel: the page keeps its height and scrolls.
+ await b.viewport(1440, 900);
+ await b.evaluate(`document.querySelector(${link}).click()`);
+ await wait(open('acme:coder'));
+ assert.ok(await b.evaluate('document.documentElement.scrollHeight') > 900, 'at 1440 the page beside the drawer keeps its height');
+});
+
+// SP18 review: only Close (or Back to the same page) puts the page back. A link in the sheet goes to a new
+// page, which starts at its top, and the place kept for the page under the sheet is not used later either.
+// The Task page is drawn through afterPaint; a project address is drawn by bus.js's chat branch without it
+// (this fixture has no chat backend, so that page is the Projects list saying the route is invalid).
+for (const [label, sel, hashStart, ready] of [
+ ['Task', '[data-drawer-task] a', '#/orgs/acme/tasks?task=', 'document.querySelector("[data-tasks-board]")'],
+ ['Project', '[data-drawer-project] a', '#/orgs/acme/projects/p-site', 'document.querySelector("#bus-view h1")?.textContent.trim() === "Projects"'],
+]) test(`SP18 review: at 390 the sheet's ${label} link opens its page at the top, and a later page does not jump`, async t => {
+ const { b, wait } = await setup(t, { viewport: [390, 844], hash: '#/orgs/acme/organization' });
+ const link = JSON.stringify(sessionLink('acme:coder'));
+ await wait(`document.querySelector(${link}) && document.querySelectorAll("[data-org-settings] [data-org-setting]").length > 10`);
+ // Every page is long, so a jump to the kept place would show wherever it lands.
+ await b.evaluate('document.head.insertAdjacentHTML("beforeend", "")');
+ await b.evaluate(`document.querySelector(${link}).scrollIntoView({ block: 'center' })`);
+ const at = await b.evaluate('Math.round(scrollY)');
+ assert.ok(at > 100, `the row is down the page: ${at}`);
+ await b.evaluate(`document.querySelector(${link}).click()`);
+ await wait(open('acme:coder'));
+ await b.evaluate(`${drawer('acme:coder')}.querySelector(${JSON.stringify(sel)}).click()`);
+ await wait(`${noDrawer} && location.hash.startsWith(${JSON.stringify(hashStart)}) && ${ready}`);
+ await b.evaluate('new Promise(r => setTimeout(r, 500))');
+ const y = await b.evaluate('Math.round(scrollY)');
+ assert.ok(y <= 1, `the ${label} page is at its top, not at ${at}: ${y}`);
+ // The next page with no drawer does not take the kept place either.
+ await b.evaluate('location.hash = "#/orgs/acme/organization"');
+ await wait('document.querySelectorAll("[data-org-settings] [data-org-setting]").length > 10');
+ await b.evaluate('new Promise(r => setTimeout(r, 500))');
+ const later = await b.evaluate('Math.round(scrollY)');
+ assert.ok(later <= 1, `the organization page opens at its top: ${later}`);
+});
+
// #1873 triage-followups: the page focuses its heading when its first render ends. On load the page
// starts a second render that reads GET /api/workspace again, so when the first render's read is slow
// the second draws the rows first and a reader can open a drawer before the first render ends. Its late
diff --git a/packages/webui/tests/kpi-tiles-browser.test.mjs b/packages/webui/tests/kpi-tiles-browser.test.mjs
index ef50aad0e..96d99b51a 100644
--- a/packages/webui/tests/kpi-tiles-browser.test.mjs
+++ b/packages/webui/tests/kpi-tiles-browser.test.mjs
@@ -279,3 +279,24 @@ test('At 390 wide the tiles sit two to a row with no sideways scroll, on the Das
assert.equal(await cols('[data-org-tiles]'), 2);
assert.equal(await b.evaluate('document.documentElement.scrollWidth <= document.documentElement.clientWidth'), true, 'organization page');
});
+
+test('SP18: at 1440 and 1024 the Dashboard\'s two columns line up with the tile row above them', async t => {
+ const { b, wait } = await setup(t, { viewport: [1440, 1000] });
+ await wait(homeReady);
+ // The left column ends where a tile ends and the right column starts where the next tile starts: the fourth
+ // and fifth of six at 1440, the second and third of three a row at 1024.
+ const edges = () => b.evaluate(`(() => {
+ const tiles = [...document.querySelectorAll('[data-ws-home] [data-ws-tile]')].map(e => e.getBoundingClientRect());
+ const cols = [...document.querySelectorAll('[data-ws-home] .ws-home-split>*')].map(e => e.getBoundingClientRect());
+ return { rights: tiles.map(r => Math.round(r.right)), lefts: tiles.map(r => Math.round(r.left)), left: cols[0] && [Math.round(cols[0].left), Math.round(cols[0].right)], right: cols[1] && [Math.round(cols[1].left), Math.round(cols[1].right)] };
+ })()`);
+ for (const [w, nth] of [[1440, 4], [1024, 2]]) {
+ await b.viewport(w, 1000);
+ await b.evaluate('new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)))');
+ const e = await edges();
+ assert.ok(e.left && e.right && e.right[0] > e.left[1], `two columns side by side at ${w}: ${JSON.stringify(e)}`);
+ assert.ok(Math.abs(e.left[1] - e.rights[nth - 1]) <= 1, `at ${w} the left column ends with tile ${nth}: ${JSON.stringify(e)}`);
+ assert.ok(Math.abs(e.right[0] - e.lefts[nth]) <= 1, `at ${w} the right column starts with tile ${nth + 1}: ${JSON.stringify(e)}`);
+ assert.ok(Math.abs(e.right[1] - Math.max(...e.rights)) <= 1, `at ${w} the right column ends with the row`);
+ }
+});
diff --git a/packages/webui/tests/org-page-fit-browser.test.mjs b/packages/webui/tests/org-page-fit-browser.test.mjs
index c0756e952..2df340aab 100644
--- a/packages/webui/tests/org-page-fit-browser.test.mjs
+++ b/packages/webui/tests/org-page-fit-browser.test.mjs
@@ -180,6 +180,20 @@ test('the Settings card fits at 1440 with the drawer open, at 735 and 390 withou
assert.deepEqual(cols[1].heads, ['Settings']);
const gap = await b.evaluate(`(() => { const left = document.querySelector('#bus-view .ws-dash>.ws-split>section'), card = left.querySelector('[data-wfg-card]'), above = card.previousElementSibling; return Math.round(card.getBoundingClientRect().top - above.getBoundingClientRect().bottom); })()`);
assert.ok(gap >= 0 && gap <= 40, `the Workflows card follows the sessions directly: ${gap}px`);
+ // SP18: Autonomy and Starter packs follow the Workflows card in the left column, so the left column is not
+ // empty beside the long Settings card and nothing runs full width below it.
+ const left = await b.evaluate(`(() => { const s = [...document.querySelectorAll('#bus-view .ws-dash>.ws-split>section')]; return { autonomy: !!s[0].querySelector('[data-autonomy]'), packs: !!s[0].querySelector('[data-packs]'), after: !!document.querySelector('#bus-view .ws-dash>.ws-split ~ :is(div,section):not([data-ws-drawer])'), ends: s.map(x => Math.round(x.getBoundingClientRect().bottom)) }; })()`);
+ assert.equal(left.autonomy && left.packs, true, `Autonomy and Starter packs are in the left column: ${JSON.stringify(left)}`);
+ assert.equal(left.after, false, 'no full-width block under the split');
+ // How near level the two end depends on the data: in this fixture Autonomy is a one-line refusal and no pack
+ // is installed, so the Settings card is still the taller. The left column ends with Starter packs.
+ assert.ok(await b.evaluate(`Math.abs(document.querySelector('#bus-view .ws-dash>.ws-split>section [data-packs]').getBoundingClientRect().bottom - document.querySelector('#bus-view .ws-dash>.ws-split>section').getBoundingClientRect().bottom) <= 1`), `the left column ends with Starter packs: ${JSON.stringify(left.ends)}`);
+ // At 390 the page is one column: sessions, Workflows, Autonomy, Starter packs, then Settings.
+ await b.viewport(390, 844);
+ await b.evaluate('new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)))');
+ const order = await b.evaluate(`[...document.querySelectorAll('#bus-view .ws-dash>.ws-split h2, #bus-view .ws-dash>.ws-split h3')].map(h => h.textContent.trim()).filter(x => ['Active agent sessions', 'Workflows', 'Autonomy', 'Starter packs', 'Settings'].includes(x))`);
+ assert.deepEqual(order, ['Active agent sessions', 'Workflows', 'Autonomy', 'Starter packs', 'Settings']);
+ assert.ok(await b.evaluate('document.documentElement.scrollWidth <= document.documentElement.clientWidth'), 'no sideways scroll at 390');
});
test('the bare organization address with a query is the organization page, query kept; ?agent= opens the drawer', async t => {
diff --git a/packages/webui/tests/unified-workspace-browser.test.mjs b/packages/webui/tests/unified-workspace-browser.test.mjs
index 29171de71..cab97d29e 100644
--- a/packages/webui/tests/unified-workspace-browser.test.mjs
+++ b/packages/webui/tests/unified-workspace-browser.test.mjs
@@ -302,8 +302,9 @@ test('keyboard focus follows visual order and survives a data refresh', async t
await b.navigate(`http://127.0.0.1:${server.address().port}/#/orgs/ddigital/organization`);
await wait('document.querySelectorAll("[data-org-dashboard] .ws-doc").length > 0 && document.querySelectorAll("#workspace-nav .ws-proj").length === 3');
const wide = await tabStops(b, 'document.querySelector("#sections a")');
- // The left column holds the sessions and, below them, the Workflows card (SP16); the right holds Settings.
- const regions = ['nav', 'head', 'Sessions and workflows', 'Settings'];
+ // The left column holds the sessions and, below them, the Workflows card (SP16), then Autonomy and Starter
+ // packs (SP18); the right holds Settings.
+ const regions = ['nav', 'head', 'Sessions, workflows, autonomy and starter packs', 'Settings'];
assert.deepEqual([...new Set(wide.map(s => s.region))].filter(r => r !== 'other'), regions);
assertVisualOrder(wide.filter(s => s.region !== 'other'), regions, '1440');
const keys = wide.map(s => s.key);
diff --git a/packages/webui/tests/workflows-browser.test.mjs b/packages/webui/tests/workflows-browser.test.mjs
index 411001251..27fc4d533 100644
--- a/packages/webui/tests/workflows-browser.test.mjs
+++ b/packages/webui/tests/workflows-browser.test.mjs
@@ -312,6 +312,9 @@ test('a stopped organization is not read: the page and card say the bus is stopp
await wait(`document.querySelector('[data-org-dashboard] [data-wfg-card][data-bus-stopped]')`, 'stopped card');
assert.match(await b.evaluate(`document.querySelector('[data-wfg-card]').textContent`), /Not read: the bus is stopped\./);
assert.equal(await b.evaluate(`document.querySelector('[data-wfg-card] [data-wfg-none]')`), null);
+ // SP18: the card is the page's one Workflows block; the old stopped panel under it said the same thing twice.
+ assert.equal(await b.evaluate(`[...document.querySelectorAll('[data-org-dashboard] h2, [data-org-dashboard] h3')].filter(h => h.textContent.trim() === 'Workflows').length`), 1, 'one Workflows heading on a stopped organization page');
+ assert.equal(await b.evaluate(`document.querySelector('[data-workflows]')`), null);
assert.equal(reads.filter(id => id === 'gamma').length, 0, 'a stopped organization is not read');
});