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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
test(ui): cover lazy center recovery gap
JPPhoto8588d3843585
diff --git a/invokeai/frontend/webv2/src/workbench/shell/CenterArea.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/shell/CenterArea.browser.test.tsxindex 389dc0fac1..c28b13d1db 100644--- a/invokeai/frontend/webv2/src/workbench/shell/CenterArea.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/shell/CenterArea.browser.test.tsx@@ -19,6 +19,11 @@ interface CenterAreaTestProject {}const centerAreaMocks = vi.hoisted(() => {+ let didRequestFloatedCenterModule = false;+ let resolveFloatedCenterModule!: () => void;+ const floatedCenterModulePending = new Promise<void>((resolve) => {+ resolveFloatedCenterModule = resolve;+ });const icon = () => null;// Use a settled resource so the center icon reads synchronously without suspending.const loadedImplementation = () => {@@ -59,10 +64,16 @@ const centerAreaMocks = vi.hoisted(() => {return {activeItem,+ didRequestFloatedCenterModule: () => didRequestFloatedCenterModule,dockFloating: vi.fn(),+ floatedCenterModulePending,focusFloating: vi.fn(),focusRegion: vi.fn(),project,+ requestFloatedCenterModule: () => {+ didRequestFloatedCenterModule = true;+ },+ resolveFloatedCenterModule: () => resolveFloatedCenterModule(),revealFloating: vi.fn(),};});@@ -125,6 +136,11 @@ vi.mock('@workbench/widget-frame', () => ({WidgetSourceLockBadge: () => null,useWidgetIntentPreloadProps: () => ({}),}));+vi.mock('./FloatedCenterView', async (importOriginal) => {+ centerAreaMocks.requestFloatedCenterModule();+ await centerAreaMocks.floatedCenterModulePending;+ return importOriginal();+});import { CenterArea } from './CenterArea';@@ -225,6 +241,22 @@ describe('CenterArea with its last view floating', () => {const button = (name: string) =>[...host!.querySelectorAll<HTMLButtonElement>('button')].find((candidate) => candidate.textContent === name);+ it('keeps the center recovery controls available while their lazy chunk loads', async () => {+ floatLastView();+ await render(<CenterArea />);++ try {+ await vi.waitFor(() => expect(centerAreaMocks.didRequestFloatedCenterModule()).toBe(true));+ expect(host?.textContent).toContain('Preview is in a floating window');+ expect(button('Show window')).not.toBeUndefined();+ } finally {+ act(() => {+ centerAreaMocks.resolveFloatedCenterModule();+ });+ await vi.waitFor(() => expect(host?.textContent).toContain('Preview is in a floating window'));+ }+ });+it('says where the view went and offers both ways back, instead of calling it unavailable', async () => {floatLastView();await render(<CenterArea />);