Open History to see the last commit
1import "../../index.css";
2
3import { page } from "vite-plus/test/browser";
4import { beforeEach, describe, expect, it } from "vite-plus/test";
5import { render } from "vitest-browser-react";
6
7import {
8 finishRelayClientInstall,
9 readRelayClientInstallDialogState,
10 reportRelayClientInstallProgress,
11 requestRelayClientInstallConfirmation,
12 resetRelayClientInstallDialogForTests,
13} from "../../cloud/relayClientInstallDialog";
14import { RelayClientInstallDialog } from "./RelayClientInstallDialog";
15
16describe("RelayClientInstallDialog", () => {
17 beforeEach(() => {
18 resetRelayClientInstallDialogForTests();
19 });
20
21 it("confirms installation and renders streamed progress", async () => {
22 render(<RelayClientInstallDialog />);
23 const confirmation = requestRelayClientInstallConfirmation("2026.5.2");
24
25 await expect.element(page.getByText("Install relay client?")).toBeInTheDocument();
26 await expect.element(page.getByText(/version 2026\.5\.2 locally/)).toBeInTheDocument();
27
28 await page.getByRole("button", { name: "Download and install" }).click();
29 await expect(confirmation).resolves.toBe(true);
30 await expect
31 .element(page.getByRole("heading", { name: "Installing relay client" }))
32 .toBeInTheDocument();
33
34 reportRelayClientInstallProgress({ type: "progress", stage: "downloading" });
35 await expect.element(page.getByText("Downloading relay client")).toBeInTheDocument();
36 await expect
37 .element(page.getByRole("progressbar", { name: "Relay client installation progress" }))
38 .toHaveAttribute("value", "3");
39
40 finishRelayClientInstall();
41 expect(readRelayClientInstallDialogState().status).toBe("closing");
42 await expect
43 .element(page.getByRole("heading", { name: "Installing relay client" }))
44 .not.toBeInTheDocument();
45 expect(readRelayClientInstallDialogState()).toEqual({ status: "idle" });
46 });
47});