diff --git a/e2e-tests/cypress/Dockerfile b/e2e-tests/cypress/Dockerfile index 5251e071a..8119ea08d 100644 --- a/e2e-tests/cypress/Dockerfile +++ b/e2e-tests/cypress/Dockerfile @@ -2,64 +2,31 @@ # Dockerfile to create a ready-to-use Cypress Docker image for end-to-end # testing. # -# This Dockerfile is based on the Dockerfile using Node.js 16.14.2 and -# Cypress 10.3.0 -# (https://github.com/cypress-io/cypress-docker-images/blob/master/included/10.3.0/Dockerfile) -# from Cypress.io Docker images. +# Based on the images containing several browsers, provided by Cypress.io +# (https://github.com/cypress-io/cypress-docker-images/tree/master/browsers) +# this Dockerfile is based a slim Linux Dockerfile using Node.js 16.14.2. +# +# Here the latest stable versions of the browsers Chromium and Firefox are +# installed before installing Cypress. ############################################################################### -FROM cypress/browsers:node16.14.2-slim-chrome100-ff99-edge +FROM cypress/base:16.14.2-slim -# avoid too many progress messages -# https://github.com/cypress-io/cypress/issues/1243 -ENV CI=1 \ -# disable shared memory X11 affecting Cypress v4 and Chrome -# https://github.com/cypress-io/cypress-docker-images/issues/270 - QT_X11_NO_MITSHM=1 \ - _X11_NO_MITSHM=1 \ - _MITSHM=0 \ - # point Cypress at the /root/cache no matter what user account is used - # see https://on.cypress.io/caching - CYPRESS_CACHE_FOLDER=/root/.cache/Cypress \ - # Allow projects to reference globally installed cypress - NODE_PATH=/usr/local/lib/node_modules +# install dependencies +RUN apt-get -qq update > /dev/null && \ + apt-get -qq install -y bzip2 mplayer wget > /dev/null -# should be root user -RUN echo "whoami: $(whoami)" \ - && npm config -g set user $(whoami) \ - # command "id" should print: - # uid=0(root) gid=0(root) groups=0(root) - # which means the current user is root - && id \ - && npm install -g "cypress@10.3.0" \ - && cypress verify \ - # Cypress cache and installed version - # should be in the root user's home folder - && cypress cache path \ - && cypress cache list \ - && cypress info \ - && cypress version \ - # give every user read access to the "/root" folder where the binary is cached - # we really only need to worry about the top folder, fortunately - && ls -la /root \ - && chmod 755 /root \ - # always grab the latest Yarn - # otherwise the base image might have old versions - # NPM does not need to be installed as it is already included with Node. - && npm i -g yarn@latest \ - # Show where Node loads required modules from - && node -p 'module.paths' \ - # should print Cypress version - # plus Electron and bundled Node versions - && cypress version \ - && echo " node version: $(node -v) \n" \ - "npm version: $(npm -v) \n" \ - "yarn version: $(yarn -v) \n" \ - "debian version: $(cat /etc/debian_version) \n" \ - "user: $(whoami) \n" \ - "chrome: $(google-chrome --version || true) \n" \ - "firefox: $(firefox --version || true) \n" +# install Chromium browser +RUN apt-get -qq install -y chromium > /dev/null + +# install Firefox browser +RUN wget --no-verbose -O /tmp/firefox.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US" && \ + tar -C /opt -xjf /tmp/firefox.tar.bz2 && \ + rm /tmp/firefox.tar.bz2 && \ + ln -fs /opt/firefox/firefox /usr/bin/firefox + +# clean up +RUN rm -rf /var/lib/apt/lists/* && apt-get -qq clean > /dev/null WORKDIR /tests COPY tests/ /tests - -# ENTRYPOINT ["cypress", "run"] +RUN yarn install