diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index f7d4c34c..b7949824 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -31,3 +31,22 @@ jobs: run: npm run env:start - name: Test run: npm run cypress:run + - name: Update summary + if: ${{ always() }} + run: | + npx mochawesome-merge ./tests/cypress/reports/*.json -o tests/cypress/reports/mochawesome.json + rm -rf ./tests/cypress/reports/mochawesome-*.json + npx mochawesome-json-to-md -p ./tests/cypress/reports/mochawesome.json -o ./tests/cypress/reports/mochawesome.md + npx mochawesome-report-generator tests/cypress/reports/mochawesome.json -o tests/cypress/reports/ + cat ./tests/cypress/reports/mochawesome.md >> $GITHUB_STEP_SUMMARY + - name: Make artifacts available + uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-artifact + retention-days: 2 + path: | + ${{ github.workspace }}/tests/cypress/screenshots/ + ${{ github.workspace }}/tests/cypress/videos/ + ${{ github.workspace }}/tests/cypress/logs/ + ${{ github.workspace }}/tests/cypress/reports/ diff --git a/.gitignore b/.gitignore index 81949283..dcc363e6 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,8 @@ Session.vim # Windows Thumbs.db Desktop.ini + +# Cypress +tests/cypress/screenshots +tests/cypress/videos +tests/cypress/reports diff --git a/package.json b/package.json index 7be6fe3e..810005ef 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "@wordpress/env": "^5.2.0", "@wordpress/scripts": "^23.0.0", "cypress": "^9.5.4", - "cypress-file-upload": "^5.0.8" + "cypress-file-upload": "^5.0.8", + "cypress-mochawesome-reporter": "^3.0.1" } } diff --git a/tests/cypress/config.json b/tests/cypress/config.json index 3c05e2ec..9dd5143e 100644 --- a/tests/cypress/config.json +++ b/tests/cypress/config.json @@ -7,6 +7,14 @@ "downloadsFolder": "tests/cypress/downloads", "supportFile": "tests/cypress/support/index.js", "video": false, + "reporter": "mochawesome", + "reporterOptions": { + "reportFilename": "mochawesome-[name]", + "reportDir": "tests/cypress/reports", + "overwrite": false, + "html": false, + "json": true + }, "testFiles": [ "set-avatar.test.js", "choose-default-avatar.test.js",