diff --git a/app/tests/artifact-sharing-screens-layout.test.tsx b/app/tests/artifact-sharing-screens-layout.test.tsx index 3bfaeaa372..fbc2ea620f 100644 --- a/app/tests/artifact-sharing-screens-layout.test.tsx +++ b/app/tests/artifact-sharing-screens-layout.test.tsx @@ -76,9 +76,17 @@ class World { retentionDays: null, publicLinksAvailable: true, }; + collaboration = { presence: true, appsInPages: true }; writes: { method: string; path: string; body: unknown }[] = []; /** Every API path the page asked, in order. */ asked: string[] = []; + /** + * Every request the page made that this server has no answer for, as `METHOD /path`. Each test + * expects none. A read left unanswered fails late, after its retry about a second on, and what it + * draws then moves the screen: Working together's "Couldn't load" pushed Version history down + * under a press on Earlier versions, which never opened (WebKit on CI). + */ + unanswered: string[] = []; sharing(): ArtifactSharing { const shared = this.everywhere(); @@ -247,6 +255,37 @@ class World { return { status: 200, json: { capabilities: [], nextCursor: null } }; if (path === NETWORK_POLICIES_PATH) return { status: 200, json: { networkPolicies: [], nextCursor: null } }; + // Working together, the section of Admin, Artifacts between Sharing and Version history. + if (path === `${ORGANIZATION}/settings/artifact-collaboration`) { + if (method === "PATCH") + this.collaboration = { + ...this.collaboration, + ...(request.postDataJSON() as object), + }; + return { status: 200, json: this.collaboration }; + } + // Admin's rail: no request waiting, and no managed updates, in the server's own words. + if (path === `${ORGANIZATION}/app-access-requests`) + return { + status: 200, + json: { appAccessRequests: [], nextCursor: null }, + }; + if (path === `${ORGANIZATION}/management`) + return { + status: 404, + json: { + type: "https://open.bot/errors/management-unavailable", + title: "Managed updates aren't available here.", + status: 404, + detail: "Managed updates aren't available for this OpenBot.", + code: "MANAGEMENT_UNAVAILABLE", + category: "not_found", + retryable: false, + requestId: "req_test", + traceId: "trace_test", + }, + }; + this.unanswered.push(`${method} ${path}`); return { status: 404, json: { detail: "Not found." } }; } } @@ -514,7 +553,12 @@ describe.skipIf(!asked)("artifact sharing screens", () => { engine, theme, window, - (one) => one.getByText("Outside invitations").waitFor(), + // The page whole, as a person sees it: Sharing, and Working together under it, whose + // row sits above Version history, so nothing lands later and moves Earlier versions. + async (one) => { + await one.getByText("Outside invitations").waitFor(); + await one.getByText("Show who has an artifact open").waitFor(); + }, ); try { await look(page, `admin-artifacts-${tag}`); @@ -551,14 +595,16 @@ describe.skipIf(!asked)("artifact sharing screens", () => { .waitFor(); await restyle(page); await look(page, `admin-artifacts-retention-${tag}`); + expect(world.unanswered).toEqual([]); } finally { await page.close(); } }, 60_000); test(`Admin, Permissions in the same frame for comparison, in ${tag}`, async () => { + const world = new World(); const page = await open( - new World(), + world, "/admin/permissions", engine, theme, @@ -572,14 +618,16 @@ describe.skipIf(!asked)("artifact sharing screens", () => { path: join(shots, `admin-permissions-${tag}.png`), }); } + expect(world.unanswered).toEqual([]); } finally { await page.close(); } }, 60_000); test(`the Share dialog opened from the artifact panel dims the panel and shows its whole title, in ${tag}`, async () => { + const world = new World(); const page = await open( - new World(), + world, "/share-panel", engine, theme, @@ -598,14 +646,16 @@ describe.skipIf(!asked)("artifact sharing screens", () => { titleText: "Share “Coffee subscription launch plan”", bodySideways: false, }); + expect(world.unanswered).toEqual([]); } finally { await page.close(); } }, 60_000); test(`an owner reads the Share dialog, in ${tag}`, async () => { + const world = new World(); const page = await open( - new World(), + world, "/share", engine, theme, @@ -632,6 +682,7 @@ describe.skipIf(!asked)("artifact sharing screens", () => { expect( await page.locator("[data-slot=share-no-public-address]").count(), ).toBe(0); + expect(world.unanswered).toEqual([]); } finally { await page.close(); } @@ -697,6 +748,7 @@ describe.skipIf(!asked)("artifact sharing screens", () => { path: join(shots, `share-dialog-desktop-audience-${tag}.png`), }); } + expect(world.unanswered).toEqual([]); } finally { await page.close(); }