Update onboarding navigation coverage

Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
This commit is contained in:
morgmart
2026-07-29 09:36:30 -07:00
parent 917a7aefc4
commit 04de530ef1
3 changed files with 24 additions and 17 deletions

View File

@@ -531,15 +531,20 @@ export function DefaultConfigStep({
() => getVisibleOnboardingRuntimes(runtimesQuery.data ?? []),
[runtimesQuery.data],
);
const selectedRuntime = visibleRuntimes.find(
(runtime) => runtime.id === selectedRuntimeId,
);
const { data: runtimeFileConfig, isLoading: runtimeFileConfigLoading } =
useRuntimeFileConfigQuery(selectedRuntimeId ?? "", {
enabled: Boolean(selectedRuntimeId),
});
const [config, setConfig] =
React.useState<GlobalAgentConfig>(EMPTY_GLOBAL_CONFIG);
// Reopening machine config from the first-community flow starts directly on
// this page, without a chooser draft. Fall back to the persisted default so
// the same selected-harness setup renders instead of a missing-runtime state.
const effectiveSelectedRuntimeId =
selectedRuntimeId ?? config.preferred_runtime;
const selectedRuntime = visibleRuntimes.find(
(runtime) => runtime.id === effectiveSelectedRuntimeId,
);
const { data: runtimeFileConfig, isLoading: runtimeFileConfigLoading } =
useRuntimeFileConfigQuery(effectiveSelectedRuntimeId ?? "", {
enabled: Boolean(effectiveSelectedRuntimeId),
});
const [bakedEnv, setBakedEnv] = React.useState<BakedEnvEntry[]>([]);
const [isConfigLoading, setIsConfigLoading] = React.useState(true);
const [configValid, setConfigValid] = React.useState(false);
@@ -643,20 +648,20 @@ export function DefaultConfigStep({
}, [installMutation, runtimesQuery, selectedRuntime]);
const handleComplete = React.useCallback(async () => {
if (!selectedRuntimeId) return;
if (!effectiveSelectedRuntimeId) return;
setIsCompleting(true);
setCompletionError(null);
try {
await setGlobalAgentConfig({
...config,
preferred_runtime: selectedRuntimeId,
preferred_runtime: effectiveSelectedRuntimeId,
});
actions.complete();
} catch {
setCompletionError("Couldn't save your default harness. Try again.");
setIsCompleting(false);
}
}, [actions, config, selectedRuntimeId]);
}, [actions, config, effectiveSelectedRuntimeId]);
return (
<OnboardingSlideTransition

View File

@@ -677,7 +677,7 @@ test("onboarding setup More-harnesses click navigates to Settings → Agents", a
// Now on the setup page.
await expect(
page.getByRole("heading", { name: "Set up your agent harnesses" }),
page.getByRole("heading", { name: "Choose your default harness" }),
).toBeVisible({ timeout: 10_000 });
// Click the "More harnesses" link — fires navigateToAgentSettings.

View File

@@ -1177,6 +1177,12 @@ test("first-community shows the scenario cards for localhost", async ({
await installMockBridge(
page,
{
globalAgentConfig: {
env_vars: {},
provider: null,
model: null,
preferred_runtime: "claude",
},
acpRuntimesCatalog: [
{
id: "claude",
@@ -1220,13 +1226,9 @@ test("first-community shows the scenario cards for localhost", async ({
await page.getByTestId("welcome-setup-back").click();
await expect(page.getByTestId("onboarding-page-config")).toBeVisible();
await expect(
page.getByRole("heading", {
name: "Configure your default model settings",
}),
page.getByRole("heading", { name: "Set up Claude Code" }),
).toBeVisible();
await expect(page.getByTestId("global-agent-default-harness")).toHaveText(
"Claude Code",
);
await expect(page.getByText(/Claude Code is ready/i)).toBeVisible();
await expect(page.getByTestId("onboarding-finish")).toBeEnabled();
});