fix(webui): drawer polish review round 3 notes: with the runs not read and no claim, Last activity names the agents and claims reads, with a test for chief; the Project scroll test waits for the Projects page heading; a test comment matches the one of its runs wording (#1873, lane sp18-drawer-polish)
This commit was merged in pull request #1988.
This commit is contained in:
1 parent
9343baffff
commit
2d44750b96
2 files changed
+14
-4
No files matched your search
@@ -1360,7 +1360,7 @@
|
||||
const activity = last ? `${!runs ? 'a run' : runs.length > 1 ? `one of its ${runs.length} runs` : 'its run'} took ${last.what} <time datetime="${esc(last.claimedAt)}" title="${esc(new Date(msOf(last.claimedAt)).toLocaleString())}">${esc(ago(last.claimedAt))}</time>`
|
||||
: `<span class="muted">${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: no run holds its role or a conversation in the reads, and its runs were not read'
|
||||
: !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'}</span>`;
|
||||
const fields = [
|
||||
field('org', 'Organization', orgChip(o, org)),
|
||||
|
||||
@@ -236,7 +236,7 @@ test('SP18 review: Last activity counts only a claim whose run is running', asyn
|
||||
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: the line says it is the latest of them.
|
||||
// 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"]';
|
||||
@@ -251,6 +251,15 @@ test('SP18 review: Last activity counts only a claim whose run is running', asyn
|
||||
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 => {
|
||||
@@ -656,10 +665,11 @@ test('SP18: at 390 wide the open sheet is the whole screen, the page under it do
|
||||
|
||||
// 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 page is drawn by bus.js without it.
|
||||
// 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")'],
|
||||
['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'));
|
||||
|
||||
Reference in new issue
Block a user