From 8e3a0ba501b83019465314db272289003ffa13f7 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Fri, 8 Feb 2019 11:05:21 +0100 Subject: [PATCH] Ajoute des script npm pour lancer les tests E2E --- circle.yml | 6 +++--- cypress.json | 1 + cypress/integration/mon-entreprise/landing.js | 1 - package.json | 12 ++++++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/circle.yml b/circle.yml index 9c778f5cd..8f9f11907 100644 --- a/circle.yml +++ b/circle.yml @@ -49,8 +49,8 @@ jobs: - install - run: | yarn run compile - yarn run serve:<< parameters.site >> & - yarn run cypress run --record --key 21660df5-36a5-4c49-b23d-801799b0c759 --env language=<< parameters.language >> --spec 'cypress/integration/<< parameters.cypress_folder >>/**/*.js' + yarn run << parameters.site >>:serve & + yarn run cypress run --record --key 21660df5-36a5-4c49-b23d-801799b0c759 --env language=<< parameters.language >> --config integrationFolder=cypress/integration/<< parameters.cypress_folder >>' production-end-to-end-test: parameters: @@ -76,7 +76,7 @@ jobs: - run: npm install --save-dev cypress - run: sleep 300 - run: | - if ./node_modules/.bin/cypress run --record --key 21660df5-36a5-4c49-b23d-801799b0c759 --env language=<< parameters.language >> --spec 'cypress/integration/<< parameters.cypress_folder >>/**/*.js'; + if ./node_modules/.bin/cypress run --record --key 21660df5-36a5-4c49-b23d-801799b0c759 --env language=<< parameters.language >> --config integrationFolder=cypress/integration/<< parameters.cypress_folder >>; then echo "SUCCESS \o/" else diff --git a/cypress.json b/cypress.json index e3a4fa321..8377ceef0 100644 --- a/cypress.json +++ b/cypress.json @@ -4,5 +4,6 @@ "env": { "language": "fr" }, + "integrationFolder": "cypress/integration/mon-entreprise", "chromeWebSecurity": false } diff --git a/cypress/integration/mon-entreprise/landing.js b/cypress/integration/mon-entreprise/landing.js index de0ef2c57..0c20bf493 100644 --- a/cypress/integration/mon-entreprise/landing.js +++ b/cypress/integration/mon-entreprise/landing.js @@ -1,5 +1,4 @@ describe('Landing test', function() { - console.log('language', Cypress.env('language'), Cypress.env()) const fr = Cypress.env('language') === 'fr' it('should not crash', function() { cy.visit('/') diff --git a/package.json b/package.json index 14ad8c983..acb2c067b 100644 --- a/package.json +++ b/package.json @@ -60,24 +60,28 @@ "scripts": { "compile": "webpack --config source/webpack.prod.js", "stats": "webpack --config source/webpack.prod.js --profile --json > stats.json", - "serve:embauche": "cp dist/embauche.html dist/index.html && serve -s dist", "eslint-check": "eslint --print-config .eslintrc | eslint-config-prettier-check", "eslint": "LIST=`git diff --cached --name-only --diff-filter=AMR HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi", "externalize": "node source/externalize.js", "heroku-postbuild": "yarn install --production=false && yarn compile", - "serve:mycompanyinfrance": "serve --config serve.infrance.json", - "serve:mon-entreprise": "serve --config serve.mon-entreprise.json", "pretest": "LIST=`git diff --name-only --diff-filter=AMR HEAD^..HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi && flow check", "start": "node source/server.js", "test-inversions": "yarn test-watch --grep 'inversions'", "test-meca": "yarn test-watch --grep 'Mécanismes'", "test-rules": "yarn test-watch --grep 'notre base de règles'", + "test-cypress" : "yarn run cypress run", "test-watch": "yarn test-common --watch", "test-common": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --include componentTestSetup.js --require mock-local-storage --require test/helpers/browser.js \"./{,!(node_modules)/**/}!(webpack).test.js\"", "test": "yarn test-common", "test-components": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --include componentTestSetup.js --require mock-local-storage ---require test/helpers/browser.js \"source/components/**/*.test.js\" --watch", "test-lib": "yarn test-common --grep 'library'", - "compile-lib": "yarn webpack --config source/webpack.lib.js" + "compile-lib": "yarn webpack --config source/webpack.lib.js", + "mon-entreprise:serve": "serve --config serve.mon-entreprise.json", + "mon-entreprise:test": "cypress open", + "mycompanyinfrance:serve": "serve --config serve.infrance.json", + "mycompanyinfrance:test": "cypress open --env language=en --config baseUrl=http://localhost:8080/infrance", + "embauche:serve": "cp dist/embauche.html dist/index.html && serve -s dist", + "embauche:test": "cypress open --config baseUrl=http://localhost:8080/embauche,integrationFolder=cypress/integration/embauche" }, "devDependencies": { "@babel/core": "^7.1.0",