From 54c6190361f347885a181750a9a2ab68f729cd96 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Tue, 21 Apr 2020 10:11:20 +0200 Subject: [PATCH] feat: add GitHub action for e2e testing --- .github/workflows/cypress.yml | 31 +++++++++++++++++++++++++++++++ client/package.json | 2 +- package.json | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/cypress.yml diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml new file mode 100644 index 0000000000..bd83ba774e --- /dev/null +++ b/.github/workflows/cypress.yml @@ -0,0 +1,31 @@ +name: Cypress tests +on: [push] +jobs: + cypress-run: + name: Cypress run + runs-on: ubuntu-latest + services: + mongodb: + image: mongo:3.5.5 +# ports may not be necessary, try without + ports: + - 27017:27017 + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Set up environment + run: cp sample.env .env + + - name: Cypress run + uses: cypress-io/github-action@v1 + with: + build: npm run build +# this should mirror the production build, but for now we're just using the dev +# server and gatsby serve instead (the npm script serve:client needs updating!) + start: npm start + wait-on: http://localhost:8000 +# the site builds in about 8 minutes, so there is currently 12 minutes of time +# left for testing. + wait-on-timeout: 1200 + config: baseUrl=http://localhost:8000 diff --git a/client/package.json b/client/package.json index 98353bca72..dd72ded5c8 100644 --- a/client/package.json +++ b/client/package.json @@ -94,7 +94,7 @@ "format": "npm run format:gatsby && npm run format:src && npm run format:utils", "prestand-alone": "npm run prebuild", "stand-alone": "gatsby develop", - "serve": "gatsby serve", + "serve": "gatsby serve -p 8000", "test": "jest" }, "devDependencies": { diff --git a/package.json b/package.json index cd57b4044f..97ae70174b 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "seed:auth-user": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser", "seed:challenges": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedChallenges", "serve:client": "cd ./client && npm run serve", + "start": "npm-run-all ensure-env -p develop:server serve:client", "test": "npm-run-all -p test:*", "test:client": "cd ./client && npm test && cd ../", "test:client:e2e": "cd ./client && npm run e2e:ci && cd ../",