feat: make Research tabs closable and preserve workspace navigation
This commit is contained in:
@@ -348,9 +348,17 @@ test("keeps browser conversation selection independent and restores it on reload
|
||||
await researchPage.goTo(`?run=${first}`, { waitUntil: "domcontentloaded" });
|
||||
await workspacePage.showResearch();
|
||||
const history = page.getByRole("navigation", { name: "Chat history" });
|
||||
const firstTab = history.getByRole("button", { name: "Browser one conversation" });
|
||||
const secondTab = history.getByRole("button", { name: "Browser two conversation" });
|
||||
const firstTab = history.getByRole("button", { name: "Browser one conversation", exact: true });
|
||||
const secondTab = history.getByRole("button", {
|
||||
name: "Browser two conversation",
|
||||
exact: true,
|
||||
});
|
||||
await expect(firstTab).toHaveAttribute("aria-current", "page");
|
||||
await expect(firstTab).toHaveCSS("transition-duration", "0s");
|
||||
await firstTab.hover();
|
||||
await page.mouse.down();
|
||||
await expect(firstTab).toHaveCSS("translate", "none");
|
||||
await page.mouse.up();
|
||||
await workspacePage.showDeckManagement();
|
||||
await secondTab.click();
|
||||
await expect(page).toHaveURL(new RegExp(`run=${second}`));
|
||||
@@ -358,6 +366,19 @@ test("keeps browser conversation selection independent and restores it on reload
|
||||
await expect(researchPage.conversation).toContainText("Browser two conversation");
|
||||
await page.goBack();
|
||||
await expect(firstTab).toHaveAttribute("aria-current", "page");
|
||||
await history
|
||||
.getByRole("button", { name: "Close Browser two conversation", exact: true })
|
||||
.click();
|
||||
await expect(secondTab).toHaveCount(0);
|
||||
await expect(firstTab).toHaveAttribute("aria-current", "page");
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
await workspacePage.showResearch();
|
||||
await expect(secondTab).toHaveCount(0);
|
||||
await history.getByRole("button", { name: "Open chat history" }).click();
|
||||
await page.getByRole("menuitem", { name: "Browser two conversation", exact: true }).click();
|
||||
await expect(secondTab).toHaveAttribute("aria-current", "page");
|
||||
await expect(researchPage.conversation).toContainText("Browser two conversation");
|
||||
await firstTab.click();
|
||||
await secondResearch.goTo(`?run=${second}`, {
|
||||
waitUntil: "domcontentloaded",
|
||||
});
|
||||
|
||||
@@ -18,14 +18,19 @@ test("keeps the sidebar, composer and deck reachable at compact widths", async (
|
||||
const historyBounds = await history.boundingBox();
|
||||
const chatBounds = await chat.boundingBox();
|
||||
if (!historyBounds || !chatBounds) throw new Error("Chat and history must have visible bounds");
|
||||
expect(historyBounds.x).toBe(0);
|
||||
expect(historyBounds.x).toBe(chatBounds.x);
|
||||
const navigationMark = await page
|
||||
.getByRole("img", { name: "Workspace", exact: true })
|
||||
.boundingBox();
|
||||
if (!navigationMark) throw new Error("Workspace navigation must be visible");
|
||||
expect(navigationMark.y).toBeLessThan(historyBounds.y + historyBounds.height);
|
||||
const availableWidth =
|
||||
width < 768
|
||||
? await page
|
||||
.getByRole("dialog", { name: "Workspace" })
|
||||
.evaluate((element) => element.clientWidth)
|
||||
: width;
|
||||
expect(historyBounds.width).toBe(availableWidth);
|
||||
expect(historyBounds.width).toBe(availableWidth - chatBounds.x);
|
||||
expect(historyBounds.y + historyBounds.height).toBeLessThanOrEqual(chatBounds.y);
|
||||
const composer = researchPage.composer;
|
||||
await expect(composer).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user