test(dashboard): reactivate webhook wizard coverage (#13844)

Co-authored-by: Paco Cartones <pacocartones@users.noreply.github.com>
This commit is contained in:
Paco Cartones
2026-09-17 22:15:58 +02:00
committed by GitHub
parent 44d1760c3a
commit 4be690736c
4 changed files with 12 additions and 14 deletions

View File

@@ -67,13 +67,18 @@ function t(key: string): string {
function getButton(text: string): HTMLButtonElement | null {
return (
(Array.from(document.querySelectorAll("button")).find((b) => b.textContent?.includes(text)) as
| HTMLButtonElement
| undefined) ?? null
HTMLButtonElement | undefined) ?? null
);
}
const roots: Array<{ unmount: () => void }> = [];
beforeEach(() => {
(
globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean }
).IS_REACT_ACT_ENVIRONMENT = true;
});
afterEach(() => {
roots.forEach((r) => {
act(() => r.unmount());
@@ -233,6 +238,11 @@ describe("AddWebhookWizard — step 2→3 creates webhook with correct kind", ()
renderIntoBody(<AddWebhookWizard isOpen={true} onClose={vi.fn()} onCreated={vi.fn()} t={t} />);
// Let the wizard's open/reset effect settle before interacting with step 1.
await act(async () => {
await Promise.resolve();
});
// Step 1: default is "slack", click Next
const nextBtn1 = getButton("Next");
expect(nextBtn1).toBeTruthy();