From c71d6fbf22fdd9cd3975d27f87f17e4f0deb9a4c Mon Sep 17 00:00:00 2001 From: Jure Triglav <juretriglav@gmail.com> Date: Fri, 14 Aug 2020 01:17:07 +0200 Subject: [PATCH] ci: add firefox to cypress tests --- .gitlab-ci.yml | 24 ++++++++++++++++++++++-- Dockerfile | 5 +---- package.json | 6 ++++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2c4a42c45..d26d08f837 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 f76e8697c4..e8f4a33f34 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 1a16ea0884..cdf3a33142 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" -- GitLab