Playwright docker improvements (#33213)

* Clean up playwright-common Dockerfile

* Speed up element-web docker build

* Wire up element-desktop playwright tests via nx

* Better debug logs for Element Desktop playwright in CI

* Iterate

* Iterate

* Fix element-desktop screenshot docker

* @electron/fuses

* Partial revert
This commit is contained in:
Michael Telatynski
2026-04-21 09:58:16 +00:00
committed by GitHub
parent b06422d848
commit 133a56da65
10 changed files with 112 additions and 26 deletions
+11 -5
View File
@@ -1,13 +1,19 @@
FROM mcr.microsoft.com/playwright:v1.59.1-jammy@sha256:8a0360d39d1973be506dd59002904a774f6d697d4946c94063b3fd006461c8ff
WORKDIR /work/element-desktop
WORKDIR /work
RUN apt-get update && apt-get -y install xvfb dbus-x11 && apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*
RUN apt-get update && \
apt-get -y install xvfb dbus-x11 && \
apt-get purge -y --auto-remove && \
rm -rf /var/lib/apt/lists/* && \
corepack enable
# Create node_modules & dist dirs so that the volumes have the correct permissions
RUN mkdir node_modules dist && chown 1000:1000 node_modules dist
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
ENV GITHUB_ACTIONS=1
ENV DEBUG=pw:browser
# switch to node user
USER 1000:1000
COPY docker-entrypoint.sh /opt/docker-entrypoint.sh
COPY apps/desktop/playwright/docker-entrypoint.sh /opt/docker-entrypoint.sh
ENTRYPOINT ["bash", "/opt/docker-entrypoint.sh"]
+1 -7
View File
@@ -8,11 +8,5 @@ sleep 2
export DISPLAY=:99
pnpm install --frozen-lockfile
pnpm build -l --dir
PLAYWRIGHT_HTML_OPEN=never ELEMENT_DESKTOP_EXECUTABLE="./dist/linux-unpacked/element-desktop" \
npx playwright test --update-snapshots --reporter line,html "$1"
# Clean up
rm -R core qemu_* || exit 0
exec pnpm -C apps/desktop exec playwright test --update-snapshots --reporter line,html "$1"
@@ -69,7 +69,13 @@ export const test = base.extend<Fixtures>({
const args = ["--profile-dir", tmpDir, ...extraArgs];
if (process.env.GITHUB_ACTIONS) {
args.push("--disable-gpu");
if (process.platform === "linux") {
if (process.getuid() === 0) {
args.push("--no-sandbox");
}
// GitHub Actions hosted runner lacks dbus and a compatible keyring, so we need to force plaintext storage
args.push("--storage-mode", "force-plaintext");
} else if (process.platform === "darwin") {