fix(qq): clarify QR binding states and setup actions (#6340)

* fix(qq): clarify QR binding states and setup actions

* fix(qq): confirm rebinding instead of showing a persistent warning

* fix(qq): make rebind credential warning conditional

* docs(qq): align rebind guide with conditional warning
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-22 01:55:20 +08:00
1 parent 51a0fc83a2
commit 130f4edefe
27 files changed
+634 -168

No files matched your search

+11 -7
View File
@@ -239,16 +239,20 @@ it("previews QQ QR states and retries without connecting to the portal", async (
render(<Gallery />);
await screen.findByRole("heading", { name: "QQConnectFlowView · QQ QR connection" });
const preview = within(screen.getByRole("region", { name: "Component preview" }));
expect(await preview.findByRole("img", { name: "QQ login QR code" })).toBeVisible();
expect(await preview.findByRole("img", { name: "QQ binding QR code" })).toBeVisible();
await userEvent.click(preview.getByRole("button", { name: "Cancel" }));
expect(preview.queryByRole("img", { name: "QQ login QR code" })).not.toBeInTheDocument();
await userEvent.click(preview.getByRole("button", { name: "Connect" }));
expect(await preview.findByRole("img", { name: "QQ login QR code" })).toBeVisible();
expect(preview.queryByRole("img", { name: "QQ binding QR code" })).not.toBeInTheDocument();
await userEvent.click(preview.getByRole("button", { name: "Bind QQ bot" }));
expect(await preview.findByRole("img", { name: "QQ binding QR code" })).toBeVisible();
await userEvent.click(preview.getByRole("combobox", { name: "QQ connection state" }));
await userEvent.click(screen.getByRole("option", { name: "succeeded" }));
expect(preview.getByText("QQ is connected.")).toBeVisible();
expect(preview.getByText(/previous App Secret stops working/)).toBeVisible();
expect(preview.getByRole("button", { name: "Scan again" })).toBeVisible();
expect(preview.getByText("Configured")).toBeVisible();
expect(preview.queryByText(/Rebinding may interrupt other apps/)).not.toBeInTheDocument();
await userEvent.click(preview.getByRole("button", { name: "Rebind bot" }));
const confirmation = screen.getByRole("alertdialog", { name: "Rebind bot" });
expect(confirmation).toHaveTextContent("Rebinding may interrupt other apps using this QQ bot. If the App Secret is reset, the old secret becomes invalid and those apps need the new secret.");
await userEvent.click(within(confirmation).getByRole("button", { name: "Cancel" }));
expect(preview.getByText("Configured")).toBeVisible();
expect(fetch).toHaveBeenCalledTimes(1);
expect(fetch.mock.calls[0][0]).toBe("/__nanobot_components");
});