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:
@@ -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"]
|
||||
|
||||
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user