diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2c4a42c4525c9a0e89418749f816bfa12b65c2c..d26d08f837dd37e403e7a49177c877366ec4540d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,7 +32,7 @@ lint: - cd ${HOME} - npm run lint -test: +test-chrome: image: $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA stage: test variables: @@ -49,4 +49,24 @@ test: script: - cd ${HOME} # specify host here else it confuses the linked postgres image - - PGHOST=postgres yarn test:all + - PGHOST=postgres yarn test:all:chrome + + +test-firefox: + image: $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA + stage: test + variables: + GIT_STRATEGY: none + # setup data for postgres image + POSTGRES_USER: test + POSTGRES_PASSWORD: pw + # connection details for tests + PGUSER: test + PGPASSWORD: pw + NODE_ENV: test + services: + - postgres + script: + - cd ${HOME} + # specify host here else it confuses the linked postgres image + - PGHOST=postgres yarn test:all:firefox diff --git a/Dockerfile b/Dockerfile index f76e8697c4626a8e74f9ee45ed27f753a3193b70..e8f4a33f345781c059349f0d3ea94aeb96396287 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:12 +FROM cypress/browsers:node12.18.0-chrome83-ff77 ENV HOME "/home/simplej" RUN mkdir -p ${HOME} @@ -6,9 +6,6 @@ WORKDIR ${HOME} ENV NODE_ENV "development" -# Install dependencies for Cypress -RUN apt-get -y update && apt-get -y install xvfb libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 - COPY . . # We do a development install because react-styleguidist is a dev dependency and we want to run tests diff --git a/package.json b/package.json index 1a16ea08843148ec905b6e15cb377152d8311c20..cdf3a3314206072af038de65f63ed5945a7671f2 100644 --- a/package.json +++ b/package.json @@ -143,8 +143,10 @@ "start:services": "docker-compose up postgres", "start:server-and-client": "start-test server 'http://localhost:3000/healthcheck' client", "test:server-and-client": "start-test server:test 'http://localhost:3000/healthcheck' client", - "test:all": "start-test test:server-and-client 4000 test", - "test": "cypress run", + "test:all:firefox": "start-test test:server-and-client 4000 test:firefox", + "test:all:chrome": "start-test test:server-and-client 4000 test:chrome", + "test:firefox": "cypress run --browser firefox", + "test:chrome": "cypress run --browser chrome", "__cleanNodeModules": "find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \\;", "build": "NODE_ENV=production pubsweet build", "seedFromDump": "node scripts/seedFromDump.js"