diff --git a/packages/lexical-playground/__tests__/utils/index.mjs b/packages/lexical-playground/__tests__/utils/index.mjs index 10425d9125d9..385616c5a127 100644 --- a/packages/lexical-playground/__tests__/utils/index.mjs +++ b/packages/lexical-playground/__tests__/utils/index.mjs @@ -7,12 +7,21 @@ */ import {expect, test as base} from '@playwright/test'; +import glob from 'glob'; import {randomUUID} from 'node:crypto'; import prettier from 'prettier'; import {URLSearchParams} from 'url'; import {selectAll} from '../keyboardShortcuts/index.mjs'; +function findAsset(pattern) { + const resolvedPattern = `./packages/lexical-playground/build/assets/${pattern}`; + for (const fn of glob.sync(resolvedPattern)) { + return fn; + } + throw new Error(`Missing asset at ${resolvedPattern}`); +} + export const E2E_PORT = process.env.E2E_PORT || 3000; export const E2E_BROWSER = process.env.E2E_BROWSER; export const IS_MAC = process.platform === 'darwin'; @@ -26,11 +35,9 @@ export const LEGACY_EVENTS = process.env.E2E_EVENTS_MODE === 'legacy-events'; export const SAMPLE_IMAGE_URL = E2E_PORT === 3000 ? '/src/images/yellow-flower.jpg' - : '/assets/yellow-flower.a2a7c7a2.jpg'; + : findAsset('yellow-flower*.jpg'); export const SAMPLE_LANDSCAPE_IMAGE_URL = - E2E_PORT === 3000 - ? '/src/images/landscape.jpg' - : '/assets/landscape.21352c66.jpg'; + E2E_PORT === 3000 ? '/src/images/landscape.jpg' : findAsset('landscape*.jpg'); export const LEXICAL_IMAGE_BASE64 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAMAAAAKE/YAAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACKFBMVEUzMzM0NDQ/Pz9CQkI7Ozu7u7vZ2dnX19fa2tqPj4/c3Nz///+lpaXW1tb7+/v5+fn9/f38/PyioqI3NzdjY2NtbW1wcHDR0dGpqalqampUVFS+vr6Ghoa/v7+Hh4dycnKdnZ2cnJxgYGBaWlqampqFhYU4ODitra2Li4uAgI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