From fc870bd676dba905ec949ff881973afed9de4c3e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 31 Mar 2026 09:54:23 +0200 Subject: [PATCH] Fix playwright tests locally (#32974) --- .../playwright/e2e/chat-export/html-export.spec.ts | 2 +- .../src/components/structures/RoomSearchView.tsx | 13 +------------ apps/web/src/components/structures/RoomView.tsx | 1 - .../playwright-common/playwright-screenshots.sh | 2 +- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/apps/web/playwright/e2e/chat-export/html-export.spec.ts b/apps/web/playwright/e2e/chat-export/html-export.spec.ts index 371111151e..aed032b09b 100644 --- a/apps/web/playwright/e2e/chat-export/html-export.spec.ts +++ b/apps/web/playwright/e2e/chat-export/html-export.spec.ts @@ -122,7 +122,7 @@ test.describe("HTML Export", () => { await download.saveAs(zipPath); const zip = await extractZipFileToPath(zipPath, dirPath); - await page.goto(`file://${dirPath}/${Object.keys(zip.files)[0]}/messages.html`); + await page.goto(`file://${dirPath}/${Object.keys(zip.files).find((f) => f.endsWith("/messages.html"))}`); await expect(page).toMatchScreenshot("html-export.png", { mask: [page.locator(".mx_TimelineSeparator")], css: ` diff --git a/apps/web/src/components/structures/RoomSearchView.tsx b/apps/web/src/components/structures/RoomSearchView.tsx index 80ad9ad11e..bfd800e7d9 100644 --- a/apps/web/src/components/structures/RoomSearchView.tsx +++ b/apps/web/src/components/structures/RoomSearchView.tsx @@ -40,7 +40,6 @@ interface Props { scope: SearchScope; inProgress: boolean; promise: Promise; - abortController?: AbortController; className: string; onUpdate(this: void, inProgress: boolean, results: ISearchResults | null, error: Error | null): void; ref?: Ref; @@ -48,16 +47,7 @@ interface Props { // XXX: todo: merge overlapping results somehow? // XXX: why doesn't searching on name work? -export const RoomSearchView = ({ - term, - scope, - promise, - abortController, - className, - onUpdate, - inProgress, - ref, -}: Props): JSX.Element => { +export const RoomSearchView = ({ term, scope, promise, className, onUpdate, inProgress, ref }: Props): JSX.Element => { const client = useContext(MatrixClientContext); const roomContext = useScopedRoomContext("showHiddenEvents"); const [highlights, setHighlights] = useState(null); @@ -144,7 +134,6 @@ export const RoomSearchView = ({ handleSearchResult(promise); return () => { aborted.current = true; - abortController?.abort(); }; }, []); // eslint-disable-line react-hooks/exhaustive-deps diff --git a/apps/web/src/components/structures/RoomView.tsx b/apps/web/src/components/structures/RoomView.tsx index 251a2bc467..b1fc5d8f18 100644 --- a/apps/web/src/components/structures/RoomView.tsx +++ b/apps/web/src/components/structures/RoomView.tsx @@ -2563,7 +2563,6 @@ export class RoomView extends React.Component { term={this.state.search.term} scope={this.state.search.scope} promise={this.state.search.promise} - abortController={this.state.search.abortController} inProgress={!!this.state.search.inProgress} className={this.messagePanelClassNames} onUpdate={this.onSearchUpdate} diff --git a/packages/playwright-common/playwright-screenshots.sh b/packages/playwright-common/playwright-screenshots.sh index e91a7e799f..7fc1a1fa33 100755 --- a/packages/playwright-common/playwright-screenshots.sh +++ b/packages/playwright-common/playwright-screenshots.sh @@ -23,7 +23,7 @@ IMAGE_NAME="ghcr.io/element-hq/element-web/playwright-server:$PW_VERSION" docker pull "$IMAGE_NAME" 2>/dev/null || build_image "$IMAGE_NAME" # Start the playwright-server in docker -CONTAINER=$(docker run --network=host --rm -d -e PORT="$WS_PORT" "$IMAGE_NAME") +CONTAINER=$(docker run --network=host -v /tmp:/tmp --rm -d -e PORT="$WS_PORT" "$IMAGE_NAME") # Set up an exit trap to clean up the docker container clean_up() { ARG=$?