feat(webui): improve setup flows across chat channels (NAN-112) (#5356)
* feat(webui): improve channel setup flows * fix(webui): refine channel setup interactions (NAN-112) * fix(webui): keep email setup sections channel-owned * fix(webui): remove concrete channel details from shared components * refactor(webui): remove unused channel setup resources * fix(webui): finish channel-owned setup boundaries * fix(webui): update channel switches optimistically * test(channels): remove obsolete absence assertions * fix(webui): flatten channel instance settings disclosure * fix(webui): complete channel setup and connection flows * fix(whatsapp): wait for session database release * fix(webui): preserve scrolling channel controls * fix(webui): stage channel connection checks * fix(channels): align verification actions * fix(email): expose connection checks * fix(webui): align channel field actions * fix(email): verify account credentials * fix(wecom): bypass system proxy for websocket * fix(channels): stabilize async connection cleanup * fix(webui): autosave channel credentials * fix(email): make provider presets non-destructive * test(weixin): isolate persisted QR credentials
This commit is contained in:
1 parent
3cc3012b3a
commit
e8a29a0087
291 files changed
+12194
-3979
No files matched your search
@@ -162,7 +162,7 @@ describe("Settings system domains", () => {
|
||||
expect(screen.getByTestId("settings-section-transition")).not.toHaveClass("settings-feature-page");
|
||||
});
|
||||
|
||||
it("does not show the Settings kicker on the standalone Automations surface", async () => {
|
||||
it("opens a chat from the standalone automations empty state", async () => {
|
||||
const onBackToChat = vi.fn();
|
||||
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
|
||||
const url = String(input);
|
||||
@@ -389,7 +389,7 @@ describe("Settings system domains", () => {
|
||||
expect(screen.getByRole("button", { name: "MCP" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows nanobot optional features and enables one", async () => {
|
||||
it("installs optional channel support before enabling and disabling it", async () => {
|
||||
const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
|
||||
const url = String(input);
|
||||
if (url === "/api/settings") return jsonResponse(settingsPayload());
|
||||
@@ -403,6 +403,7 @@ describe("Settings system domains", () => {
|
||||
webui: "webui/index.ts",
|
||||
type: "channel",
|
||||
enabled: false,
|
||||
configured: true,
|
||||
installed: false,
|
||||
ready: false,
|
||||
status: "missing_dependency",
|
||||
@@ -415,25 +416,31 @@ describe("Settings system domains", () => {
|
||||
return { ok: false, status: 404, json: async () => ({}) } as Response;
|
||||
});
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
requestMutationMock.mockImplementation(async (action: string) => {
|
||||
requestMutationMock.mockImplementation(async (action: string, values: Record<string, unknown>) => {
|
||||
if (action === "settings.feature.enable") {
|
||||
const enabled = values.install_only !== true;
|
||||
return {
|
||||
features: [{
|
||||
name: "matrix",
|
||||
display_name: "Matrix",
|
||||
webui: "webui/index.ts",
|
||||
type: "channel",
|
||||
enabled: true,
|
||||
running: true,
|
||||
runtime_status: "running",
|
||||
enabled,
|
||||
running: enabled,
|
||||
runtime_status: enabled ? "running" : "stopped",
|
||||
configured: true,
|
||||
installed: true,
|
||||
ready: true,
|
||||
status: "enabled",
|
||||
status: enabled ? "enabled" : "not_enabled",
|
||||
install_supported: true,
|
||||
requires_restart: true,
|
||||
}],
|
||||
enabled_count: 1,
|
||||
last_action: { ok: true, message: "Enabled channel 'matrix'", enabled: true },
|
||||
enabled_count: enabled ? 1 : 0,
|
||||
last_action: {
|
||||
ok: true,
|
||||
message: enabled ? "Enabled channel 'matrix'" : "Installed support for channel 'matrix'",
|
||||
enabled,
|
||||
},
|
||||
};
|
||||
}
|
||||
if (action === "settings.feature.disable") {
|
||||
@@ -463,13 +470,23 @@ describe("Settings system domains", () => {
|
||||
const matrixRow = await screen.findByRole("button", { name: "View Matrix settings" });
|
||||
expect(matrixRow).toHaveAttribute("aria-haspopup", "dialog");
|
||||
fireEvent.click(matrixRow);
|
||||
expect(screen.getByRole("heading", { name: "Matrix", exact: true })).toBeVisible();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Close", exact: true }));
|
||||
fireEvent.click(screen.getByRole("switch", { name: "Matrix channel" }));
|
||||
expect(screen.getByRole("dialog", { name: "Install support for Matrix?" })).toBeInTheDocument();
|
||||
expect(screen.getByText("nanobot will add what Matrix needs, then turn it on. Continue?")).toBeInTheDocument();
|
||||
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("switch", { name: "Matrix channel" })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Install Matrix" })).toHaveFocus();
|
||||
expect(requestMutationMock).not.toHaveBeenCalled();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Install and enable" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Install Matrix" }));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(requestMutationMock).toHaveBeenCalledWith(
|
||||
"settings.feature.enable",
|
||||
{ name: "matrix", install_only: true },
|
||||
150_000,
|
||||
),
|
||||
);
|
||||
const matrixToggle = await screen.findByRole("switch", { name: "Matrix channel" });
|
||||
expect(matrixToggle).toHaveAttribute("aria-checked", "false");
|
||||
expect(requestMutationMock).toHaveBeenCalledTimes(1);
|
||||
fireEvent.click(matrixToggle);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(requestMutationMock).toHaveBeenCalledWith(
|
||||
|
||||
Reference in new issue
Block a user