Commit f2e5c63d authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: normalize reports

parent 17fc7d0a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -31,11 +31,11 @@ It uses the following variable:
| `CYPRESS_EXTRA_ARGS`  | Cypress extra [run options](https://docs.cypress.io/guides/guides/command-line.html#cypress-run) (to select a different browser, configuration or spec files for e.g.) | _none_ |
| `REVIEW_ENABLED`      | Set to `true` to enable Cypress tests on review environments (dynamic environments instantiated on development branches) | _none_ (disabled) |

### Unit tests report integration
In addition to a textual report in the console, this job produces the following reports, kept for one day:

Cypress test reports are [integrated to GitLab by generating JUnit reports](https://docs.gitlab.com/ee/ci/junit_test_reports.html).

This is done using the following Cypress CLI options: `--reporter junit --reporter-options "mochaFile=cypress/reports/TEST-[hash].xml"`  
| Report         | Format                                                                       | Usage             |
| -------------- | ---------------------------------------------------------------------------- | ----------------- |
| `$CYPRESS_PROJECT_DIR/reports/cypress-*.xunit.xml` | [xUnit](https://github.com/jest-community/jest-junit#readme) test report(s) | [GitLab integration](https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsjunit) |

### Cypress `baseUrl` auto evaluation

+3 −3
Original line number Diff line number Diff line
@@ -243,17 +243,17 @@ cypress:
    # maybe activate DEBUG traces
    - 'if [[ "$TRACE" ]]; then export DEBUG=cypress:*; fi'
    # run Cypress tests
    - cypress run --reporter junit --reporter-options "mochaFile=cypress/reports/TEST-[hash].xml" $CYPRESS_EXTRA_ARGS
    - cypress run --reporter junit --reporter-options "mochaFile=reports/cypress-[hash].xunit.xml" $CYPRESS_EXTRA_ARGS
  artifacts:
    name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    when: always
    paths:
      - $CYPRESS_PROJECT_DIR/cypress/reports/
      - "$CYPRESS_PROJECT_DIR/reports/cypress-*"
      - $CYPRESS_PROJECT_DIR/cypress/videos/
      - $CYPRESS_PROJECT_DIR/cypress/screenshots/
    reports:
      junit:
        - $CYPRESS_PROJECT_DIR/cypress/reports/TEST-*.xml
        - "$CYPRESS_PROJECT_DIR/reports/cypress-*.xunit.xml"
    expire_in: 1 day
  rules:
    - !reference [.acceptance-policy, rules]