Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

test(webv2): await deletion dialog focus

joshistoastf30bd00547e4
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/useDeletionConfirmation.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/image-actions/useDeletionConfirmation.browser.test.tsx
index c384092629..63a4a89352 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/useDeletionConfirmation.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/useDeletionConfirmation.browser.test.tsx
@@ -142,7 +142,11 @@ describe('useDeletionConfirmation', () => {
await act(() => {
request = confirmationRef.current!.requestDeletionConfirmation(imageRefs, executeDeletion);
});
- await vi.waitFor(() => expect(document.querySelector('[role="alertdialog"][data-state="open"]')).not.toBeNull());
+ await vi.waitFor(() =>
+ expect(document.querySelector('[role="alertdialog"][data-state="open"]')?.contains(document.activeElement)).toBe(
+ true
+ )
+ );
await act(() => userEvent.keyboard('{Escape}'));
await vi.waitFor(() => expect(document.querySelector('[role="alertdialog"][data-state="open"]')).toBeNull());
await request;