Fix removed host routes getting stuck connecting

This commit is contained in:
Mohamed Boudra
2026-06-09 18:06:48 +07:00
parent c5bcec5c71
commit e53d26699f
6 changed files with 115 additions and 12 deletions
+12
View File
@@ -180,6 +180,18 @@ export async function goBackInSettings(page: Page): Promise<void> {
await page.getByRole("button", { name: "Back", exact: true }).click();
}
export async function closeCompactSettings(page: Page): Promise<void> {
await goBackInSettings(page);
await expect(page).not.toHaveURL(/\/settings(\/|$)/);
}
export async function removeCurrentHostFromSettings(page: Page): Promise<void> {
await page.getByTestId("host-page-remove-host-button").click();
await expect(page.getByTestId("remove-host-confirm-modal")).toBeVisible();
await page.getByTestId("remove-host-confirm").click();
await expect(page).toHaveURL(/\/settings$/);
}
export async function expectSettingsBackButton(page: Page): Promise<void> {
await expect(page.getByRole("button", { name: "Back", exact: true })).toBeVisible();
}
@@ -1,7 +1,9 @@
import { test, expect } from "./fixtures";
import { buildHostWorkspaceRoute } from "@/utils/host-routes";
import { gotoAppShell, openSettings } from "./helpers/app";
import { getE2EDaemonPort } from "./helpers/daemon-port";
import {
closeCompactSettings,
openSettingsSection,
expectSettingsHeader,
openAddHostFlow,
@@ -31,9 +33,18 @@ import {
selectSettingsHost,
expectSettingsHostPickerLabel,
openSettingsHostSection,
removeCurrentHostFromSettings,
} from "./helpers/settings";
import { getServerId } from "./helpers/server-id";
async function openWorkspace(
page: import("@playwright/test").Page,
workspace: { workspaceId: string },
) {
await page.goto(buildHostWorkspaceRoute(getServerId(), workspace.workspaceId));
await expect(page.getByTestId("menu-button")).toBeVisible();
}
test.describe("Settings sidebar navigation", () => {
test("clicking a sidebar section updates the URL and renders the section", async ({ page }) => {
await gotoAppShell(page);
@@ -187,4 +198,20 @@ test.describe("Settings — compact master-detail", () => {
await openSettingsHostSection(page, secondaryServerId, "connections");
});
test("removing the last active host returns to welcome after settings closes", async ({
page,
withWorkspace,
}) => {
const workspace = await withWorkspace({ prefix: "remove-host-compact-" });
await openWorkspace(page, workspace);
await openCompactSettings(page);
await openSettingsHostSection(page, getServerId(), "host");
await removeCurrentHostFromSettings(page);
await closeCompactSettings(page);
await expect(page).toHaveURL(/\/welcome$/);
await expect(page.getByTestId("welcome-direct-connection")).toBeVisible();
});
});