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): trim redundant browser coverage

joshistoast49d697bea936
diff --git a/invokeai/frontend/webv2/src/app/GalleryImageActionsBridge.browser.test.tsx b/invokeai/frontend/webv2/src/app/GalleryImageActionsBridge.browser.test.tsx
index fed38cf7a8..2e37bdf02b 100644
--- a/invokeai/frontend/webv2/src/app/GalleryImageActionsBridge.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/app/GalleryImageActionsBridge.browser.test.tsx
@@ -1,17 +1,15 @@
/* oxlint-disable react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-new-object-as-prop */
import type { GalleryImageItem, GalleryItemRef } from '@features/gallery/contracts';
-import type { GalleryItemActions, GalleryItemContextMenuTarget } from '@features/gallery/react';
-import type { ReactNode, Ref } from 'react';
+import type { GalleryItemContextMenuTarget } from '@features/gallery/react';
+import type { ReactNode } from 'react';
-import { useGalleryItemActions } from '@features/gallery/ui/GalleryUiContext';
-import { act, createRef, useImperativeHandle } from 'react';
+import { act } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { GalleryImageContextMenu, GalleryItemActionsAdapter } from './GalleryImageActionsBridge';
const mocks = vi.hoisted(() => ({
- moveItemsToBoard: vi.fn(),
requestDeletionConfirmation: vi.fn(),
useImageActions: vi.fn(),
}));
@@ -45,7 +43,7 @@ vi.mock('@workbench/image-actions', () => ({
downloadItem: vi.fn(),
downloadItems: vi.fn(),
moveImagesToBoard: vi.fn(),
- moveItemsToBoard: mocks.moveItemsToBoard,
+ moveItemsToBoard: vi.fn(),
openItemInNewTab: vi.fn(),
openItemInPreview: vi.fn(),
setItemsStarred: vi.fn(),
@@ -75,15 +73,8 @@ const noop = vi.fn();
let host: HTMLDivElement | null = null;
let root: Root | null = null;
-const actionsRef = createRef<GalleryItemActions>();
(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
-const ActionsProbe = ({ ref }: { ref: Ref<GalleryItemActions> }) => {
- const actions = useGalleryItemActions();
- useImperativeHandle(ref, () => actions, [actions]);
- return null;
-};
-
const render = async (children: ReactNode) => {
await act(() => {
root?.render(children);
@@ -110,7 +101,7 @@ describe('GalleryImageActionsBridge mixed selection boundaries', () => {
it('wires the shared deletion-confirmation gate into the actions adapter', async () => {
await render(
<GalleryItemActionsAdapter boards={[]} generateValues={{}} projectId="project-1">
- <ActionsProbe ref={actionsRef} />
+ <span />
</GalleryItemActionsAdapter>
);
@@ -141,39 +132,4 @@ describe('GalleryImageActionsBridge mixed selection boundaries', () => {
})
);
});
-
- it('forwards an ordered mixed board move through the common action port', async () => {
- await render(
- <GalleryItemActionsAdapter boards={[]} generateValues={{}} projectId="project-1">
- <ActionsProbe ref={actionsRef} />
- </GalleryItemActionsAdapter>
- );
-
- await act(async () => {
- await actionsRef.current?.moveItemsToBoard(mixedRefs, 'board-b');
- });
-
- expect(mocks.moveItemsToBoard).toHaveBeenCalledWith(mixedRefs, 'board-b');
- });
-
- it('forwards the live gallery action context getter used by guarded delete successor selection', async () => {
- const getItemActionContext = vi.fn(() => null);
-
- await render(
- <GalleryItemActionsAdapter
- boards={[]}
- generateValues={{}}
- getItemActionContext={getItemActionContext}
- projectId="project-1"
- >
- <ActionsProbe ref={actionsRef} />
- </GalleryItemActionsAdapter>
- );
-
- expect(mocks.useImageActions).toHaveBeenCalledWith(
- expect.objectContaining({
- getItemActionContext,
- })
- );
- });
});
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardDragMonitor.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardDragMonitor.browser.test.tsx
index a5b1ce40cb..9b4b56bccd 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardDragMonitor.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardDragMonitor.browser.test.tsx
@@ -121,17 +121,6 @@ describe('GalleryBoardDragMonitor', () => {
expect(moveItemsToBoard).not.toHaveBeenCalled();
});
- it('restores collapse after an invalid drop', async () => {
- await renderMonitor(true);
- const dragData = getGalleryItemDragData([draggedRef]);
-
- dragStart(dragData);
- dragEnd(dragData, getGalleryBoardDropData('target-date', 'date'));
-
- expect(moveItemsToBoard).not.toHaveBeenCalled();
- expect(updateSettings).toHaveBeenLastCalledWith({ boardPanelCollapsed: true });
- });
-
it('restores collapse after cancellation', async () => {
await renderMonitor(true);
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx
index 9fb4eebcf5..7fb7f4135a 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx
@@ -167,19 +167,7 @@ describe('GalleryBoardsPanel', () => {
expect(text).toContain('GORL');
});
- it('keeps archived boards out of the main list', async () => {
- await renderPanel();
-
- const sections = Array.from(host?.querySelectorAll('[data-scope="collapsible"]') ?? []);
- const boardsSection = sections[0];
-
- expect(boardsSection?.textContent).toContain('dogs');
- expect(boardsSection?.textContent).not.toContain('GORL');
- });
-
it('marks the project board with a Project badge', async () => {
- // The fixture project used by the visual harness has no project board, so
- // this path is only reachable here.
await renderPanel({ ...createGallery(), projectBoardId: 'cats' } as GalleryStateView);
const catsRow = getBoardRows().find((row) => row.textContent?.includes('Cats'));
@@ -192,16 +180,9 @@ describe('GalleryBoardsPanel', () => {
const catsRow = getBoardRows().find((row) => row.textContent?.includes('Cats'));
- // Cats has 56 images, 0 videos, 3 assets.
expect(catsRow?.textContent).toContain('56 | 3');
});
- it('does not spend row width on creation dates', async () => {
- await renderPanel();
-
- expect(host?.textContent).not.toMatch(/\b\d{1,2} [A-Z][a-z]{2}\b/);
- });
-
it('marks the selected board for assistive tech', async () => {
await renderPanel();
@@ -220,28 +201,6 @@ describe('GalleryBoardsPanel', () => {
expect(dogsRow?.textContent).not.toContain('Alice Example');
});
- it('keeps the owner subtitle truncated and changes it from muted to selected contrast styling', async () => {
- await renderPanel();
-
- const unselectedOwner = Array.from(host?.querySelectorAll<HTMLElement>('*') ?? []).find(
- (element) => element.childElementCount === 0 && element.textContent === 'Alice Example'
- );
-
- expect(unselectedOwner).toBeDefined();
- expect(getComputedStyle(unselectedOwner!).overflow).toBe('hidden');
- expect(getComputedStyle(unselectedOwner!).textOverflow).toBe('ellipsis');
- const unselectedColor = getComputedStyle(unselectedOwner!).color;
-
- await renderPanel({ ...createGallery(), selectedBoardId: 'cats' } as GalleryStateView);
- const selectedOwner = Array.from(host?.querySelectorAll<HTMLElement>('*') ?? []).find(
- (element) => element.childElementCount === 0 && element.textContent === 'Alice Example'
- );
-
- expect(selectedOwner).toBeDefined();
- expect(getComputedStyle(selectedOwner!).color).not.toBe(unselectedColor);
- expect(host?.querySelector('[aria-current="true"]')?.textContent).toContain('Alice Example');
- });
-
it('shows the count for the active view and switches with the tab', async () => {
await renderPanel();
expect(host?.textContent).toContain('50');
@@ -304,16 +263,6 @@ describe('GalleryBoardsPanel', () => {
expect(actions.updateSettings).toHaveBeenCalledWith({ collapsedBoardSections: ['boards'] });
});
- it('reopens a section that was persisted as collapsed', async () => {
- await renderPanel(createGallery({ collapsedBoardSections: ['boards'] }));
-
- const trigger = host?.querySelector<HTMLElement>('[data-scope="collapsible"] [data-part="trigger"]');
-
- await click(trigger!);
-
- expect(actions.updateSettings).toHaveBeenCalledWith({ collapsedBoardSections: [] });
- });
-
it('toggles the date and archived board queries from the filter row', async () => {
await renderPanel();
@@ -327,15 +276,4 @@ describe('GalleryBoardsPanel', () => {
await click(archiveToggle!);
expect(actions.updateSettings).toHaveBeenCalledWith({ showArchivedBoards: false });
});
-
- it('reports no matches when the only board named is one the filters are hiding', async () => {
- // Reachable while the archived toggle has flipped but the refetch that
- // drops archived boards has not landed: the name is taken, so creating is
- // refused, yet no section will show it.
- await renderPanel(createGallery({ showArchivedBoards: false }));
- await type(getSearchInput(), 'GORL');
-
- expect(host?.textContent).toContain('widgets.gallery.noBoardsMatchSearch');
- expect(host?.textContent).not.toContain('Create board');
- });
});
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryLayout.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryLayout.browser.test.tsx
index da953a9cfb..8e8cd9e0bf 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryLayout.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryLayout.browser.test.tsx
@@ -76,13 +76,8 @@ const createGallery = (overrides: Partial<GalleryStateView> = {}) =>
const gallery = createGallery();
-let region: GalleryWidgetContextValue['region'] = 'center';
let activeGallery: GalleryStateView = gallery;
-const setRegion = (next: GalleryWidgetContextValue['region']) => {
- region = next;
-};
-
const setGallery = (next: GalleryStateView) => {
activeGallery = next;
};
@@ -91,7 +86,7 @@ const createContextValue = () =>
({
...contextBase,
gallery: activeGallery,
- region,
+ region: 'center',
}) as unknown as GalleryWidgetContextValue;
const contextBase = {
@@ -151,24 +146,8 @@ const renderLayout = async (Layout: typeof GalleryStackedLayout | typeof Gallery
);
};
-/**
- * The slots every shell owes, identified the way a user would find them. If a
- * shell drops one, the redesign's central promise — same components, different
- * arrangement — has been broken.
- */
-const findSlots = () => ({
- boardSearch: host?.querySelector('input[aria-label="widgets.gallery.searchOrCreateBoards"]') ?? null,
- boardsSection: host?.querySelector('[data-scope="collapsible"]') ?? null,
- grid: host?.querySelector('[role="list"]') ?? null,
- itemSearch: host?.querySelector('input[aria-label="widgets.gallery.searchImagesAriaLabel"]') ?? null,
- selectionBar: host?.querySelector('[role="toolbar"]') ?? null,
- sort: host?.querySelector('button[aria-label="widgets.gallery.imageSort"]') ?? null,
- tabs: host?.querySelector('[role="radiogroup"]') ?? null,
-});
-
beforeEach(() => {
vi.clearAllMocks();
- setRegion('center');
setGallery(gallery);
host = document.createElement('div');
host.style.cssText = 'height:600px;left:0;position:fixed;top:0;width:900px;';
@@ -186,30 +165,6 @@ afterEach(async () => {
});
describe('gallery layout shells', () => {
- it('renders every slot in the stacked shell', async () => {
- await renderLayout(GalleryStackedLayout);
-
- for (const [name, element] of Object.entries(findSlots())) {
- expect(element, `stacked shell is missing the ${name} slot`).not.toBeNull();
- }
- });
-
- it('renders every slot in the wide shell', async () => {
- await renderLayout(GalleryWideLayout);
-
- for (const [name, element] of Object.entries(findSlots())) {
- expect(element, `wide shell is missing the ${name} slot`).not.toBeNull();
- }
- });
-
- it('gives each shell a resize handle for the axis it splits on', async () => {
- await renderLayout(GalleryStackedLayout);
- expect(host?.querySelector('[role="separator"]')?.getAttribute('aria-orientation')).toBe('horizontal');
-
- await renderLayout(GalleryWideLayout);
- expect(host?.querySelector('[role="separator"]')?.getAttribute('aria-orientation')).toBe('vertical');
- });
-
it('keeps a long board list inside the board panel instead of spilling it over the grid', async () => {
const boards = Array.from({ length: 40 }, (_, index) => ({
...board,
@@ -226,8 +181,6 @@ describe('gallery layout shells', () => {
throw new Error('board panel viewport did not render');
}
- // The panel has a definite height, so 40 boards have to scroll rather than
- // push the list past its box and over the grid below it.
expect(viewport.scrollHeight).toBeGreaterThan(viewport.clientHeight);
expect(viewport.getBoundingClientRect().height).toBeLessThanOrEqual(DEFAULT_GALLERY_SETTINGS.boardPanelHeightPx);
@@ -281,21 +234,6 @@ describe('gallery layout shells', () => {
expect(contextBase.actions.updateSettings).toHaveBeenLastCalledWith({ boardPanelHeightPx: measuredMaximum });
});
- it('never renders upload or settings in the body, in either shell or any region', async () => {
- // The widget frame owns them now (see GalleryWidgetChrome). Rendering them
- // here too would double the controls in every placement.
- for (const region of ['center', 'right'] as const) {
- for (const Layout of [GalleryStackedLayout, GalleryWideLayout]) {
- setRegion(region);
- await renderLayout(Layout);
-
- expect(host?.querySelector('button[aria-label^="widgets.gallery.upload"]'), region).toBeNull();
- expect(host?.querySelector('button[aria-label="widgets.gallery.settings"]'), region).toBeNull();
- expect(host?.querySelector('[role="radiogroup"]'), 'the rest of the row still renders').not.toBeNull();
- }
- }
- });
-
it('hides the board column and its handle in both shells when collapsed', async () => {
setGallery(createGallery({ settings: { ...DEFAULT_GALLERY_SETTINGS, boardPanelCollapsed: true } }));
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GallerySearchField.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GallerySearchField.browser.test.tsx
index 38a82d68c7..94eb8858ca 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GallerySearchField.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GallerySearchField.browser.test.tsx
@@ -39,8 +39,6 @@ const getInput = (): HTMLInputElement => {
return input;
};
-const getField = (): HTMLElement => host?.firstElementChild as HTMLElement;
-
/** The mirror is the input's own sibling; the search icon is also aria-hidden. */
const getMirror = (): HTMLElement => {
const mirror = getInput().previousElementSibling;
@@ -94,52 +92,15 @@ describe('getGallerySearchSegments', () => {
expect(chip?.isInvalid).toBe(true);
});
-
- it('leaves plain text unchipped', () => {
- const value = 'just words';
-
- expect(getGallerySearchSegments(value, parseDateTokens(value)).every((s) => s.kind === 'text')).toBe(true);
- });
});
describe('GallerySearchField', () => {
- it('keeps the field the same height when a token is added', async () => {
- // The regression: the parsed-range hint used to render as a sibling, so
- // typing a date grew the field and knocked the wide header row off centre.
- await renderField('sunset');
- const plainHeight = getField().getBoundingClientRect().height;
-
- await renderField('from:7d sunset');
-
- expect(getField().getBoundingClientRect().height).toBe(plainHeight);
- });
-
- it('paints the value through the mirror rather than the input', async () => {
- await renderField('from:7d sunset');
-
- expect(getComputedStyle(getInput()).color).toBe('rgba(0, 0, 0, 0)');
- expect(getMirror().textContent).toBe('from:7d sunset');
- });
-
it('renders a chip for the token and leaves the rest plain', async () => {
await renderField('from:7d sunset');
expect(getChips().map((chip) => chip.textContent)).toEqual(['from:7d']);
});
- it('aligns the mirror with the input so glyphs sit on top of each other', async () => {
- await renderField('from:7d sunset');
-
- const inputRect = getInput().getBoundingClientRect();
- const mirrorRect = getMirror().getBoundingClientRect();
-
- expect(Math.abs(mirrorRect.left - inputRect.left)).toBeLessThanOrEqual(1);
- // Vertical centres must agree, or every glyph is off by the difference.
- expect(
- Math.abs(mirrorRect.top + mirrorRect.height / 2 - (inputRect.top + inputRect.height / 2))
- ).toBeLessThanOrEqual(1);
- });
-
it('reports invalid input to assistive tech', async () => {
await renderField('from:nope', true);
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GallerySplitHandle.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GallerySplitHandle.browser.test.tsx
index a3872fcfe6..f2404a4558 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GallerySplitHandle.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GallerySplitHandle.browser.test.tsx
@@ -95,19 +95,6 @@ describe('GallerySplitHandle', () => {
expect(onCommit).toHaveBeenCalledExactlyOnceWith(340);
});
- it('stops previewing after release, so a stray move cannot resize', async () => {
- const separator = await renderHandle();
-
- await interact(() => {
- separator.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, clientX: 0, clientY: 100 }));
- });
- await interact(() => window.dispatchEvent(new PointerEvent('pointerup', { clientX: 0, clientY: 100 })));
- onPreview.mockClear();
- await interact(() => window.dispatchEvent(new PointerEvent('pointermove', { clientX: 0, clientY: 500 })));
-
- expect(onPreview).not.toHaveBeenCalled();
- });
-
it('clamps a drag to the bounds rather than reporting an impossible size', async () => {
const separator = await renderHandle();
@@ -138,28 +125,4 @@ describe('GallerySplitHandle', () => {
await interact(() => separator.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'End' })));
expect(onCommit).toHaveBeenLastCalledWith(600);
});
-
- it('drags and steps horizontally when it is the wide layout column edge', async () => {
- const separator = await renderHandle({ max: 420, min: 180, orientation: 'vertical', sizePx: 240 });
-
- expect(separator.getAttribute('aria-orientation')).toBe('vertical');
-
- await interact(() => {
- separator.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, clientX: 100, clientY: 0 }));
- });
- await interact(() => window.dispatchEvent(new PointerEvent('pointermove', { clientX: 130, clientY: 0 })));
- expect(onPreview).toHaveBeenLastCalledWith(270);
-
- await interact(() => separator.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'ArrowRight' })));
- expect(onCommit).toHaveBeenLastCalledWith(256);
- });
-
- it('ignores keys it does not own', async () => {
- const separator = await renderHandle();
-
- await interact(() => separator.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'Enter' })));
- await interact(() => separator.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'ArrowLeft' })));
-
- expect(onCommit).not.toHaveBeenCalled();
- });
});
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetChrome.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetChrome.browser.test.tsx
index 40ec76ebc1..cc54ee899b 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetChrome.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetChrome.browser.test.tsx
@@ -111,9 +111,7 @@ describe('GalleryWidgetLabel', () => {
expect(host?.textContent).toContain('widgets.labels.gallery');
expect(host?.textContent).toContain('dogs');
- });
- it('drops the widget name in the center, where the view selector already says it', async () => {
await renderChrome(GalleryWidgetLabel, { selectedBoardId: 'dogs' }, 'center');
expect(host?.textContent).not.toContain('widgets.labels.gallery');
@@ -138,19 +136,6 @@ describe('GalleryWidgetLabel', () => {
expect(updateSettings).toHaveBeenCalledWith({ boardPanelCollapsed: true });
});
-
- it('expands the boards again when collapsed', async () => {
- await renderChrome(GalleryWidgetLabel, { boardPanelCollapsed: true, selectedBoardId: 'dogs' });
-
- expect(getToggle().getAttribute('aria-expanded')).toBe('false');
-
- await act(async () => {
- getToggle().click();
- await Promise.resolve();
- });
-
- expect(updateSettings).toHaveBeenCalledWith({ boardPanelCollapsed: false });
- });
});
describe('GalleryWidgetHeaderActions', () => {
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.browser.test.tsx
index 2e1d6a0ba1..9f04c0322b 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.browser.test.tsx
@@ -282,27 +282,7 @@ describe('focused gallery upload action', () => {
message: '2 images and 2 videos uploaded to Board 1. 1 failed. Images appear in Assets; videos appear in Media.',
title: 'Uploaded 4 of 5 files',
});
- });
-
- it('selects the newest successful upload visible in the active view', async () => {
- galleryView = 'assets';
- await renderProbe();
- mocks.uploadGalleryImage
- .mockResolvedValueOnce(imageUpload('older.png', '2026-07-30T12:00:01.000Z'))
- .mockResolvedValueOnce(imageUpload('newer.png', '2026-07-30T12:00:04.000Z'));
- mocks.uploadGalleryVideo.mockResolvedValue(videoUpload('newest.mp4', '2026-07-30T12:00:05.000Z'));
-
- await act(async () => {
- await uploadFilesRef.current?.([
- new File(['image'], 'older.png', { type: 'image/png' }),
- new File(['video'], 'newest.mp4', { type: 'video/mp4' }),
- new File(['image'], 'newer.png', { type: 'image/png' }),
- ]);
- });
-
- expect(selectItem).toHaveBeenCalledExactlyOnceWith(
- expect.objectContaining({ category: 'user', kind: 'image', name: 'newer.png' })
- );
+ expect(selectItem).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ kind: 'video', name: 'third.mp4' }));
});
it('does not select an upload from the launch board after the active board changes in flight', async () => {
@@ -331,52 +311,6 @@ describe('focused gallery upload action', () => {
expect(mocks.invalidateGallery).toHaveBeenCalledOnce();
});
- it('does not select an upload hidden by a view change while the upload is in flight', async () => {
- galleryView = 'assets';
- await renderProbe();
- let resolveUpload: ((value: ReturnType<typeof imageUpload>) => void) | undefined;
- mocks.uploadGalleryImage.mockReturnValueOnce(
- new Promise<ReturnType<typeof imageUpload>>((resolve) => {
- resolveUpload = resolve;
- })
- );
-
- let upload: Promise<void> | undefined;
- act(() => {
- upload = uploadFilesRef.current?.([new File(['image'], 'photo.png', { type: 'image/png' })]);
- });
- await vi.waitFor(() => expect(mocks.uploadGalleryImage).toHaveBeenCalledOnce());
-
- galleryView = 'images';
- await renderProbe();
- resolveUpload?.(imageUpload('photo.png', '2026-07-30T12:00:04.000Z'));
-
- await act(async () => {
- await upload;
- });
-
- expect(selectItem).not.toHaveBeenCalled();
- expect(mocks.invalidateGallery).toHaveBeenCalledOnce();
- });
-
- it('reports unsupported and rejected files once without aborting supported uploads', async () => {
- mocks.uploadGalleryVideo.mockRejectedValue(new Error('corrupt video'));
-
- await act(async () => {
- await uploadFilesRef.current?.([
- new File(['text'], 'notes.txt', { type: 'text/plain' }),
- new File(['video'], 'corrupt.mp4', { type: 'video/mp4' }),
- ]);
- });
-
- expect(mocks.notificationsAdd).not.toHaveBeenCalled();
- expect(mocks.notificationsReportError).toHaveBeenCalledExactlyOnceWith({
- area: 'gallery-upload',
- message: 'No files uploaded. 2 failed.',
- namespace: 'gallery',
- });
- });
-
it('does not schedule another expensive video after the account lifetime aborts', async () => {
let rejectFirstVideo: ((reason: unknown) => void) | undefined;
mocks.uploadGalleryVideo.mockReturnValueOnce(
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptImageDrop.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptImageDrop.browser.test.tsx
index 20c43da236..0cff0f9fa6 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptImageDrop.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptImageDrop.browser.test.tsx
@@ -183,10 +183,4 @@ describe('dropping a gallery image on the positive prompt box', () => {
expect(popoverImageName()).toBe(stubs.selectedImage.imageName);
});
-
- it('describes the gallery selection when nothing has been dropped', async () => {
- await settle(() => imageToPromptButton().click());
-
- expect(popoverImageName()).toBe(stubs.selectedImage.imageName);
- });
});
diff --git a/invokeai/frontend/webv2/src/platform/ui/ColorPicker.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/ColorPicker.browser.test.tsx
index 1c53751a86..12494fba62 100644
--- a/invokeai/frontend/webv2/src/platform/ui/ColorPicker.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/ColorPicker.browser.test.tsx
@@ -115,19 +115,7 @@ afterEach(async () => {
});
describe('ColorPicker', () => {
- it('opens a popover with an area, hue slider, channel inputs, and swatches', async () => {
- const { trigger } = await renderPicker({ initialValue: '#ff0000' });
- await openPicker(trigger);
-
- expect(document.querySelector('[data-part="area"]')).not.toBeNull();
- expect(document.querySelector('[data-part="channel-slider"][data-channel="hue"]')).not.toBeNull();
- expect(queryChannelInputs().length).toBeGreaterThan(0);
- expect(querySwatchTriggers().length).toBeGreaterThan(0);
- });
-
it('emits both a change and a commit when a swatch is picked', async () => {
- // Zag's SwatchTrigger only reports a value change; without the component's
- // explicit commit, every undo-recording consumer would drop swatch picks.
const { onChange, onChangeEnd, trigger } = await renderPicker({
initialValue: '#000000',
swatches: ['#ff0000', '#00ff00'],
@@ -156,42 +144,15 @@ describe('ColorPicker', () => {
expect(alpha.onChange).toHaveBeenLastCalledWith('#ff0000ff');
});
- it('takes the alpha a swatch carries, so recents restore their transparency', async () => {
- const { onChange, trigger } = await renderPicker({
- initialValue: '#000000ff',
- swatches: ['#ff000080'],
- withAlpha: true,
- });
- await openPicker(trigger);
- await interact(() => querySwatchTriggers()[0]?.click());
-
- expect(onChange).toHaveBeenLastCalledWith('#ff000080');
- });
-
- it('shows an alpha slider only under withAlpha', async () => {
- const opaque = await renderPicker({ initialValue: '#ff0000' });
- await openPicker(opaque.trigger);
- expect(document.querySelector('[data-part="channel-slider"][data-channel="alpha"]')).toBeNull();
-
- await interact(() => root?.unmount());
- host?.remove();
-
- const alpha = await renderPicker({ initialValue: '#ff0000ff', withAlpha: true });
- await openPicker(alpha.trigger);
- expect(document.querySelector('[data-part="channel-slider"][data-channel="alpha"]')).not.toBeNull();
- });
-
it('cycles formats through HEX/RGB/HSL/HSB without changing the value', async () => {
const { onChange, trigger } = await renderPicker({ initialValue: '#ff0000', swatches: false });
await openPicker(trigger);
const formatTrigger = () => document.querySelector<HTMLButtonElement>('[aria-label="Color format"]')!;
- // HEX renders a single text field.
expect(formatTrigger().textContent).toBe('HEX');
expect(queryChannelInputs()).toHaveLength(1);
- // RGB renders one field per channel.
await interact(() => formatTrigger().click());
expect(formatTrigger().textContent).toBe('RGB');
expect(queryChannelInputs()).toHaveLength(3);
@@ -203,14 +164,12 @@ describe('ColorPicker', () => {
await interact(() => formatTrigger().click());
expect(formatTrigger().textContent).toBe('HSB');
- // Back to the start, and cycling never emitted a value change.
await interact(() => formatTrigger().click());
expect(formatTrigger().textContent).toBe('HEX');
expect(onChange).not.toHaveBeenCalled();
});
it('edits opacity as a whole percentage rather than a unit float', async () => {
- // Zag's own alpha channel input renders `0.501`; the picker replaces it.
const { onChange, trigger } = await renderPicker({
initialValue: '#ff000080',
swatches: false,
@@ -230,19 +189,6 @@ describe('ColorPicker', () => {
expect(onChange).toHaveBeenLastCalledWith('#ff000040');
});
- it('offers the opacity field only under withAlpha', async () => {
- const opaque = await renderPicker({ initialValue: '#ff0000', swatches: false });
- await openPicker(opaque.trigger);
- expect(document.querySelector('[aria-label="Opacity (%)"]')).toBeNull();
-
- await interact(() => root?.unmount());
- host?.remove();
-
- const alpha = await renderPicker({ initialValue: '#ff0000ff', swatches: false, withAlpha: true });
- await openPicker(alpha.trigger);
- expect(document.querySelector('[aria-label="Opacity (%)"]')).not.toBeNull();
- });
-
it('records committed colors as recents and offers them alongside the defaults', async () => {
const first = await renderPicker({ initialValue: '#000000', swatches: ['#123456'] });
await openPicker(first.trigger);
@@ -252,7 +198,6 @@ describe('ColorPicker', () => {
await interact(() => root?.unmount());
host?.remove();
- // A picker using the default palette should now surface the committed color.
const second = await renderPicker({ initialValue: '#000000' });
await openPicker(second.trigger);
const values = querySwatchTriggers().map((swatch) => swatch.getAttribute('data-value'));
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.browser.test.tsx
index f0f7699001..757d958e40 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.browser.test.tsx
@@ -18,9 +18,6 @@ import { CURVE_SIZE } from './curveEditorMath';
const i18n = createInstance();
void i18n.use(initReactI18next).init({ fallbackLng: 'en', initAsync: false, lng: 'en', resources: {} });
-// The popover calls this hook for its no-engine fallback path. The harness
-// drives edits through a stand-in engine instead, so the dispatch is never used
-// and can stay a stable no-op rather than something reassigned during render.
const noopDispatch = (): void => undefined;
vi.mock('@workbench/useCanvasProjectMutationDispatch', () => ({
useCanvasProjectMutationDispatch: () => noopDispatch,
@@ -47,8 +44,6 @@ const createLayer = (): CanvasRasterLayerContractV2 =>
const Harness = () => {
const [layer, setLayer] = useState(createLayer);
- // Stands in for the canvas engine: both the live preview and the committed
- // edit land back on the layer prop, which is what the editor re-renders from.
const engine = useMemo(() => {
const apply = (mutation: CanvasProjectMutation): boolean => {
const candidate = mutation as { type: string; config?: { adjustments?: unknown } };
@@ -82,7 +77,6 @@ const settle = (action: () => void): Promise<void> =>
const render = async () => {
applyThemeToRoot('classic');
host = document.createElement('div');
- // Narrower than the editor's intrinsic size, so the square-fit path is real.
host.style.width = '260px';
document.body.append(host);
root = createRoot(host);
@@ -121,45 +115,6 @@ afterEach(async () => {
});
describe('curves editor', () => {
- it('paints its chrome from resolved theme tokens', async () => {
- // Hand-written `var(--chakra-colors-bg-inset)` did not exist (Chakra emits
- // `--chakra-colors-bg.inset`), so `fill` fell back to black and `stroke` to
- // `none` — the whole editor rendered as a black box.
- const svg = await render();
- const area = svg.querySelector('rect')!;
- const curve = svg.querySelector('path')!;
-
- for (const [label, value] of [
- ['area fill', getComputedStyle(area).fill],
- ['curve stroke', getComputedStyle(curve).stroke],
- ['handle fill', getComputedStyle(handles(svg)[0]!).fill],
- ] as const) {
- expect(value, label).not.toBe('none');
- expect(value, label).not.toBe('rgb(0, 0, 0)');
- }
-
- expect(getComputedStyle(svg).backgroundColor).not.toBe('rgba(0, 0, 0, 0)');
- });
-
- it('makes nothing in the editor selectable, so a drag cannot become a text drag', async () => {
- // Double-clicking to add a point is a word-select gesture; without this it
- // latched onto the channel select's label and the next handle press dragged
- // that selection instead, trailing a floating "Red" across the screen.
- const svg = await render();
- const editor = svg.parentElement!;
-
- expect(getComputedStyle(editor).userSelect).toBe('none');
- expect(getComputedStyle(svg).userSelect).toBe('none');
- expect(getComputedStyle(editor.querySelector('button')!).userSelect).toBe('none');
- });
-
- it('keeps the drawing square so pointer coordinates map onto the viewBox', async () => {
- const svg = await render();
- const rect = svg.getBoundingClientRect();
-
- expect(rect.width).toBeCloseTo(rect.height, 0);
- });
-
it('moves a handle while dragging it', async () => {
const svg = await render();
const target = handles(svg).at(-1)!;
@@ -177,12 +132,8 @@ describe('curves editor', () => {
});
it('adds a point under the pointer rather than offset from it', async () => {
- // Guards the letterboxing bug: a non-square box mapped pointer x across the
- // whole element while the viewBox only occupied part of it.
const svg = await render();
const rect = svg.getBoundingClientRect();
- // Deliberately off centre: a letterboxed viewBox still maps the midpoint
- // correctly, because the dead space either side cancels out there.
const targetX = rect.left + rect.width * 0.25;
await settle(() =>
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.browser.test.tsx
index 62f6fe1e46..5cf693a8d0 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.browser.test.tsx
@@ -7,7 +7,6 @@ import { act } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { I18nextProvider, initReactI18next } from 'react-i18next';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { userEvent } from 'vitest/browser';
import { PreviewHeaderActions } from './PreviewHeaderActions';
@@ -38,8 +37,6 @@ const updateProjectPreferences = vi.hoisted(() => vi.fn());
vi.mock('@features/queue/react', () => ({ useProgressImage: () => null }));
-// No selection published, so the action strip stays out and the two toggles are
-// the only buttons in the header.
vi.mock('./previewHeaderStore', () => ({
usePreviewHeaderContext: () => ({
actionItem: null,
@@ -111,9 +108,6 @@ afterEach(async () => {
describe('preview header toggles', () => {
it('states both on/off positions the same way', async () => {
- // The filmstrip toggle used to signal "on" with an `fg.muted` → `fg` shift
- // on a permanently ghost button, while the in-progress toggle next to it
- // filled. One control type, one vocabulary.
await render();
const bothOn = [button('Hide filmstrip'), button('Hide in-progress diffusion')];
@@ -138,28 +132,6 @@ describe('preview header toggles', () => {
expect(filmstripOff).not.toBe(filmstripOn);
});
- it('gives both a hover tooltip rather than the native title attribute', async () => {
- // They previously relied on `title`, which is delayed, unstyled, and unlike
- // every other button in the same header row.
- await render();
-
- for (const label of ['Hide filmstrip', 'Hide in-progress diffusion']) {
- const control = button(label);
- expect(control.hasAttribute('title'), label).toBe(false);
-
- await act(async () => {
- await userEvent.hover(control);
- });
- await vi.waitFor(() =>
- expect(document.querySelector('[data-scope="tooltip"][data-part="content"]')?.textContent, label).toBe(label)
- );
-
- await act(async () => {
- await userEvent.unhover(control);
- });
- }
- });
-
it('still toggles the setting each one owns', async () => {
await render();