diff --git a/.circleci/config.yml b/.circleci/config.yml index 08d22847d..f385ef8b5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -48,7 +48,7 @@ jobs: name: Running Cypress E2E tests with JUnit reporter command: | cd test/cypress - yarn cypress:ci:mochawesome + yarn cypress:ci - run: name: Build Demo Site command: yarn run ng:build diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d9c53d925..20648e7d8 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -34,13 +34,13 @@ { "label": "Cypress Open Tool", "type": "shell", - "command": "yarn run cypress:open", + "command": "yarn run cypress", "problemMatcher": [] }, { "label": "Cypress CI (mochawesome)", "type": "shell", - "command": "yarn run cypress:ci:mochawesome", + "command": "yarn run cypress:ci", "problemMatcher": [] }, { @@ -68,4 +68,4 @@ "problemMatcher": [] } ] -} +} \ No newline at end of file diff --git a/package.json b/package.json index 47b5c38de..38156d2db 100644 --- a/package.json +++ b/package.json @@ -17,15 +17,14 @@ "prebuild": "npm-run-all delete:dist", "build": "npm run packagr", "postbuild": "npm-run-all sass:build sass:copy copy:i18n copy:lib", - "build:with-e2e": "npm-run-all build cypress:ci:mochawesome", + "build:with-e2e": "npm-run-all build cypress:ci", "build:gh-demo": "npm run build", "postbuild:gh-demo": "npm-run-all del-demo:dist copy-demo:dist", "build:gh-demo:with-e2e": "npm run build:gh-demo", - "postbuild:gh-demo:with-e2e": "npm run cypress:ci:mochawesome", + "postbuild:gh-demo:with-e2e": "npm run cypress:ci", "delete:dist": "cross-env rimraf dist", - "cypress:ci:mochawesome": "cd test/cypress && npm run cypress:ci:mochawesome", - "cypress:ci:xml": "cd test/cypress && node node_modules/cypress/bin/cypress run --reporter xunit --reporter-options output=testresult.xml", - "cypress:open": "cd test/cypress && node node_modules/cypress/bin/cypress open", + "cypress": "cd test/cypress && node node_modules/cypress/bin/cypress open", + "cypress:ci": "cd test/cypress && npm run cypress:ci", "test": "npm run test:jest", "test:jest": "node_modules/.bin/jest --config test/jest.config.js", "jest:clear": "node_modules/.bin/jest --clearCache", @@ -179,4 +178,4 @@ "yargs": "^15.4.1", "zone.js": "^0.8.29" } -} +} \ No newline at end of file diff --git a/test/cypress/cypress-mochawesome.js b/test/cypress/cypress-mochawesome.js deleted file mode 100644 index 8900c30b4..000000000 --- a/test/cypress/cypress-mochawesome.js +++ /dev/null @@ -1,24 +0,0 @@ - -const cypress = require('cypress'); -const fse = require('fs-extra'); -const { merge } = require('mochawesome-merge'); -const generator = require('mochawesome-report-generator'); - -async function runTests() { - await fse.remove('mochawesome-report') // remove the report folder - const { totalFailed } = await cypress.run({ - browser: "chrome", - reporter: "mochawesome", - reporterOptions: { - overwrite: false, - html: false, - json: true, - quiet: true - }, - }); // get the number of failed tests - const jsonReport = await merge(); // generate JSON report - await generator.create(jsonReport); - process.exit(totalFailed); // exit with the number of failed tests -} - -runTests(); diff --git a/test/cypress/cypress.json b/test/cypress/cypress.json index 224e4d6bd..014111bf5 100644 --- a/test/cypress/cypress.json +++ b/test/cypress/cypress.json @@ -7,7 +7,8 @@ "fixturesFolder": "fixtures", "integrationFolder": "integration", "pluginsFile": "plugins/index.js", + "reporter": "mochawesome", "screenshotsFolder": "screenshots", "supportFile": "support/index.js", "videosFolder": "videos" -} +} \ No newline at end of file diff --git a/test/cypress/package.json b/test/cypress/package.json index f3804481e..bd31ce5b7 100644 --- a/test/cypress/package.json +++ b/test/cypress/package.json @@ -4,17 +4,14 @@ "description": "The Cypress integration tests.", "main": "index.js", "scripts": { - "cypress:ci:mochawesome": "node cypress-mochawesome.js", - "cypress:ci:xml": "node node_modules/cypress/bin/cypress run --reporter xunit --reporter-options output=testresult.xml", - "cypress:open": "node node_modules/cypress/bin/cypress open" + "cypress": "node node_modules/cypress/bin/cypress open", + "cypress:ci": "cypress run --config-file cypress.json --reporter mochawesome" }, "author": "Ghislain B.", "license": "MIT", "devDependencies": { - "cypress": "^5.3.0", - "mocha": "^5.2.0", - "mochawesome": "^3.1.2", - "mochawesome-merge": "^1.0.7", - "mochawesome-report-generator": "^3.1.5" + "cypress": "^5.5.0", + "mocha": "^8.2.0", + "mochawesome": "^6.1.1" } } \ No newline at end of file