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
fix(webv2): audit accessibility only once animations have settled
Lincoln Steine69cf8473ad5
diff --git a/invokeai/frontend/webv2/package.json b/invokeai/frontend/webv2/package.jsonindex dfd18cce68..deb35ccf27 100644--- a/invokeai/frontend/webv2/package.json+++ b/invokeai/frontend/webv2/package.json@@ -7,7 +7,7 @@"#architecture/source-analysis": "./src/architecture/tsSourceAnalysis.ts"},"scripts": {- "architecture:check": "vitest run --config vitest.config.mts src/architecture/dependencyPolicy.test.ts src/architecture/workbenchOwnership.test.ts src/architecture/architectureWorkflow.test.ts src/architecture/canvasSeamOwnership.test.ts src/architecture/tsSourceAnalysis.test.ts src/architecture/secureContextApis.test.ts && node scripts/write-workbench-ownership-inventory.mjs && node scripts/write-contract-caller-matrix.mjs && node scripts/write-canvas-import-matrix.mjs",+ "architecture:check": "vitest run --config vitest.config.mts src/architecture/dependencyPolicy.test.ts src/architecture/workbenchOwnership.test.ts src/architecture/architectureWorkflow.test.ts src/architecture/canvasSeamOwnership.test.ts src/architecture/tsSourceAnalysis.test.ts src/architecture/secureContextApis.test.ts src/architecture/axeAudits.test.ts && node scripts/write-workbench-ownership-inventory.mjs && node scripts/write-contract-caller-matrix.mjs && node scripts/write-canvas-import-matrix.mjs","build": "pnpm run lint && vite build","check:architecture": "pnpm run lint && pnpm run test:all && pnpm run test:performance:architecture && pnpm run test:project-files:browser","check:release": "pnpm run check:architecture && pnpm run test:accessibility:browser",diff --git a/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjs b/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjsindex 5324a097d2..eff48e4e57 100644--- a/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjs+++ b/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjs@@ -41,6 +41,29 @@ const waitForPreview = async () => {const waitForSettledDocument = async (page) => {await page.evaluate(async () => {await document.fonts.ready;+ // Every audit below reads rendered appearance, and a surface still animating in composites+ // its text over whatever is behind it -- a dialog caught mid fade-in audits as a contrast+ // failure its palette does not have. Two frames do not cover a 200ms fade, so wait on the+ // animations themselves. Mirrors `settleAnimations` in+ // `src/platform/browser/settleAnimations.testing.ts`, re-expressed here because this body is+ // serialised into the page and cannot import it; the two must change together.+ await Promise.allSettled(+ document+ .getAnimations({ subtree: true })+ .filter((animation) => {+ const timing = animation.effect?.getComputedTiming();+ const duration = typeof timing?.duration === 'number' ? timing.duration : 0;++ // A spinner, a shimmering skeleton, or a paused animation never finishes.+ return (+ timing?.iterations !== Infinity &&+ Number.isFinite(duration) &&+ animation.playbackRate !== 0 &&+ animation.playState !== 'paused'+ );+ })+ .map((animation) => animation.finished)+ );await new Promise((resolveFrame) => {requestAnimationFrame(() => requestAnimationFrame(resolveFrame));});@@ -937,6 +960,7 @@ const runSettingsJourney = async (browser) => {await numericAttention.focus();await numericAttention.press('Space');assert.equal(await numericAttention.isChecked(), true);+ await waitForSettledDocument(page);await assertNoAxeViolations(page, `${id}:search`, SETTINGS_DIALOG_SCOPE);await dialog.getByRole('button', { exact: true, name: 'Show in section' }).click();await expectFocused(numericAttention, 'Revealing a setting should focus its control.');@@ -947,9 +971,6 @@ const runSettingsJourney = async (browser) => {await gear.press('Enter');const popover = page.locator('[data-scope="popover"][data-part="content"][data-state="open"]');await popover.waitFor();- await popover.evaluate(async (element) => {- await Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished));- });await waitForSettledDocument(page);// Quick settings are nonmodal; scan their popup independently of the workbench behind it.await assertNoAxeViolations(page, `${id}:quick`, { include: ['[data-scope="popover"][data-part="content"]'] });diff --git a/invokeai/frontend/webv2/src/architecture/axeAudits.test.ts b/invokeai/frontend/webv2/src/architecture/axeAudits.test.tsnew file mode 100644index 0000000000..f2813785cf--- /dev/null+++ b/invokeai/frontend/webv2/src/architecture/axeAudits.test.ts@@ -0,0 +1,40 @@+import { describe, expect, it } from 'vitest';++/**+ * An accessibility audit must read settled UI.+ *+ * `axe.run` on a surface that is still animating in measures contrast against a+ * half-composited backdrop and reports colour failures that do not exist. Whether an audit+ * lands inside that window depends on machine load — in a browser run, on how many other test+ * files the suite is scheduling — so the failure surfaces for whoever next adds an unrelated+ * test file, in a test they did not touch. That is expensive to diagnose and easy to+ * misattribute, which is why the pairing is enforced here rather than left to a comment.+ *+ * Scope is the `src/` tree, which is what this glob can reach. The release journey runner+ * (`scripts/run-accessibility-journeys.mjs`) audits from Node against a Playwright page and+ * cannot import the helper — its body is serialised into the browser — so it carries the same+ * wait inside `waitForSettledDocument` and is not covered here.+ */+const sources = import.meta.glob('../**/*.{ts,tsx}', {+ eager: true,+ import: 'default',+ query: '?raw',+}) as Record<string, string>;++const ALLOWED = new Set([+ '../platform/browser/auditAccessibility.testing.ts',+ // Audits un-settled UI on purpose, to hold on to a reproduction of the bug the helper fixes.+ '../platform/browser/auditAccessibility.browser.test.ts',+]);+const AXE_RUN = /\baxe\s*\.\s*run\s*\(/;++describe('accessibility audits', () => {+ it('routes every audit under src/ through the helper that settles animations first', () => {+ const offenders = Object.entries(sources)+ .filter(([path]) => !ALLOWED.has(path))+ .filter(([, text]) => AXE_RUN.test(text))+ .map(([path]) => path.replace(/^\.\.\//, ''));++ expect(offenders).toEqual([]);+ });+});diff --git a/invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.visual.browser.test.tsx b/invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.visual.browser.test.tsxindex 583b47bc58..3fb57e1e78 100644--- a/invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.visual.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.visual.browser.test.tsx@@ -1,7 +1,8 @@import { ChakraProvider } from '@chakra-ui/react';+import { auditAccessibility } from '@platform/browser/auditAccessibility.testing';+import { settleAnimations } from '@platform/browser/settleAnimations.testing';import { QueryClient, QueryClientProvider } from '@tanstack/react-query';import { system } from '@theme/system';-import axe from 'axe-core';import { createInstance } from 'i18next';import { act } from 'react';import { createRoot, type Root } from 'react-dom/client';@@ -119,13 +120,16 @@ it('renders the font library with the real English locale', async () => {await page.getByRole('button', { name: /Example Sans Variable/ }).click();await expect.element(page.getByRole('heading', { name: 'Example Sans Variable' })).toBeVisible();await expect.element(page.getByText('Variation axes', { exact: true })).toBeVisible();+ await settleAnimations();await page.screenshot({ path: '../../../../artifacts/fonts/fonts-page-real-en.png' });await page.getByRole('button', { name: 'Filter fonts' }).click();await expect.element(page.getByRole('menuitemradio', { name: 'All', exact: true })).toHaveAttribute('aria-checked', 'true');- expect((await axe.run(host!)).violations).toEqual([]);- expect((await axe.run(document.querySelector('[role="menu"]')!)).violations).toEqual([]);+ const menu = document.querySelector('[role="menu"]')!;++ expect(await auditAccessibility(host!)).toEqual([]);+ expect(await auditAccessibility(menu)).toEqual([]);await page.screenshot({ path: '../../../../artifacts/fonts/fonts-filter-real-en.png' });await page.getByRole('menuitemradio', { name: 'My fonts', exact: true }).click();await vi.waitFor(() =>@@ -138,6 +142,7 @@ it('renders the font library with the real English locale', async () => {await expect.element(page.getByRole('button', { name: 'Filter fonts' })).toHaveFocus();await page.getByRole('tab', { name: 'Add Fonts' }).click();await expect.element(page.getByRole('button', { name: 'Upload fonts' })).toBeVisible();+ await settleAnimations();await page.screenshot({ path: '../../../../artifacts/fonts/fonts-add-real-en.png' });});@@ -148,7 +153,7 @@ it('uses the manager empty state and opens Add Fonts from its action', async ()}));await renderPage();await expect.element(page.getByText('No fonts available', { exact: true })).toBeVisible();- expect((await axe.run(host!)).violations).toEqual([]);+ expect(await auditAccessibility(host!)).toEqual([]);await page.screenshot({ path: '../../../../artifacts/fonts/fonts-empty-real-en.png' });await page.getByRole('button', { name: 'Add Fonts', exact: true }).click();await expect.element(page.getByRole('button', { name: 'Upload fonts', exact: true })).toBeVisible();diff --git a/invokeai/frontend/webv2/src/platform/browser/auditAccessibility.browser.test.ts b/invokeai/frontend/webv2/src/platform/browser/auditAccessibility.browser.test.tsnew file mode 100644index 0000000000..4acfebd7d3--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/browser/auditAccessibility.browser.test.ts@@ -0,0 +1,59 @@+import { afterEach, expect, it } from 'vitest';++import { auditAccessibility } from './auditAccessibility.testing';++/**+ * The reason the helper exists, reproduced in miniature.+ *+ * A panel whose colours pass contrast comfortably at rest fails the audit while it is fading+ * in, because the audit composites its text over whatever is behind it. This is what took down+ * `MissingFontsDialog` whenever the suite grew a file: nothing about the palette was wrong, the+ * audit simply ran a few frames early.+ *+ * The fade here is slow enough that the un-settled audit lands inside it with a margin of+ * three orders of magnitude over the assertion that follows, so the "before" case is not itself+ * a race.+ */++const FADE_MS = 800;++let host: HTMLDivElement | null = null;+let styles: HTMLStyleElement | null = null;++/** Light text on a dark panel: ~15:1 at rest, far inside the 4.5:1 rule. */+const render = (): HTMLDivElement => {+ styles = document.head.appendChild(document.createElement('style'));+ styles.textContent = `@keyframes audit-probe-fade { from { opacity: 0.15 } to { opacity: 1 } }+ .audit-probe { animation: audit-probe-fade ${String(FADE_MS)}ms both;+ background: #10131a; color: #f2f5fa; font-size: 16px; padding: 16px; width: 320px }`;++ host = document.body.appendChild(document.createElement('div'));+ host.className = 'audit-probe';+ host.textContent = 'Replace all uses of this missing font';++ return host;+};++afterEach(() => {+ host?.remove();+ styles?.remove();+ host = null;+ styles = null;+});++it('reports contrast failures on a palette that is fine, when the surface is still fading in', async () => {+ const panel = render();+ // Deliberately NOT settled: this is the bug, kept as an executable description of it.+ const { default: axe } = await import('axe-core');+ const midFlight = (await axe.run(panel)).violations;++ expect(panel.getAnimations()[0]?.playState).toBe('running');+ expect(midFlight.map((violation) => violation.id)).toContain('color-contrast');+});++it('reports nothing once the fade has finished, which is what the helper waits for', async () => {+ const panel = render();++ expect(await auditAccessibility(panel)).toEqual([]);+ expect(panel.getAnimations().every((animation) => animation.playState === 'finished')).toBe(true);+});diff --git a/invokeai/frontend/webv2/src/platform/browser/auditAccessibility.testing.ts b/invokeai/frontend/webv2/src/platform/browser/auditAccessibility.testing.tsnew file mode 100644index 0000000000..ffc18da0d9--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/browser/auditAccessibility.testing.ts@@ -0,0 +1,22 @@+import axe from 'axe-core';++import { settleAnimations } from './settleAnimations.testing';++/**+ * Run an accessibility audit against settled UI.+ *+ * The settling is the point. Auditing a surface that is still animating in reports colour+ * contrast against a half-composited backdrop — see {@link settleAnimations} — and the failure+ * is load-dependent, so it lands on whoever next adds an unrelated test file rather than on+ * whoever wrote the audit. Pairing the two here rather than leaving `settleAnimations` to be+ * remembered at each call site is what keeps that from coming back; `architecture/axeAudits`+ * holds callers to it.+ *+ * Returns the violations rather than asserting, so a caller still chooses what to expect of+ * them — usually `toEqual([])`, which prints the offending nodes and colours on failure.+ */+export const auditAccessibility = async (target: Element): Promise<axe.Result[]> => {+ await settleAnimations();++ return (await axe.run(target)).violations;+};diff --git a/invokeai/frontend/webv2/src/platform/browser/settleAnimations.browser.test.ts b/invokeai/frontend/webv2/src/platform/browser/settleAnimations.browser.test.tsnew file mode 100644index 0000000000..f59053c604--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/browser/settleAnimations.browser.test.ts@@ -0,0 +1,124 @@+import { afterEach, beforeEach, expect, it } from 'vitest';++import { settleAnimations } from './settleAnimations.testing';++/**+ * The helper's whole job is to be awaited before an appearance assertion, so the two ways it+ * can fail are both silent: returning early leaves the flake it was written to remove, and+ * waiting on an animation that never ends hangs the run instead of failing it.+ *+ * The never-ending cases have no explicit timeout here on purpose — a regression surfaces as+ * this file's own test timeout, which names the case. A hand-rolled deadline would only trade+ * that for a wrong-reason failure whenever the machine stalls past it, which is the very class+ * of bug this helper exists to remove.+ */++let host: HTMLDivElement | null = null;+let styles: HTMLStyleElement | null = null;+/** A second container, for animations that must sit OUTSIDE the subtree a test passes in. */+let detached: HTMLDivElement;++const FADE: Keyframe[] = [{ opacity: 0 }, { opacity: 1 }];+const CSS_FADE_MS = 400;++const container = (): HTMLDivElement => (host ??= document.body.appendChild(document.createElement('div')));++const scripted = (options: KeyframeAnimationOptions): Animation =>+ container().appendChild(document.createElement('div')).animate(FADE, options);++/**+ * A CSS-driven animation, which is what the components under test actually run and the only+ * kind whose `finished` rejects when its element is removed.+ */+const cssAnimated = (): { animation: Animation; element: HTMLDivElement } => {+ styles ??= document.head.appendChild(document.createElement('style'));+ styles.textContent = `@keyframes settle-probe { from { opacity: 0 } to { opacity: 1 } }+ .settle-probe { animation: settle-probe ${String(CSS_FADE_MS)}ms }`;++ const element = container().appendChild(document.createElement('div'));++ element.className = 'settle-probe';++ return { animation: element.getAnimations()[0]!, element };+};++beforeEach(() => {+ detached = document.body.appendChild(document.createElement('div'));+});++afterEach(() => {+ detached.remove();+ host?.remove();+ styles?.remove();+ host = null;+ styles = null;+});++it('waits for a running animation in the subtree rather than returning on the first frame', async () => {+ const animation = scripted({ duration: 120, fill: 'forwards' });++ await settleAnimations(host!);++ expect(animation.playState).toBe('finished');+});++it('finds animations anywhere in the document when given no subtree, since backdrops and menus are portalled', async () => {+ // Every call site relies on this default: what an audit reads is the composite, and the+ // backdrop behind a dialog is a sibling of it rather than a descendant. The root element is+ // included too, which is what distinguishes the document from `document.body`.+ const outside = detached.appendChild(document.createElement('div'));+ const sibling = outside.animate(FADE, { duration: 120, fill: 'forwards' });+ // Deliberately the longest of the three: if the helper only walked `document.body`, it would+ // return when the sibling finished and leave this one running.+ const root = document.documentElement.animate([{ opacity: 0.99 }, { opacity: 1 }], { duration: 400 });++ await settleAnimations();++ expect([sibling.playState, root.playState]).toEqual(['finished', 'finished']);+});++it('skips an animation that repeats forever instead of hanging on one that never finishes', async () => {+ // A spinner or shimmering skeleton in the audited page. Awaiting it would never return, so a+ // regression here shows up as this test timing out rather than as a bad assertion.+ scripted({ duration: 50, iterations: Infinity });+ const finite = scripted({ duration: 50, fill: 'forwards' });++ await settleAnimations(host!);++ expect(finite.playState).toBe('finished');+});++it.each([+ ['paused', (animation: Animation) => animation.pause()],+ ['stopped by a zero playback rate', (animation: Animation) => (animation.playbackRate = 0)],+])('skips an animation %s, which reports finite timing but never settles', async (_case, disrupt) => {+ // These report `iterations: 1`, so the obvious repeats-forever check does not catch them.+ disrupt(scripted({ duration: 50 }));+ const finite = scripted({ duration: 50, fill: 'forwards' });++ await settleAnimations(host!);++ expect(finite.playState).toBe('finished');+});++it('skips an animation with an infinite duration, which also reports finite iterations', async () => {+ scripted({ duration: Infinity });+ const finite = scripted({ duration: 50, fill: 'forwards' });++ await settleAnimations(host!);++ expect(finite.playState).toBe('finished');+});++it('settles when an animating element is removed mid-flight, which rejects rather than finishes', async () => {+ const { animation, element } = cssAnimated();+ const rejection = expect(animation.finished).rejects.toThrow();+ const settled = settleAnimations(host!);++ element.remove();++ // Resolving well inside the animation's own duration is the assertion: the helper returned+ // because the animation was cancelled, not because it waited the fade out.+ await expect(settled).resolves.toBeUndefined();+ await rejection;+});diff --git a/invokeai/frontend/webv2/src/platform/browser/settleAnimations.testing.ts b/invokeai/frontend/webv2/src/platform/browser/settleAnimations.testing.tsnew file mode 100644index 0000000000..32fb268023--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/browser/settleAnimations.testing.ts@@ -0,0 +1,65 @@+/**+ * Wait for animations to finish before asserting on how something looks.+ *+ * `toBeVisible()` is satisfied the moment an element is laid out, which for anything that+ * fades or scales in is several frames before it looks like itself. An assertion that reads+ * rendered appearance — a contrast audit, a screenshot, a measured box — taken in that window+ * reads the animation's midpoint instead: a Chakra dialog caught at `opacity: 0.22` composites+ * its text over the backdrop and audits as 1.18:1 against a 4.5:1 rule, reporting a palette+ * failure that does not exist.+ *+ * That window is real but short, so whether an assertion lands inside it depends on how busy+ * the machine is — which in a browser run means how many OTHER test files the suite happens to+ * be scheduling. A suite that passes at 204 files starts failing at 205, in a file the new one+ * never touches.+ *+ * Test-only: it needs a real browser's animation timeline, and production code has no reason+ * to block on one.+ */++/**+ * Whether awaiting this animation will ever end.+ *+ * Four states never settle, and awaiting any of them turns a test into a timeout rather than a+ * failure. Only the first is obvious, and checking `iterations` alone does not catch the rest:+ * measured in this suite's Chromium, a paused animation, one with `playbackRate: 0`, and one+ * with an infinite `duration` all report `iterations: 1` and leave `finished` pending forever.+ * The scope below is the whole document, so one of these anywhere on the page would otherwise+ * hang every caller.+ */+const willFinish = (animation: Animation): boolean => {+ const timing = animation.effect?.getComputedTiming();+ const duration = typeof timing?.duration === 'number' ? timing.duration : 0;++ return (+ timing?.iterations !== Infinity &&+ Number.isFinite(duration) &&+ animation.playbackRate !== 0 &&+ animation.playState !== 'paused'+ );+};++/**+ * Resolve once every animation running when it is called has finished.+ *+ * Defaults to the whole document rather than the subtree under assertion, because what an+ * appearance assertion reads is the COMPOSITE. A Chakra dialog's backdrop is a sibling of its+ * positioner, not a descendant, and fades over `slow` while the content in front of it fades+ * over `moderate` — so settling only `[role="dialog"]` returns with the backdrop a third of the+ * way through, and the first translucent surface anyone audits gets this flake straight back.+ * Portalled content (menus, popovers) sits outside the caller's subtree for the same reason.+ * Animations that never finish are filtered out, so the wider scope costs nothing.+ *+ * `allSettled`, not `all`: removing an element cancels its CSS animation, which rejects the+ * `finished` promise captured here with an `AbortError` (measured — and CSS animations are what+ * the components under test use). A subtree that stopped animating because it went away has+ * settled too, and an unhandled rejection would fail the test for the wrong reason.+ */+export const settleAnimations = async (root: Document | Element = document): Promise<void> => {+ await Promise.allSettled(+ root+ .getAnimations({ subtree: true })+ .filter(willFinish)+ .map((animation) => animation.finished)+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/projects/components/ProjectFileOptionsProvider.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/projects/components/ProjectFileOptionsProvider.browser.test.tsxindex 0c3a6ab3b0..c835c9d911 100644--- a/invokeai/frontend/webv2/src/workbench/projects/components/ProjectFileOptionsProvider.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/projects/components/ProjectFileOptionsProvider.browser.test.tsx@@ -1,5 +1,6 @@-/* oxlint-disable react-perf/jsx-no-new-function-as-prop */import { ChakraProvider } from '@chakra-ui/react';+/* oxlint-disable react-perf/jsx-no-new-function-as-prop */+import { settleAnimations } from '@platform/browser/settleAnimations.testing';import { accountLifecycle, captureAccountScope } from '@platform/state/accountLifecycle';import { system } from '@theme/system';import { createInstance } from 'i18next';@@ -76,6 +77,7 @@ it('defaults to references, includes files only when selected, and restores focuawait act(() => trigger.click());await act(() => page.getByText('Include font files', { exact: true }).click());await expect.element(page.getByText(/permission to redistribute/)).toBeVisible();+ await settleAnimations();await page.screenshot({ path: '../../../../artifacts/fonts/export-dialog.png' });await act(() => page.getByRole('button', { name: 'Export project', exact: true }).click());expect(results).toEqual([{ includeFonts: false }, { includeFonts: true }]);diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.browser.test.tsxindex 5922588d56..4353a38db4 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.browser.test.tsx@@ -2,12 +2,12 @@ import type * as FontsFeature from '@features/fonts';import type { CanvasEngine } from '@workbench/canvas-engine/api';import { ChakraProvider } from '@chakra-ui/react';+import { auditAccessibility } from '@platform/browser/auditAccessibility.testing';import { accountLifecycle } from '@platform/state/accountLifecycle';import { ApiError } from '@platform/transport/http';import { QueryClient, QueryClientProvider } from '@tanstack/react-query';import { system } from '@theme/system';import { createEmptyCanvasState } from '@workbench/canvasMigration';-import axe from 'axe-core';import { createInstance } from 'i18next';import { act } from 'react';import { createRoot, type Root } from 'react-dom/client';@@ -90,7 +90,7 @@ it('groups affected layers, keeps a warning after dismissal, and reopens recoverawait expect.element(page.getByRole('dialog', { name: 'Missing fonts' })).toBeVisible();await expect.element(page.getByText('Used by 3 text layers')).toBeVisible();await expect.element(page.getByRole('button', { name: 'Replace all uses' })).toBeDisabled();- expect((await axe.run(document.querySelector('[role="dialog"]')!)).violations).toEqual([]);+ expect(await auditAccessibility(document.querySelector('[role="dialog"]')!)).toEqual([]);await page.screenshot({ path: '../../../../artifacts/fonts/missing-fonts-dialog.png' });await act(() => page.getByRole('button', { name: 'Continue with previews' }).click());await expect.element(page.getByRole('dialog')).not.toBeInTheDocument();