From 56093201fb6b636e19f77d2e3ff8a0576205f866 Mon Sep 17 00:00:00 2001 From: kharhamel Date: Tue, 14 Apr 2020 20:16:51 +0200 Subject: [PATCH] integrate it into the ci --- .github/workflows/continuous_integration.yml | 18 ++++++++++++++++++ docker-compose.ci.yml | 6 +++--- e2e/CYPRESS.md | 8 ++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 6e6745e..35311fd 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -65,3 +65,21 @@ jobs: - name: "Jasmine" run: yarn test working-directory: "back" + + e2e: + name: "End to end testing with cypress" + + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2.0.0" + + - name: "Init .env" + run: "cp .env.template .env" + + - name: "Init containers" + run: "docker-compose -f docker-compose.yaml -f docker-compose.ci.yml run --rm wait_app" #start the containers and then wait for the website to be online + + - name: "Run cypress" + run: "docker-compose -f docker-compose.yaml -f docker-compose.ci.yml up --exit-code-from cypress cypress" # run cypress in docker-compose and get its exit code diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index eee558c..614a6c8 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -1,17 +1,17 @@ -version: '3.3' +version: '3' services: wait_app: image: dadarek/wait-for-dependencies depends_on: - - traefik + - reverse-proxy command: front:8080 cypress: # the Docker image to use from https://github.com/cypress-io/cypress-docker-images image: "cypress/included:3.2.0" depends_on: - - traefik + - reverse-proxy environment: # pass base url to test pointing at the web application - CYPRESS_baseUrl=http://front:8080 diff --git a/e2e/CYPRESS.md b/e2e/CYPRESS.md index 4ab56cb..dce9d69 100644 --- a/e2e/CYPRESS.md +++ b/e2e/CYPRESS.md @@ -3,6 +3,8 @@ This project use [cypress](https://www.cypress.io/) to do functional testing of the website. Unfortunately we cannot integrate it with docker-compose for the moment, so you will need to install some packages locally on your pc. +## Getting Started + You will need to install theses dependancies on linux (don't know about mac): ```bash @@ -26,3 +28,9 @@ npm run cy:open The first command will run all tests in the terminal, while the second will open the interactive task runner which allow you to easily manage the test workflow [More details here](https://docs.cypress.io/guides/getting-started/testing-your-app.html#Step-1-Start-your-server) + +## How to test a game + +Cypress cannot "see" and so cannot directly manipulate the canva created by Phaser. + +This means we have to do workarounds such as exposing core objects in the window so that cypress can manipulate them or doing console that cypress can catch. \ No newline at end of file -- 2.25.1