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
@@ -0,0 +1,68 @@
|
||||
import { act, cleanup, render, screen } from "@testing-library/react";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { AutomationsSettings } from "@/components/settings/system/AutomationsSettings";
|
||||
import i18n from "@/i18n";
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
function renderAutomations(channel: string) {
|
||||
return render(
|
||||
<AutomationsSettings
|
||||
payload={{ jobs: [{
|
||||
id: "task-1",
|
||||
name: "Scheduled task",
|
||||
enabled: true,
|
||||
schedule: { kind: "every", every_ms: 60_000 },
|
||||
payload: { message: "Summarize updates" },
|
||||
state: {},
|
||||
origin: { channel },
|
||||
}] }}
|
||||
loading={false}
|
||||
query=""
|
||||
filter="all"
|
||||
sort="name"
|
||||
actionKey={null}
|
||||
error={null}
|
||||
onQueryChange={vi.fn()}
|
||||
onFilterChange={vi.fn()}
|
||||
onSortChange={vi.fn()}
|
||||
onAction={vi.fn()}
|
||||
onRequestEdit={vi.fn()}
|
||||
onRequestDelete={vi.fn()}
|
||||
onBackToChat={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
describe("automation channel identity", () => {
|
||||
it("uses channel-owned names in the list and details when the language changes", async () => {
|
||||
renderAutomations("email");
|
||||
expect(screen.getAllByText("Email")).toHaveLength(2);
|
||||
|
||||
for (const [locale, name] of [
|
||||
["zh-CN", "电子邮件"],
|
||||
["ja", "メール"],
|
||||
["es", "Correo electrónico"],
|
||||
]) {
|
||||
await act(() => i18n.changeLanguage(locale));
|
||||
expect(screen.getAllByText(name)).toHaveLength(2);
|
||||
expect(screen.queryByText("Email")).not.toBeInTheDocument();
|
||||
}
|
||||
});
|
||||
|
||||
it("resolves aliases through the owning channel namespace", async () => {
|
||||
await i18n.changeLanguage("zh-CN");
|
||||
renderAutomations("wechat");
|
||||
expect(screen.getAllByText("微信")).toHaveLength(2);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["api", "API"],
|
||||
["cli", "CLI"],
|
||||
["extension-chat", "extension-chat"],
|
||||
])("preserves the label for %s", (channel, label) => {
|
||||
renderAutomations(channel);
|
||||
expect(screen.getAllByText(label)).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user