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.

Merge remote-tracking branch 'origin/main' into feat/walk-seed

Josh Corbetta1d06307932a
diff --cc invokeai/frontend/webv2/src/features/generation/core/graphCoverage.test.ts
index 0000000000,950046df1a..46f9de3931
mode 000000,100644..100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graphCoverage.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graphCoverage.test.ts
@@@ -1,0 -1,399 +1,399 @@@
+ /**
+ * Every supported base compiles a graph — the systematic counterpart to `graph.test.ts`.
+ *
+ * `graph.test.ts` asserts *what* individual families wire up, one hand-written case at a time. That
+ * leaves a base added to `SUPPORTED_GENERATE_BASES` and `GRAPH_BUILDERS` but never given a case silently
+ * untested. This file instead iterates `SUPPORTED_GENERATE_BASES`, so a new architecture is covered
+ * the moment it is registered, and asserts the properties that hold for *all* of them: the
+ * component policy is satisfiable, the builder runs, and the resulting graph is structurally sound.
+ *
+ * It also checks the node types and fields each base emits against a committed fixture. That
+ * fixture is the frontend half of a cross-stack contract — `tests/app/invocations/
+ * test_frontend_graph_node_types.py` reads it and checks every type and field against the backend's
+ * `InvocationRegistry`. A node moved between modules and accidentally renamed shows up there, which
+ * no frontend-only assertion can see.
+ *
+ * Edges are only half of what a builder writes. The other half is what it sets *literally* on a
+ * node — `use_prompt_enhancer: false`, a scheduler string, `denoising_start: 0` — which no edge
+ * records. Those inputs are the ones nothing could check: the frontend never sees a backend schema,
+ * so it cannot know that `ernie_image_denoise.scheduler` is a three-value `Literal`. Recording the
+ * literal names *and* their values lets the Python half validate each against the field's real
+ * annotation, turning a renamed input or an out-of-range scheduler into a test failure instead of
+ * an enqueue-time error on a graph the user cannot edit.
+ *
+ * The snapshot file is written by this test and by nothing else — `.oxfmtrc.json` excludes it for
+ * that reason. Letting the formatter reflow a generated file too would leave both in charge of the
+ * same bytes, and `format:check` would fail on whichever layout the other one wrote last.
+ */
+
+ import type { BackendGraphContract } from '@features/generation/core/contracts';
+
+ import { seedArchitectureCapabilities } from '@features/generation/core/architectureCapabilities.testing';
+ import { describe, expect, it } from 'vitest';
+
+ import type {
+ ComponentPolicyContext,
+ ComponentSlotPolicy,
+ GenerateComponentValueKey,
+ SupportedGenerateBase,
+ } from './baseGenerationPolicies';
+ import type { GenerateSettings, MainModelConfig, ModelIdentifierConfig, VaeModelConfig } from './types';
+
+ import {
+ getComponentSectionPolicy,
+ getDefaultGenerateSettings,
+ getGenerationValidationReasons,
+ SUPPORTED_GENERATE_BASES,
+ } from './baseGenerationPolicies';
+ import { compileGenerateGraph, GRAPH_BUILDERS } from './graph';
+
+ /**
+ * Main-model shapes to compile per base.
+ *
+ * `diffusers` bundles its submodels, so the component slots go optional and the builder takes the
+ * bundled path; a quantized single-file main carries only the transformer and forces the standalone
+ * -component path. Both paths produce different graphs, so both are worth compiling.
+ */
+ interface ModelShape {
+ label: string;
+ overrides: Partial<MainModelConfig>;
+ }
+
+ const DEFAULT_SHAPES: readonly ModelShape[] = [
+ { label: 'diffusers', overrides: { format: 'diffusers' } },
+ { label: 'standalone-components', overrides: { format: 'gguf_quantized' } },
+ ];
+
+ /**
+ * Bases whose builder needs more than a format to pick a path. Keys are checked against
+ * `SUPPORTED_GENERATE_BASES` below, so a renamed or removed base cannot leave a stale entry here.
+ */
+ const SHAPE_OVERRIDES: Partial<Record<SupportedGenerateBase, readonly ModelShape[]>> = {
+ // The two FLUX.2 lines take different encoders: [dev] wants Mistral, Klein wants a Qwen3 whose
+ // variant is pinned to the Klein size by KLEIN_TO_QWEN3_VARIANT.
+ flux2: [
+ { label: 'dev-diffusers', overrides: { format: 'diffusers', variant: 'dev' } },
+ { label: 'dev-standalone', overrides: { format: 'gguf_quantized', variant: 'dev' } },
+ { label: 'klein-9b-standalone', overrides: { format: 'gguf_quantized', variant: 'klein_9b' } },
+ ],
+ };
+
+ const shapesForBase = (base: SupportedGenerateBase): readonly ModelShape[] => SHAPE_OVERRIDES[base] ?? DEFAULT_SHAPES;
+
+ /**
+ * Candidate components the slot filters get to choose from.
+ *
+ * Deliberately a search over a pool rather than a hand-written model per slot: the filters
+ * (`isAnimaQwen3Encoder`, `isVaeAcceptedByBase`, `isFlux2Qwen3EncoderForModel`, ...) encode which base and
+ * variant a component must carry, and duplicating that knowledge here would make the test agree
+ * with itself instead of with the policy.
+ */
+ const CANDIDATE_BASES = ['any', ...SUPPORTED_GENERATE_BASES] as const;
+ const CANDIDATE_VARIANTS = [
+ undefined,
+ 'qwen3_06b',
+ 'qwen3_4b',
+ 'qwen3_8b',
+ 'large',
+ 'gigantic',
+ 'dev',
+ 'klein_4b',
+ 'klein_9b',
+ ] as const;
+ /** VAE widths. A served row can constrain the width as well as the base -- Wan ships 16 and 48. */
+ const CANDIDATE_LATENT_CHANNELS = [undefined, 16, 48] as const;
+
+ const candidatesForSlot = (slot: ComponentSlotPolicy): ModelIdentifierConfig[] => {
+ const candidates: ModelIdentifierConfig[] = [];
+
+ for (const type of slot.modelTypes) {
+ for (const base of CANDIDATE_BASES) {
+ for (const variant of CANDIDATE_VARIANTS) {
+ for (const latentChannels of type === 'vae' ? CANDIDATE_LATENT_CHANNELS : [undefined]) {
+ candidates.push({
+ base,
+ // A component source is a main model, and only a bundled one can stand in for the slots
+ // it satisfies — `isDiffusersMainForBase` and `isBundledMainForBase` both demand it.
+ format: slot.valueKind === 'main' ? 'diffusers' : undefined,
+ key: `${base}-${type}-${variant ?? 'novariant'}${latentChannels ? `-${latentChannels}` : ''}`,
+ name: `${base} ${type} ${variant ?? ''}`.trim(),
+ type,
+ variant: variant ?? null,
+ ...(latentChannels ? { latent_channels: latentChannels } : {}),
+ });
+ }
+ }
+ }
+ }
+
+ return candidates;
+ };
+
+ const buildContext = (
+ model: MainModelConfig,
+ settings: GenerateSettings,
+ slots: readonly ComponentSlotPolicy[]
+ ): ComponentPolicyContext => {
+ // Derived from the slots rather than from a hand-kept key list: a new slot key is picked up here
+ // automatically, and a key that no slot uses cannot go stale.
+ const keys = new Set<GenerateComponentValueKey>(slots.map((slot) => slot.key));
+ const selectedComponents = {} as ComponentPolicyContext['selectedComponents'];
+
+ for (const key of keys) {
+ selectedComponents[key] = settings[key] as never;
+ }
+
+ return { model, settings, selectedComponents };
+ };
+
+ /**
+ * Fill every required component slot with something the slot's own filter accepts.
+ *
+ * Iterated to a fixpoint because slots are interdependent: selecting a component source can make
+ * the VAE and encoder slots stop being required, so one pass is not enough to reach a stable answer.
+ */
+ const satisfyRequiredComponents = (
+ model: MainModelConfig,
+ initial: GenerateSettings
+ ): { settings: GenerateSettings; filled: GenerateComponentValueKey[] } => {
+ let settings = initial;
+ const filled: GenerateComponentValueKey[] = [];
+
+ for (let pass = 0; pass < 5; pass++) {
+ const { slots } = getComponentSectionPolicy(model, settings);
+ const context = buildContext(model, settings, slots);
+ let changed = false;
+
+ for (const slot of slots) {
+ if (!slot.required?.(context) || settings[slot.key]) {
+ continue;
+ }
+
+ const candidate = candidatesForSlot(slot).find((c) => !slot.filter || slot.filter(c, context));
+
+ if (candidate) {
+ settings = { ...settings, [slot.key]: candidate };
+ filled.push(slot.key);
+ changed = true;
+ }
+ }
+
+ if (!changed) {
+ break;
+ }
+ }
+
+ return { filled: filled.sort(), settings };
+ };
+
+ const createModel = (base: SupportedGenerateBase, shape: ModelShape): MainModelConfig => ({
+ base,
+ key: `${base}-${shape.label}`,
+ name: `${base} (${shape.label})`,
+ type: 'main',
+ ...shape.overrides,
+ });
+
+ const satisfiedSettingsFor = (base: SupportedGenerateBase, shape: ModelShape) => {
+ const model = createModel(base, shape);
+
+ return {
+ model,
+ ...satisfyRequiredComponents(model, {
+ ...getDefaultGenerateSettings(model),
+ positivePrompt: 'a test prompt',
+ seed: 1,
- shouldRandomizeSeed: false,
++ seedMode: 'fixed',
+ }),
+ };
+ };
+
+ const compileForShape = (
+ base: SupportedGenerateBase,
+ shape: ModelShape
+ ): { filled: GenerateComponentValueKey[]; graph: BackendGraphContract } => {
+ const { filled, model, settings } = satisfiedSettingsFor(base, shape);
+
+ // Compiling an invalid selection throws the first reason, which makes for a poor failure message.
+ // Asserting here reports every unmet requirement at once, and doubles as the check that the
+ // base's component policy is satisfiable at all.
+ expect(getGenerationValidationReasons(model, settings), `${base}/${shape.label} is not satisfiable`).toEqual([]);
+
+ return { filled, graph: compileGenerateGraph(settings, model, 'gallery', { useCpuNoise: true }).backendGraph };
+ };
+
+ const cases = SUPPORTED_GENERATE_BASES.flatMap((base) =>
+ shapesForBase(base).map((shape) => ({ base, label: `${base} / ${shape.label}`, shape }))
+ );
+
+ seedArchitectureCapabilities();
+
+ describe('generate graph coverage', () => {
+ it('has a builder for every supported base and no builder for anything else', () => {
+ expect(Object.keys(GRAPH_BUILDERS).sort()).toEqual([...SUPPORTED_GENERATE_BASES].sort());
+ });
+
+ it('declares shape overrides only for bases that exist', () => {
+ expect(Object.keys(SHAPE_OVERRIDES).filter((base) => !SUPPORTED_GENERATE_BASES.includes(base as never))).toEqual(
+ []
+ );
+ });
+
+ it.each(cases)('compiles a structurally sound graph for $label', ({ base, shape }) => {
+ const { graph } = compileForShape(base, shape);
+ const nodeIds = new Set(Object.keys(graph.nodes));
+
+ expect(nodeIds.size).toBeGreaterThan(0);
+
+ for (const [id, node] of Object.entries(graph.nodes)) {
+ expect(node.id, `node keyed '${id}' carries a mismatched id`).toBe(id);
+ expect(node.type, `node '${id}' has no type`).toBeTruthy();
+ }
+
+ for (const edge of graph.edges) {
+ const description = `${edge.source.node_id}.${edge.source.field} -> ${edge.destination.node_id}.${edge.destination.field}`;
+
+ expect(nodeIds.has(edge.source.node_id), `dangling source in edge ${description}`).toBe(true);
+ expect(nodeIds.has(edge.destination.node_id), `dangling destination in edge ${description}`).toBe(true);
+ expect(edge.source.field, `edge ${description} has no source field`).toBeTruthy();
+ expect(edge.destination.field, `edge ${description} has no destination field`).toBeTruthy();
+ }
+ });
+
+ it('sends every VAE the picker offers into the graph wherever a VAE is required', () => {
+ // The slots above are filled with their *first* accepted candidate, which is how a builder that
+ // re-filtered VAEs by its own base list -- dropping a Qwen-Image VAE installed under `anima` --
+ // passed this suite. One VAE per accepted (base, width) is enough to see every rule a row has.
+ //
+ // Deliberately one test iterating the cases rather than `it.each` over a pre-filtered list: which
+ // shapes require a VAE is answered by the capability table, and that is only seeded once tests run.
+ const checked: string[] = [];
+
+ for (const { base, shape } of cases) {
+ const { filled, model, settings } = satisfiedSettingsFor(base, shape);
+
+ if (!filled.includes('vae')) {
+ continue;
+ }
+
+ const { slots } = getComponentSectionPolicy(model, settings);
+ const vaeSlot = slots.find((slot) => slot.key === 'vae')!;
+ const context = buildContext(model, settings, slots);
+ const offered = new Map<string, ModelIdentifierConfig>();
+
+ for (const candidate of candidatesForSlot(vaeSlot)) {
+ if (!vaeSlot.filter || vaeSlot.filter(candidate, context)) {
+ offered.set(`${candidate.base}/${String(candidate.latent_channels)}`, candidate);
+ }
+ }
+
+ for (const vae of offered.values()) {
+ const { backendGraph } = compileGenerateGraph({ ...settings, vae: vae as VaeModelConfig }, model, 'gallery', {
+ useCpuNoise: true,
+ });
+ // Metadata records the selection whether or not the builder used it, so it does not count.
+ const sent = Object.values(backendGraph.nodes).some(
+ (node) => node.type !== 'core_metadata' && JSON.stringify(node).includes(`"${vae.key}"`)
+ );
+
+ expect(sent, `${base}/${shape.label} dropped the offered VAE ${vae.key}`).toBe(true);
+ checked.push(`${base}/${shape.label}:${vae.base}/${String(vae.latent_channels)}`);
+ }
+ }
+
+ // Guards against this test passing vacuously -- it did, while the list was computed before seeding.
+ // The cross-base rows must each have been exercised with a VAE from another base.
+ expect(checked).toEqual(
+ expect.arrayContaining([
+ 'anima/standalone-components:qwen-image/undefined',
+ 'anima/standalone-components:wan/16',
+ 'krea-2/standalone-components:anima/undefined',
+ 'qwen-image/standalone-components:anima/undefined',
+ 'z-image/standalone-components:flux/undefined',
+ ])
+ );
+ });
+
+ it('emits the node types and fields the backend has to provide', async () => {
+ const byBase: Record<string, { componentsFilled: Record<string, string[]>; nodeTypes: string[] }> = {};
+ const fields: Record<
+ string,
+ { inputs: Set<string>; literals: Map<string, Map<string, unknown>>; outputs: Set<string> }
+ > = {};
+
+ const fieldsFor = (nodeType: string) =>
+ (fields[nodeType] ??= { inputs: new Set(), literals: new Map(), outputs: new Set() });
+
+ for (const { base, shape } of cases) {
+ const { filled, graph } = compileForShape(base, shape);
+ const entry = (byBase[base] ??= { componentsFilled: {}, nodeTypes: [] });
+
+ entry.componentsFilled[shape.label] = filled;
+ entry.nodeTypes = [
+ ...new Set([...entry.nodeTypes, ...Object.values(graph.nodes).map((node) => node.type)]),
+ ].sort();
+
+ for (const node of Object.values(graph.nodes)) {
+ const { literals } = fieldsFor(node.type);
+
+ for (const [field, value] of Object.entries(node)) {
+ // `id` and `type` address the node rather than feed it, and an undefined value is not
+ // serialized into the request at all — the builders use it to mean "leave the default".
+ if (field === 'id' || field === 'type' || value === undefined) {
+ continue;
+ }
+
+ const values = literals.get(field) ?? new Map<string, unknown>();
+ literals.set(field, values);
+
+ // Values are recorded for scalars only, so the name is always checked but the value is
+ // checked where checking it means something. The object-valued inputs are model
+ // identifiers and LoRA lists built from this file's synthetic fixtures, which carry no
+ // `hash`; validating those would assert something about the fixture, not the contract.
+ if (value === null || typeof value !== 'object') {
+ values.set(JSON.stringify(value), value);
+ }
+ }
+ }
+
+ for (const edge of graph.edges) {
+ fieldsFor(graph.nodes[edge.source.node_id]!.type).outputs.add(edge.source.field);
+ fieldsFor(graph.nodes[edge.destination.node_id]!.type).inputs.add(edge.destination.field);
+ }
+ }
+
+ const contract = {
+ _comment:
+ 'Generated by src/features/generation/core/graphCoverage.test.ts; regenerate with ' +
+ '`vitest -u`. Excluded from oxfmt so the test alone owns its layout. Consumed by ' +
+ 'tests/app/invocations/test_frontend_graph_node_types.py, which checks every node type, ' +
+ 'edge field and literal input value below against the backend invocation registry. An ' +
+ 'empty literalInputs value list means the field is set to something other than a scalar, ' +
+ 'so only its name is checked.',
+ byBase,
+ fieldsByNodeType: Object.fromEntries(
+ Object.entries(fields)
+ .sort(([a], [b]) => a.localeCompare(b))
+ .map(([nodeType, { inputs, literals, outputs }]) => [
+ nodeType,
+ {
+ inputs: [...inputs].sort(),
+ literalInputs: Object.fromEntries(
+ [...literals]
+ .sort(([a], [b]) => a.localeCompare(b))
+ .map(([field, values]) => [
+ field,
+ [...values].sort(([a], [b]) => a.localeCompare(b)).map(([, value]) => value),
+ ])
+ ),
+ outputs: [...outputs].sort(),
+ },
+ ])
+ ),
+ };
+
+ await expect(`${JSON.stringify(contract, null, 2)}\n`).toMatchFileSnapshot(
+ './__snapshots__/generateGraphNodeTypes.json'
+ );
+ });
+ });
diff --cc invokeai/frontend/webv2/src/features/generation/core/settings.test.ts
index ef2e8cbe1d,c0dfbecf07..8b7a74fd44
--- a/invokeai/frontend/webv2/src/features/generation/core/settings.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/settings.test.ts
@@@ -48,25 -43,9 +49,27 @@@ const legacyStoredValues =
width: 512,
};
+ seedArchitectureCapabilities();
+
describe('normalizeGenerateSettings', () => {
+ it('reads the seed mode saved before modes existed from the random toggle', () => {
+ expect(normalizeGenerateSettings(legacyStoredValues)?.seedMode).toBe('fixed');
+ expect(normalizeGenerateSettings({ ...legacyStoredValues, shouldRandomizeSeed: true })?.seedMode).toBe('random');
+ // A saved mode wins over a stale toggle left behind by a partial patch.
+ expect(
+ normalizeGenerateSettings({ ...legacyStoredValues, seedMode: 'decrement', shouldRandomizeSeed: true })?.seedMode
+ ).toBe('decrement');
+ expect(
+ normalizeGenerateSettings({ ...legacyStoredValues, seedMode: 'bogus', shouldRandomizeSeed: true })?.seedMode
+ ).toBe('random');
+ });
+
+ it('rejects values that name neither a seed mode nor the random toggle', () => {
+ const { shouldRandomizeSeed: _, ...withoutSeedPolicy } = legacyStoredValues;
+
+ expect(normalizeGenerateSettings(withoutSeedPolicy)).toBeNull();
+ });
+
it('enforces template view mode only when a valid template remains', () => {
const validTemplate = {
id: 'template-1',
diff --cc invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.browser.test.tsx
index dcc48308fc,b8dd6b43d2..ca38a95768
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.browser.test.tsx
@@@ -2,8 -2,8 +2,9 @@@
import type { GenerateSettings, MainModelConfig } from '@features/generation/core/types';
import { ChakraProvider } from '@chakra-ui/react';
+ import { seedArchitectureCapabilities } from '@features/generation/core/architectureCapabilities.testing';
import { getDefaultGenerateSettings } from '@features/generation/core/baseGenerationPolicies';
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { system } from '@theme/system';
import { createInstance } from 'i18next';
import { act } from 'react';
@@@ -33,28 -28,28 +34,44 @@@ void i18n.use(initReactI18next).init(
resources: {
en: {
translation: {
+ common: { seed: 'Seed' },
widgets: {
generate: {
+ // Verbatim from `public/locales/en.json`: Ideogram 4's overrides really are labelled
+ // "Steps" and "Guidance", the same as the shared controls beside them. Inventing
+ // distinct names here would hide that from the one test that renders both at once.
+ ideogram4ColorHelp: 'Comma-separated color terms folded into the caption.',
+ ideogram4ColorPalette: 'Color palette',
+ ideogram4GuidanceScale: 'Guidance',
+ ideogram4Mu: 'Mu',
+ ideogram4MuHelp: 'Timestep shift. Higher values spend more of the schedule at high noise.',
+ ideogram4PresetDerived: 'Set by the sampler preset unless overridden.',
+ ideogram4SamplerPreset: 'Sampler preset',
+ ideogram4Steps: 'Steps',
+ newSeed: 'New seed',
+ override: 'Override',
- random: 'Random',
+ recentSeeds: 'Recent seeds',
render: 'Render',
+ scheduler: 'Scheduler',
- seed: 'Seed',
+ seedMode: {
+ decrement: 'Decrement',
+ decrementDescription: 'Use successive seeds, decreasing by 1.',
+ fixed: 'Fixed',
+ fixedDescription: 'Reuse the entered seed.',
+ increment: 'Increment',
+ incrementDescription: 'Use successive seeds, increasing by 1.',
+ label: 'Seed mode',
+ random: 'Random',
+ randomDescription: 'Choose a fresh starting seed for each submission.',
+ },
+ seedNextBatch: 'Next batch: {{seed}}',
+ seedNextBatchRange: 'Next batch: {{first}} → {{last}}',
+ seedSummary: '{{mode}} · {{seed}}',
steps: 'Steps',
+ useSeed: 'Use seed {{seed}}',
+ useModelDefaultField: 'Use model default {{field}}',
+ useModelDefaultScheduler: 'Use model default scheduler',
+ useModelDefaultSteps: 'Use model default steps',
},
},
},
@@@ -62,7 -57,48 +79,50 @@@
},
});
+ /**
+ * FLUX Fill's own recommendation is `guidance=30`, well past the guidance slider's practical top of
+ * 10. That is the case the number input's looser `numberInputMax` exists for: without it the field
+ * clamps to the slider's bound the first time it loses focus, and the model's own default is gone
+ * before the user has touched anything.
+ */
+ const fluxFillModel: MainModelConfig = {
+ base: 'flux',
+ default_settings: { cfg_scale: 1, guidance: 30 },
+ format: 'diffusers',
+ key: 'flux-fill',
+ name: 'FLUX Fill',
+ type: 'main',
+ };
+
+ /** `flux2_denoise.guidance` is `le=20`, which the capability table serves as `guidance_max`. */
+ const flux2Model: MainModelConfig = {
+ base: 'flux2',
+ format: 'diffusers',
+ key: 'flux2',
+ name: 'FLUX.2 dev',
+ type: 'main',
+ variant: 'dev',
+ };
+
+ /** `ernie_image_denoise.guidance_scale` is `ge=1.0`, served as `guidance_min`. */
+ const ernieModel: MainModelConfig = {
+ base: 'ernie-image',
+ format: 'diffusers',
+ key: 'ernie',
+ name: 'ERNIE Image',
+ type: 'main',
+ };
+
+ const ideogram4Model: MainModelConfig = {
+ base: 'ideogram-4',
+ format: 'diffusers',
+ key: 'ideogram-4',
+ name: 'Ideogram 4',
+ type: 'main',
+ };
+
+const sd1Model: MainModelConfig = { base: 'sd-1', key: 'sd1', name: 'SD 1.5', type: 'main' };
++
let host: HTMLDivElement | null = null;
let root: Root | null = null;
(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
@@@ -84,32 -119,22 +143,34 @@@ const render = async (model: MainModelC
await settle(() => {
root?.render(
- <ChakraProvider value={system}>
- <I18nextProvider i18n={i18n}>
- <GenerateRenderSection
- selectedModel={model}
- settings={{ ...getDefaultGenerateSettings(model), ...settings }}
- onCommit={onCommit}
- onCommitImmediate={vi.fn()}
- />
- </I18nextProvider>
- </ChakraProvider>
++ // The seed field observes the dynamic prompts expansion query.
+ <QueryClientProvider client={new QueryClient()}>
+ <ChakraProvider value={system}>
+ <I18nextProvider i18n={i18n}>
+ <GenerateRenderSection
- selectedModel={sd1Model}
- settings={settings}
++ selectedModel={model}
++ settings={{ ...getDefaultGenerateSettings(model), ...settings }}
+ onCommit={onCommit}
+ onCommitImmediate={vi.fn()}
+ />
+ </I18nextProvider>
+ </ChakraProvider>
+ </QueryClientProvider>
);
});
return onCommit;
};
++const renderSeed = (overrides: Partial<GenerateSettings>) => render(sd1Model, { seed: 42, ...overrides });
+const seedInput = () => host?.querySelector<HTMLInputElement>('input[aria-label="Seed"]') ?? null;
+const modeTrigger = () => host?.querySelector<HTMLButtonElement>('button[aria-label^="Seed mode:"]') ?? null;
+const menuItem = (label: string) =>
+ [...document.querySelectorAll<HTMLElement>('[role="menuitemradio"]')].find((item) =>
+ item.textContent?.startsWith(label)
+ ) ?? null;
+const preview = () => host?.querySelector('[data-testid="seed-sequence-preview"]')?.textContent ?? null;
+
afterEach(async () => {
await settle(() => root?.unmount());
host?.remove();
@@@ -117,83 -142,136 +178,217 @@@
root = null;
});
+describe('GenerateRenderSection seed field', () => {
+ it('quiets the input in random mode but keeps the entered seed on show', async () => {
- await render({ seedMode: 'random' });
++ await renderSeed({ seedMode: 'random' });
+
+ expect(seedInput()?.disabled).toBe(true);
+ expect(seedInput()?.value).toBe('42');
+ expect(host?.querySelector<HTMLButtonElement>('button[aria-label="New seed"]')?.disabled).toBe(true);
+ expect(modeTrigger()?.getAttribute('aria-label')).toBe('Seed mode: Random');
+ expect(preview()).toBeNull();
+ });
+
+ it('commits a mode chosen from the menu without touching the seed', async () => {
- const onCommit = await render({ seedMode: 'random' });
++ const onCommit = await renderSeed({ seedMode: 'random' });
+
+ await settle(() => modeTrigger()?.click());
+ const increment = menuItem('Increment');
+
+ expect(increment?.getAttribute('aria-checked')).toBe('false');
+ expect(menuItem('Random')?.getAttribute('aria-checked')).toBe('true');
+ expect(increment?.textContent).toContain('Use successive seeds, increasing by 1.');
+
+ await settle(() => increment?.click());
+
+ expect(onCommit).toHaveBeenCalledWith({ seedMode: 'increment' });
+ });
+
+ it('is operable from the keyboard and returns focus to the trigger', async () => {
- const onCommit = await render({ seedMode: 'random' });
++ const onCommit = await renderSeed({ seedMode: 'random' });
+ const trigger = modeTrigger();
+
+ await settle(() => trigger?.focus());
+ await settle(() => trigger?.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'Enter' })));
+ // The menu itself takes focus and tracks the highlighted item by attribute.
+ const menu = document.activeElement;
+
+ expect(menu?.getAttribute('role')).toBe('menu');
+
+ // Enter opens on the first mode; one step down lands on the second.
+ await settle(() => menu?.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'ArrowDown' })));
+
+ expect(document.querySelector('[role="menuitemradio"][data-highlighted]')?.getAttribute('data-value')).toBe(
+ 'fixed'
+ );
+
+ await settle(() => menu?.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'Enter' })));
+
+ expect(onCommit).toHaveBeenCalledWith({ seedMode: 'fixed' });
+ expect(document.activeElement).toBe(trigger);
+ });
+
+ it('previews the seeds the next batch will run in a stepping mode', async () => {
- await render({ batchCount: 3, seedMode: 'increment' });
++ await renderSeed({ batchCount: 3, seedMode: 'increment' });
+
+ expect(seedInput()?.disabled).toBe(false);
+ expect(preview()).toBe('Next batch: 42 → 44');
+ expect(document.getElementById(seedInput()?.getAttribute('aria-describedby') ?? '')?.textContent).toBe(
+ 'Next batch: 42 → 44'
+ );
+ });
+
+ it('previews a single-seed batch without a range', async () => {
- await render({ batchCount: 1, seedMode: 'decrement' });
++ await renderSeed({ batchCount: 1, seedMode: 'decrement' });
+
+ expect(preview()).toBe('Next batch: 42');
+ });
+
+ it('pins a recent seed by switching to fixed', async () => {
- const onCommit = await render({ seedMode: 'increment' });
++ const onCommit = await renderSeed({ seedMode: 'increment' });
+
+ await settle(() => host?.querySelector<HTMLButtonElement>('button[aria-label="Use seed 888"]')?.click());
+
+ expect(onCommit).toHaveBeenCalledWith({ seed: 888, seedMode: 'fixed' });
+ });
+
+ it('names the active mode in the collapsed summary', async () => {
- await render({ seedMode: 'decrement' });
++ await renderSeed({ seedMode: 'decrement' });
+
+ expect(host?.textContent).toContain('Decrement · 42');
+ });
+});
++
+ /**
+ * The thumb is the tooltip trigger, so `role="slider"` is the stable selector rather than
+ * `[data-part="thumb"]`. Guidance is the second slider in the section; steps is the first.
+ */
+ const guidanceThumb = (label = 'Guidance'): Element | undefined =>
+ [...(host?.querySelectorAll('[role="slider"]') ?? [])].find(
+ (candidate) => candidate.getAttribute('aria-label') === label
+ );
+
+ describe('GenerateRenderSection guidance field', () => {
+ // The guidance label and the model's stored guidance both come from the served table now,
+ // and the resolver returns nothing without it -- the field would render empty.
+ seedArchitectureCapabilities();
+
+ it('does not clamp a model default above the slider track when the field loses focus', async () => {
+ const onCommit = await render(fluxFillModel);
+ const input = host?.querySelector<HTMLInputElement>('input[aria-label="Guidance"]');
+
+ expect(input?.value).toBe('30');
+
+ await settle(() => input?.focus());
+ await settle(() => input?.blur());
+
+ // The commit is the observable, not the input's value: the field is controlled, so the value
+ // prop puts 30 back either way and only the caller sees the clamp. Dropping numberInputMax
+ // makes this a commit of 10, which is then the value every subsequent graph is compiled with.
+ expect(onCommit).not.toHaveBeenCalled();
+ });
+
+ it('still holds the guidance slider itself to its practical range', async () => {
+ await render(fluxFillModel);
+
+ expect(guidanceThumb()?.getAttribute('aria-valuenow')).toBe('10');
+ expect(guidanceThumb()?.getAttribute('aria-valuemax')).toBe('10');
+ });
+
+ it('clamps a typed guidance to the ceiling the architecture declares', async () => {
+ // The reported failure, from the other side: a project that stored FLUX Fill's 30 and then
+ // selected a FLUX.2 model. With a fixed input maximum of 100 the 30 persisted and was submitted
+ // to `flux2_denoise.guidance` (le=20), which rejects it at enqueue with nothing said in the UI.
+ const onCommit = await render(flux2Model, { cfgScale: 30 });
+ const input = host?.querySelector<HTMLInputElement>('input[aria-label="Guidance"]');
+
+ await settle(() => input?.focus());
+ await settle(() => input?.blur());
+
+ expect(onCommit).toHaveBeenCalledWith({ cfgScale: 20 });
+ });
+
+ it('starts the guidance track at the floor the architecture declares', async () => {
+ // `ernie_image_denoise.guidance_scale` is ge=1: dragging the slider to 0, or typing 0.5, used
+ // to persist and be forwarded unchanged by graph.ts.
+ const onCommit = await render(ernieModel, { cfgScale: 0.5 });
+ const input = host?.querySelector<HTMLInputElement>('input[aria-label="CFG"]');
+
+ expect(guidanceThumb('CFG')?.getAttribute('aria-valuemin')).toBe('1');
+
+ await settle(() => input?.focus());
+ await settle(() => input?.blur());
+
+ expect(onCommit).toHaveBeenCalledWith({ cfgScale: 1 });
+ });
+
+ it('holds the Ideogram 4 overrides to their own node bounds', async () => {
+ // Not the shared slider: `ideogram4_denoise` takes preset-derived optional overrides whose
+ // constraints sit on the numeric branch of an `anyOf` -- guidance ge=1/le=20, steps ge=2, mu
+ // ge=-4/le=4. The guidance control offered 0 and the mu control 0..10, both forwarded verbatim.
+ await render(ideogram4Model, { ideogram4GuidanceScale: 5, ideogram4Mu: 1, ideogram4Steps: 48 });
+ const ranges = (label: string) =>
+ [...(host?.querySelectorAll('[role="slider"]') ?? [])]
+ .filter((thumb) => thumb.getAttribute('aria-label') === label)
+ .map((thumb) => [thumb.getAttribute('aria-valuemin'), thumb.getAttribute('aria-valuemax')]);
+
+ // Two per name: the shared control first, then Ideogram's override. They carry the same
+ // accessible name in the product, which is its own (pre-existing) problem — asserting both
+ // ranges at once is what keeps this test honest about which is which.
+ expect(ranges('Guidance')).toEqual([
+ ['0', '10'],
+ ['1', '20'],
+ ]);
+ expect(ranges('Steps')).toEqual([
+ ['1', '100'],
+ ['2', '100'],
+ ]);
+ expect(ranges('Mu')).toEqual([['-4', '4']]);
+ });
+
+ it('names the broken bound on the field, not only in the Invoke button tooltip', async () => {
+ // Model selection clamps, so this is what a recalled or previously persisted value looks like:
+ // the field shows 30, Invoke is disabled elsewhere, and without this the only explanation is a
+ // tooltip on a button in another panel.
+ await render(flux2Model, { cfgScale: 30 });
+
+ expect(host?.querySelector('[role="alert"]')?.textContent).toBe('Guidance must be at most 20 for FLUX.2 dev.');
+ expect(host?.querySelector<HTMLInputElement>('input[aria-label="Guidance"]')?.value).toBe('30');
+ });
+
+ it('says nothing on the field while the value is inside the architecture bound', async () => {
+ await render(flux2Model, { cfgScale: 7 });
+
+ expect(host?.querySelector('[role="alert"]')).toBeNull();
+ });
+
+ it('drops the model-default mark the guidance track cannot place', async () => {
+ // FLUX Fill's default of 30 has no position on a track that stops at 10. Steps keeps its own
+ // mark (30 of 100), so this is the out-of-range mark going, not marks in general.
+ await render(fluxFillModel);
+ const [stepsSlider, guidanceSlider] = [
+ ...(host?.querySelectorAll('[data-scope="slider"][data-part="root"]') ?? []),
+ ];
+
+ expect(stepsSlider?.querySelectorAll('[data-part="marker"]')).toHaveLength(1);
+ expect(guidanceSlider?.querySelectorAll('[data-part="marker"]')).toHaveLength(0);
+ });
+ });
+
+ describe('GenerateRenderSection before the capability table arrives', () => {
+ // No `seedArchitectureCapabilities()` here on purpose. Generation is blocked outright without the
+ // table, so the fallback guidance range is deliberately the widest one: tightening it would clamp
+ // a stored value the user legitimately had while the capabilities are still in flight.
+ it('keeps the guidance field permissive rather than guessing a bound', async () => {
+ const onCommit = await render(fluxFillModel, { cfgScale: 30 });
+ const input = host?.querySelector<HTMLInputElement>('input[aria-label="CFG"]');
+
+ expect(input?.value).toBe('30');
+ expect(host?.querySelector('[role="alert"]')).toBeNull();
+
+ await settle(() => input?.focus());
+ await settle(() => input?.blur());
+
+ expect(onCommit).not.toHaveBeenCalled();
+ });
+ });
diff --cc invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx
index c9baf31e62,227bd22ff8..69dace30a5
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx
@@@ -1,14 -1,35 +1,24 @@@
/* oxlint-disable react-perf/jsx-no-new-object-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-jsx-as-prop */
import type { GenerateModelConfig, GenerateSettings, Ideogram4SamplerPreset } from '@features/generation/core/types';
-import {
- Badge,
- Box,
- createListCollection,
- HStack,
- Image,
- Input,
- InputGroup,
- NumberInput,
- Stack,
- Text,
-} from '@chakra-ui/react';
+import { Badge, Box, createListCollection, HStack, Image, Input, Stack, Text } from '@chakra-ui/react';
- import { getDefaultGenerateSettings, getGenerationModelPolicy } from '@features/generation/core/baseGenerationPolicies';
+ import {
+ getDefaultGenerateSettings,
+ getGenerationModelPolicy,
+ getGuidanceBoundReason,
+ } from '@features/generation/core/baseGenerationPolicies';
+import { getEffectivePrompts } from '@features/generation/core/promptTemplates';
import {
+ getDynamicPromptsConfig,
+ IDEOGRAM4_GUIDANCE_MAX,
+ IDEOGRAM4_GUIDANCE_MIN,
+ IDEOGRAM4_MU_MAX,
+ IDEOGRAM4_MU_MIN,
IDEOGRAM4_SAMPLER_PRESETS,
+ IDEOGRAM4_STEPS_MAX,
+ IDEOGRAM4_STEPS_MIN,
MAX_KREA2_SEED_VARIANCE_STRENGTH,
- SEED_MAX,
} from '@features/generation/core/settings';
-import { IconButton } from '@platform/ui/Button';
import { Combobox } from '@platform/ui/Combobox';
import { Field } from '@platform/ui/Field';
import { ModelDefaultButton } from '@platform/ui/ModelDefaultButton';
@@@ -27,6 -47,19 +37,17 @@@ import { useDynamicPrompts } from './us
const STEPS_SLIDER_MAX = 100;
+ /** The guidance/CFG slider's practical range — a UI choice about the track, not a rule. FLUX Fill
+ * recommends 30, which is off the track but a real value, so the number input keeps its own looser
+ * bound; without it the field clamps the model's own default away the first time it is focused.
+ *
+ * Where the architecture declares a ceiling (`policy.ui.guidanceMax`, e.g. `flux2_denoise.guidance`
+ * is `le=20`) that ceiling wins over this local cap, and where it declares none the local cap stays
+ * — `flux_denoise.guidance` genuinely has no upper bound. The floor comes from the architecture
+ * either way: 0 for most, 1 for the samplers whose node is `ge=1`. */
+ const GUIDANCE_SLIDER_MAX = 10;
+ const GUIDANCE_INPUT_MAX = 100;
+
-const SEED_END_ELEMENT_PROPS = { pointerEvents: 'auto', pr: '0.5' } as const;
-
interface GenerateRenderSectionProps {
settings: GenerateSettings;
selectedModel: GenerateModelConfig | undefined;
diff --cc invokeai/frontend/webv2/src/features/generation/ui/GenerateWidgetView.browser.test.tsx
index 0000000000,074b44da20..f3d2f654fa
mode 000000,100644..100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateWidgetView.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateWidgetView.browser.test.tsx
@@@ -1,0 -1,242 +1,242 @@@
+ import type { GenerationModelCatalogItem } from '@features/generation/contracts';
+ import type { ArchitectureCapabilitiesRow } from '@features/generation/core/architectureCapabilities';
+
+ import { ChakraProvider } from '@chakra-ui/react';
+ import { architectureCapabilitiesFixture } from '@features/generation/core/architectureCapabilities.testing';
+ import { ensureArchitectureCapabilitiesLoaded } from '@features/generation/data/architectureCapabilitiesStore';
+ import { accountLifecycle } from '@platform/state/accountLifecycle';
+ import { system } from '@theme/system';
+ import { act } from 'react';
+ import { createRoot, type Root } from 'react-dom/client';
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+ import { GenerateWidgetView } from './GenerateWidgetView';
+ import { GenerationUiProvider, type GenerationUiAdapter } from './GenerationUiContext';
+
+ vi.mock('react-i18next', () => {
+ const messages: Record<string, string> = {
+ 'widgets.generate.capabilitiesLoadFailed': 'Could not load model capabilities from the backend.',
+ 'widgets.generate.loadingCapabilities': 'Loading model capabilities…',
+ 'widgets.generate.retry': 'Retry',
+ };
+
+ return { useTranslation: () => ({ t: (key: string) => messages[key] ?? key }) };
+ });
+
+ /**
+ * The form has its own suite; what this view owns is the capability gate and the values it hands
+ * down, so the stub reports exactly those two.
+ */
+ vi.mock('./GenerateSettingsForm', () => ({
+ GenerateSettingsForm: ({
+ selectedModel,
+ settings,
+ }: {
+ selectedModel?: { key: string };
+ settings: { positivePrompt: string };
+ }) => (
+ // A button, so the form has something operable to receive focus, as the real one does.
+ <button data-testid="generate-form" type="button">
+ {`model:${selectedModel?.key ?? 'none'} prompt:${settings.positivePrompt}`}
+ </button>
+ ),
+ }));
+
+ const getArchitectureCapabilities = vi.fn<() => Promise<ArchitectureCapabilitiesRow[]>>();
+
+ /** A request still in flight: the fetch neither resolves nor rejects while the assertions run. */
+ const pendingRequest = (): Promise<ArchitectureCapabilitiesRow[]> =>
+ new Promise(() => {
+ // Intentionally never settles.
+ });
+
+ vi.mock('@features/generation/data/architectureCapabilitiesApi', () => ({
+ getArchitectureCapabilities: () => getArchitectureCapabilities(),
+ }));
+
+ const OTHER_MODEL: GenerationModelCatalogItem = {
+ base: 'sdxl',
+ key: 'other-sdxl',
+ name: 'Other SDXL',
+ type: 'main',
+ } as GenerationModelCatalogItem;
+
+ const STORED_MODEL: GenerationModelCatalogItem = {
+ base: 'sdxl',
+ key: 'stored-sdxl',
+ name: 'Stored SDXL',
+ type: 'main',
+ } as GenerationModelCatalogItem;
+
+ /**
+ * Catalog and stored values are pinned module constants on purpose: the project store hands the
+ * view the same references on every render, which is what let a resolve attempted before the
+ * capability table arrived stay cached after the retry that fixed it.
+ */
+ const CATALOG: readonly GenerationModelCatalogItem[] = [OTHER_MODEL, STORED_MODEL];
+
+ const STORED_VALUES = {
+ cfgRescaleMultiplier: 0,
+ cfgScale: 7.5,
+ height: 1024,
+ modelKey: STORED_MODEL.key,
+ negativePrompt: '',
+ positivePrompt: 'a saved prompt',
+ scheduler: 'euler',
+ seed: 7,
- shouldRandomizeSeed: false,
++ seedMode: 'fixed',
+ steps: 30,
+ width: 1024,
+ };
+
+ const patchGenerateSettings = vi.fn();
+
+ const buildAdapter = (): GenerationUiAdapter =>
+ ({
+ models: { catalog: CATALOG, error: null, status: 'loaded' },
+ project: { activeProjectId: 'project-1', generateValues: STORED_VALUES },
+ settings: { patchGenerateSettings },
+ }) as unknown as GenerationUiAdapter;
+
+ let host: HTMLDivElement | null = null;
+ let root: Root | null = null;
+ (globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+
+ const settle = async (run: () => void = () => undefined) => {
+ await act(async () => {
+ run();
+ await new Promise<void>((resolve) => {
+ globalThis.setTimeout(resolve, 0);
+ });
+ });
+ };
+
+ const renderView = () =>
+ settle(() =>
+ root?.render(
+ <ChakraProvider value={system}>
+ <GenerationUiProvider adapter={buildAdapter()}>
+ <GenerateWidgetView />
+ </GenerationUiProvider>
+ </ChakraProvider>
+ )
+ );
+
+ const retryButton = (): HTMLButtonElement => {
+ const button = [...document.querySelectorAll('button')].find((candidate) => candidate.textContent === 'Retry');
+
+ if (!button) {
+ throw new Error('the retry button did not render');
+ }
+
+ return button;
+ };
+
+ const formStub = (): HTMLElement | null => document.querySelector('[data-testid="generate-form"]');
+
+ beforeEach(() => {
+ host = document.createElement('div');
+ document.body.append(host);
+ root = createRoot(host);
+ getArchitectureCapabilities.mockReset();
+ patchGenerateSettings.mockClear();
+ });
+
+ afterEach(async () => {
+ await act(() => root?.unmount());
+ host?.remove();
+ host = null;
+ root = null;
+ // Returns the capability store and the core registry to their unloaded state between tests.
+ accountLifecycle.invalidate();
+ });
+
+ describe('GenerateWidgetView capability gate', () => {
+ it('announces the wait for the capability table instead of rendering the form', async () => {
+ getArchitectureCapabilities.mockReturnValue(pendingRequest());
+
+ await renderView();
+ await settle(ensureArchitectureCapabilitiesLoaded);
+
+ const region = document.querySelector('[role="status"]');
+
+ expect(region?.getAttribute('aria-busy')).toBe('true');
+ expect(region?.getAttribute('aria-live')).toBe('polite');
+ expect(region?.textContent).toContain('Loading model capabilities');
+ expect(formStub()).toBeNull();
+ });
+
+ it('restores the project model once a retry loads the table', async () => {
+ getArchitectureCapabilities.mockRejectedValueOnce(new Error('Fixture capability outage.'));
+
+ await renderView();
+ await settle(ensureArchitectureCapabilitiesLoaded);
+
+ const alert = document.querySelector('[role="alert"]');
+
+ // A localized headline, with what the request said as the detail beneath it.
+ expect(alert?.textContent).toContain('Could not load model capabilities from the backend.');
+ expect(alert?.textContent).toContain('Fixture capability outage.');
+ expect(formStub()).toBeNull();
+
+ getArchitectureCapabilities.mockResolvedValueOnce(architectureCapabilitiesFixture);
+
+ await settle(() => {
+ retryButton().focus();
+ retryButton().click();
+ });
+
+ // The stored selection, not the catalog's first entry, and the project's own prompt.
+ expect(formStub()?.textContent).toBe('model:stored-sdxl prompt:a saved prompt');
+ // The button that held focus is gone; focus moved into the form it revealed, not to <body>.
+ expect(document.activeElement).toBe(formStub());
+ });
+
+ it('leaves focus where the user moved it while the retry was in flight', async () => {
+ getArchitectureCapabilities.mockRejectedValueOnce(new Error('Fixture capability outage.'));
+
+ await renderView();
+ await settle(ensureArchitectureCapabilitiesLoaded);
+
+ let finishLoad: (rows: ArchitectureCapabilitiesRow[]) => void = () => undefined;
+ getArchitectureCapabilities.mockReturnValueOnce(
+ new Promise((resolve) => {
+ finishLoad = resolve;
+ })
+ );
+
+ await settle(() => {
+ retryButton().focus();
+ retryButton().click();
+ });
+
+ const elsewhere = document.createElement('input');
+ document.body.append(elsewhere);
+ elsewhere.focus();
+
+ await settle(() => finishLoad(architectureCapabilitiesFixture));
+
+ expect(formStub()).not.toBeNull();
+ expect(document.activeElement).toBe(elsewhere);
+ elsewhere.remove();
+ });
+
+ it('keeps focus on the retry button while its own retry is in flight', async () => {
+ getArchitectureCapabilities.mockRejectedValueOnce(new Error('Fixture capability outage.'));
+
+ await renderView();
+ await settle(ensureArchitectureCapabilitiesLoaded);
+
+ getArchitectureCapabilities.mockReturnValue(pendingRequest());
+
+ await settle(() => {
+ retryButton().focus();
+ retryButton().click();
+ });
+
+ expect(document.activeElement).toBe(retryButton());
+ expect(retryButton().getAttribute('aria-busy')).toBe('true');
+ expect(retryButton().disabled).toBe(false);
+ expect(document.querySelector('[role="alert"]')?.getAttribute('aria-busy')).toBe('true');
+ });
+ });