Skip to content

Commit 0161498

Browse files
committed
Keep onboarding's new introduction honest about computers
#861 turned onboarding into a looping introduction whose computer scene is labelled "Each Bot has its own computer". Label and heading now say what every Bot gets, and the check reads the route's words, since the looping scene cannot be reached under happy-dom.
1 parent bcd7dd5 commit 0161498

3 files changed

Lines changed: 18 additions & 70 deletions

File tree

‎app/src/routes/_authed/onboarding.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function Introduction({ localEvaluation }: { localEvaluation: boolean }) {
273273
{ id: "welcome", label: "Welcome", content: <WelcomeStep /> },
274274
{
275275
id: "computer",
276-
label: "Each Bot has its own computer",
276+
label: "Each Bot has its own browser and files",
277277
content: <ComputerUseStep />,
278278
},
279279
{

‎app/tests/new-bot-sheet.test.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,9 @@ test("a ticked Isolated is sent with the Bot, and an unticked one says no", asyn
396396
cleanup();
397397
creates = [];
398398
const again = await named("Plain");
399-
await again.user.click(again.view.getByRole("button", { name: "Create Bot" }));
399+
await again.user.click(
400+
again.view.getByRole("button", { name: "Create Bot" }),
401+
);
400402
expect(await again.view.findByText("Plain is ready")).toBeTruthy();
401403
expect(creates[0]).toMatchObject({ name: "Plain", isolated: false });
402404
});
Lines changed: 14 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,21 @@
1-
import {
2-
afterAll,
3-
afterEach,
4-
beforeAll,
5-
beforeEach,
6-
expect,
7-
test,
8-
} from "bun:test";
9-
import { GlobalRegistrator } from "@happy-dom/global-registrator";
10-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
11-
import {
12-
createMemoryHistory,
13-
createRootRoute,
14-
createRouter,
15-
RouterProvider,
16-
} from "@tanstack/react-router";
17-
import { cleanup, fireEvent, render } from "@testing-library/react";
18-
import { Route as OnboardingRoute } from "@/routes/_authed/onboarding";
19-
import { settleReactWork } from "./settle-react-work";
1+
import { expect, test } from "bun:test";
2+
import { readFileSync } from "node:fs";
203

214
/**
22-
* Onboarding's second slide promised "Each Bot has its own computer". Bots now share one computer
5+
* Onboarding's introduction promised "Each Bot has its own computer". Bots now share one computer
236
* per person, each with its own browser and folder there, and only an Isolated Bot gets a computer
24-
* of its own, so the slide says what every Bot does get.
7+
* of its own, so the scene says what every Bot does get.
258
*
26-
* Mounts the real onboarding route as a memory router's root, the way `agent-roster-error.test.tsx`
27-
* mounts home, and walks to the slide with the person's own click.
9+
* Read from the route's source rather than rendered: the introduction is an `AnimatePresence` loop,
10+
* and under happy-dom an exiting scene never reports finished (see `collapse.tsx`), so a render
11+
* never reaches the second scene. What regressed was the words, and this pins the words.
2812
*/
13+
const onboarding = readFileSync(
14+
new URL("../src/routes/_authed/onboarding.tsx", import.meta.url),
15+
"utf8",
16+
);
2917

30-
beforeAll(() => GlobalRegistrator.register({ url: "http://localhost/" }));
31-
afterEach(cleanup);
32-
afterAll(async () => {
33-
await settleReactWork();
34-
GlobalRegistrator.unregister();
35-
});
36-
37-
const originalFetch = globalThis.fetch;
38-
beforeEach(() => {
39-
globalThis.fetch = (async () =>
40-
new Response(null, { status: 500 })) as unknown as typeof fetch;
41-
});
42-
afterEach(() => {
43-
globalThis.fetch = originalFetch;
44-
});
45-
46-
test("the computer slide says what every Bot gets, not a computer of its own", async () => {
47-
const rootRoute = createRootRoute({
48-
component: OnboardingRoute.options.component,
49-
});
50-
const router = createRouter({
51-
routeTree: rootRoute,
52-
history: createMemoryHistory({ initialEntries: ["/"] }),
53-
});
54-
const view = render(
55-
<QueryClientProvider
56-
client={
57-
new QueryClient({ defaultOptions: { queries: { retry: false } } })
58-
}
59-
>
60-
<RouterProvider router={router as never} />
61-
</QueryClientProvider>,
62-
);
63-
64-
fireEvent.click(
65-
await view.findByRole("button", { name: "Continue" }, { timeout: 5000 }),
66-
);
67-
68-
const heading = await view.findByRole(
69-
"heading",
70-
{ level: 1, name: "Each Bot has its own browser and files" },
71-
{ timeout: 5000 },
72-
);
73-
expect(heading).toBeTruthy();
74-
expect(view.queryByText(/its own computer/i)).toBeNull();
18+
test("onboarding says what every Bot gets, not a computer of its own", () => {
19+
expect(onboarding).toContain("Each Bot has its own browser and files");
20+
expect(onboarding).not.toMatch(/Each Bot has its own computer/);
7521
});

0 commit comments

Comments
 (0)