fix: keep created workbench session active
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { expect, fakeServerState, gotoWorkbench, test } from "../fixtures/test";
|
||||
import { selectors } from "../fixtures/selectors";
|
||||
import { selectors, sessionTab } from "../fixtures/selectors";
|
||||
|
||||
test("new optimistic session first turn does not submit local thr_* as upstream thread", async ({ page }) => {
|
||||
await gotoWorkbench(page);
|
||||
@@ -51,6 +51,27 @@ test.describe("server authoritative session create", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("session create while old route is still loading", () => {
|
||||
test.use({ scenarioId: "create-while-route-loading" });
|
||||
|
||||
test("created session owns URL, active tab, and composer while old running session refreshes", async ({ page }) => {
|
||||
await gotoWorkbench(page, "/workbench/sessions/ses_running");
|
||||
|
||||
const created = page.waitForResponse((response) => response.request().method() === "POST" && new URL(response.url()).pathname === "/v1/agent/sessions");
|
||||
await page.locator(selectors.sessionCreate).click();
|
||||
expect((await created).status()).toBe(201);
|
||||
|
||||
await expect(page).toHaveURL(/\/workbench\/sessions\/ses_created_while_running/u, { timeout: 500 });
|
||||
await expect(page.locator(sessionTab("ses_created_while_running"))).toHaveAttribute("data-active", "true");
|
||||
await expect(page.locator(sessionTab("ses_running"))).toHaveAttribute("data-active", "false");
|
||||
await expect(page.locator(sessionTab("ses_running"))).toHaveAttribute("data-running", "true");
|
||||
await expect(page.locator(selectors.commandSend)).toHaveAttribute("data-action", "turn");
|
||||
|
||||
const state = await fakeServerState(page);
|
||||
expect((state.legacyRequestLedger as unknown[]).length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("session create and delete authority", () => {
|
||||
test.use({ scenarioId: "server-authoritative-create" });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user