How to run electron inside an alpine docker image with Testcafe?

Viewed 1622

I'm trying to run my e2e Tests for an electron app with Testcafe on gitlab inside a docker image.

Therefor i use a docker image from Testcafe which i only extend by installing yarn.

The gitlab script just builds my e2e Tests (which succeeds), but electron does not come up and the pipeline stops with this error:

$ /opt/testcafe/docker/testcafe-docker.sh electron:./ci ./test/e2e/ --screenshots takeOnFails=true
Using locally installed version of TestCafe.
Error: spawn /builds/myFancyProject/node_modules/electron/dist/electron ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

Any suggestion to solve this error?

This is my simple docker file:

FROM testcafe/testcafe

USER root

RUN apk add --update yarn
1 Answers

The official TestCafe Docker image uses Alpine as a base image. Electron doesn't support Alpine right now: https://github.com/electron/electron/issues/9662#issuecomment-420480342. We have plans to offer more official images, including Ubuntu-based ones, but I cannot give you any ETA as to when they will be available: https://github.com/DevExpress/testcafe/issues/3100

Currently, you can use circleci/node:latest-browsers and install TestCafe with npm if you want to use Electron with TestCafe and Docker.

Related