feat: add GitHub action for e2e testing

This commit is contained in:
Oliver Eyton-Williams
2020-04-21 10:11:20 +02:00
committed by Mrugesh Mohapatra
parent 7eb6351530
commit 54c6190361
3 changed files with 33 additions and 1 deletions

31
.github/workflows/cypress.yml vendored Normal file
View File

@ -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

View File

@ -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": {

View File

@ -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 ../",