diff --git a/jobs/templates/includes/stage-cypress-tests.groovy.j2 b/jobs/templates/includes/stage-cypress-tests.groovy.j2 index 062f641..753741c 100644 --- a/jobs/templates/includes/stage-cypress-tests.groovy.j2 +++ b/jobs/templates/includes/stage-cypress-tests.groovy.j2 @@ -1,72 +1,88 @@ stage('Cypress tests') { {% filter indent(width=2) %} {%- include 'includes/agent-docker-cypress.groovy.j2' -%} {% endfilter %} stages { stage ('Setup cypress environment') { steps { sh '''#!/bin/bash set -e python3 -m pip install --user -e .[testing] yarn install && yarn build-test && yarn run cypress install ''' } } stage ('Run cypress tests') { steps { sh '''#!/bin/bash set -e export PYTHONPATH=$PWD python3 swh/web/manage.py migrate --settings=swh.web.settings.tests python3 swh/web/manage.py createcachetable --settings=swh.web.settings.tests cat swh/web/tests/create_test_admin.py | python3 swh/web/manage.py shell --settings=swh.web.settings.tests python3 swh/web/manage.py runserver --nostatic --settings=swh.web.settings.tests & wait-for-it localhost:5004 yarn run cypress run ''' } + post { + always { + junit( + allowEmptyResults: true, + testResults: 'cypress/junit/results/*.xml', + ) + } + } } stage ('Mochawesome') { steps { warnError('Mochawesome report failed') { sh '''yarn run mochawesome''' } } post { success { publishHTML (target: [ allowMissing: true, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'cypress/mochawesome/report', reportFiles: 'mochawesome.html', includes: 'assets/**/*', reportName: "Mochawesome Tests Report" ]) } } } stage ('Coverage report') { steps { warnError('Coverage report failed') { - sh '''yarn run nyc-report''' + sh '''npx nyc report --reporter=lcov''' + sh '''npx nyc report --reporter=cobertura''' } } post { success { publishHTML (target: [ allowMissing: true, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'cypress/coverage/lcov-report', reportFiles: 'index.html', reportName: "Istanbul Code Coverage" ]) + + publishCoverage( + adapters: [ + coberturaAdapter(path: 'cypress/coverage/cobertura-coverage.xml'), + ], + tag: 'cypress', + ) } } } } }