I am experiencing an issue while running end-to-end (E2E) tests in a Docker container on my Mac with an M2 chip. When I attempt to run the tests, I receive the following error message:
* (MatchError) no match of right hand side value: {:error, "unknown error: Chrome failed to start: crashed.\n (unknown error: DevToolsActivePort file doesn't exist)\n (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\n (Driver info: chromedriver=114.0.5735.90,platform=Linux 6.4.16-linuxkit x86_64)"}
Below is the relevant part of my Dockerfile.localdev:
# Node.js, npm, and yarn installation
RUN curl -fsSL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz | tar -xJv -C /usr/local --strip-components=1 --no-same-owner && \
ln -s /usr/local/bin/node /usr/local/bin/nodejs && \
npm install -g npm@${NPM_VERSION} && \
npm install -g yarn@${YARN_VERSION}
# Chrome headless for running browser tests
RUN yum -y install liberation-* && \
yum -y install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm && \
LATEST_CHROMEDRIVER_VERSION="$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE)" && \
wget https://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
unzip chromedriver_linux64.zip -d /usr/local/bin && \
rm chromedriver_linux64.zip
Environment Information:
Host Machine: Mac with M2 chip
Docker Container OS: Amazon Linux 2
Node Version: 16.17.0
Chrome Version: latest stable
ChromeDriver Version: 114.0.5735.90
Attempts Made:
I tried changing Chrome and ChromeDriver versions without success. The tests run fine in the CI/CD pipeline on GitLab but consistently fail on my local machine. It's puzzling why it's working perfectly in the GitLab pipeline but not locally, and I can't figure out what's different or wrong in my local setup.