fix(app): make settings navigation deterministic

Settings detail screens must return to their logical parent regardless of the route used to enter them. Keep compact navigation in the header while preserving the desktop project-list affordance.
This commit is contained in:
Mohamed Boudra
2026-08-16 19:14:05 +02:00
parent 97ac967495
commit ac7796035d
8 changed files with 173 additions and 68 deletions
@@ -45,12 +45,19 @@ import {
unblockPaseoConfigWrites,
} from "../support/helpers/project-settings";
import { gotoAppShell } from "../support/helpers/app";
import { openCompactSettings } from "../support/helpers/settings";
import {
addProjectFlowInput,
chooseAddProjectMethod,
openAddProjectFlow,
} from "../support/helpers/add-project-flow";
import { createTempGitRepo } from "../support/helpers/workspace";
import {
buildOpenProjectRoute,
buildProjectsSettingsRoute,
buildSettingsRoute,
} from "@/utils/host-routes";
import { getServerId } from "../support/helpers/server-id";
const updatedSetup = ["npm install", "npm run build"];
@@ -321,6 +328,33 @@ test.describe("Projects settings", () => {
});
});
test.describe("Projects settings — compact navigation", () => {
test.use({ viewport: { width: 390, height: 844 } });
test("project Back returns through Projects and Settings without reopening the project", async ({
page,
editableProject,
}) => {
await gotoAppShell(page);
await openCompactSettings(page, buildOpenProjectRoute());
await page.getByRole("button", { name: "Projects", exact: true }).click();
await expect(page).toHaveURL(buildProjectsSettingsRoute(getServerId()));
await openProjectSettings(page, editableProject.name);
await expect(page.getByRole("button", { name: "Back", exact: true })).toHaveCount(1);
await expect(page.getByRole("button", { name: "Back to projects", exact: true })).toHaveCount(
0,
);
await page.getByRole("button", { name: "Back", exact: true }).click();
await expect(page).toHaveURL(buildProjectsSettingsRoute(getServerId()));
await page.getByRole("button", { name: "Back", exact: true }).click();
await expect(page).toHaveURL(buildSettingsRoute());
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
});
});
test.describe("Projects settings — error UX", () => {
test("stale-write callout appears on save, disables save, and reload clears it", async ({
page,
@@ -2,6 +2,7 @@ import { test, expect } from "../support/fixtures";
import {
buildHostWorkspaceRoute,
buildOpenProjectRoute,
buildSettingsHostSectionRoute,
buildSettingsRoute,
buildSettingsSectionRoute,
} from "@/utils/host-routes";
@@ -181,6 +182,28 @@ test.describe("Settings — compact master-detail", () => {
await expectSettingsSidebarVisible(page);
});
test("host picker settings opens Overview and backs through the settings list", async ({
page,
withWorkspace,
}) => {
const workspace = await withWorkspace({ prefix: "host-picker-settings-back-" });
const workspaceRoute = buildHostWorkspaceRoute(getServerId(), workspace.workspaceId);
await openWorkspace(page, workspace);
await page.getByRole("button", { name: "Open menu", exact: true }).click();
await page.getByTestId("sidebar-hosts-trigger").click();
await page.getByRole("button", { name: /Open .* settings/ }).click();
await expectAppRoute(page, buildSettingsHostSectionRoute(getServerId(), "host"));
await expect(page.getByText("Overview", { exact: true })).toBeVisible();
await goBackInSettings(page);
await expectCompactSettingsList(page);
await goBackInSettings(page);
await expectAppRoute(page, workspaceRoute);
});
test("switching the host picker on the settings list scopes host rows without navigating", async ({
page,
}) => {