Commit 871fdc91 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'feat/normalize-reports' into 'master'

Normalize reports

See merge request to-be-continuous/puppeteer!23
parents 191bb552 a8a9e967
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -26,14 +26,16 @@ It uses the following variable:

| Name                  | description                              | default value     |
| --------------------- | ---------------------------------------- | ----------------- |
| `PUPPETEER_IMAGE`     | The Docker image used to run [Puppeteer](https://hub.docker.com/r/buildkite/puppeteer) | `buildkite/puppeteer:latest` |
| `PUPPETEER_IMAGE`     | The Docker image used to run Puppeteer | `ghcr.io/puppeteer/puppeteer:latest` |
| `PUPPETEER_PROJECT_DIR` | The Puppeteer project directory (containing `package.json`) | `.` |
| `PUPPETEER_TEST_EXTRA_ARGS`  | Testing framework extra options based on [Jest](https://jestjs.io/docs/en/cli) | _none_ |
| `REVIEW_ENABLED`      | Set to `true` to enable Puppeteer 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:

 Puppeteer test reports are [integrated to Gitlab by generating JUnit reports](https://docs.gitlab.com/ee/ci/junit_test_reports.html).
| Report         | Format                                                                       | Usage             |
| -------------- | ---------------------------------------------------------------------------- | ----------------- |
| `$PUPPETEER_PROJECT_DIR/reports/puppeteer.xunit.xml` | [xUnit](https://en.wikipedia.org/wiki/XUnit) test report(s) | [GitLab integration](https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsjunit) |

### Jest

+2 −2
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@
  "variables": [
    {
      "name": "PUPPETEER_IMAGE",
      "description": "The Docker image used to run [Puppeteer](https://hub.docker.com/r/buildkite/puppeteer)",
      "default": "buildkite/puppeteer:latest"
      "description": "The Docker image used to run [Puppeteer](https://hub.docker.com/r/ghcr.io/puppeteer/puppeteer)",
      "default": "ghcr.io/puppeteer/puppeteer:latest"
    },
    {
      "name": "PUPPETEER_PROJECT_DIR",
+6 −6
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ variables:
  TBC_TRACKING_IMAGE: "$CI_REGISTRY/to-be-continuous/tools/tracking:master"

  # Default Docker image (can be overridden)
  PUPPETEER_IMAGE: "buildkite/puppeteer:latest"
  PUPPETEER_IMAGE: "ghcr.io/puppeteer/puppeteer:latest"
  PUPPETEER_PROJECT_DIR: "."
  # default production ref name (pattern)
  PROD_REF: '/^(master|main)$/'
@@ -241,10 +241,10 @@ puppeteer:
    - maybe_install_deps
    # create directories
    - mkdir -p puppeteer/screenshots
    - mkdir -p puppeteer/reports
    - mkdir -p -m 777 reports
    # set junit report dir and fileName
    - export JEST_JUNIT_OUTPUT_DIR="puppeteer/reports"
    - export JEST_JUNIT_OUTPUT_NAME="TEST_REPORT.xml"
    - export JEST_JUNIT_OUTPUT_DIR="reports"
    - export JEST_JUNIT_OUTPUT_NAME="puppeteer.xunit.xml"
  script:
    # maybe activate DEBUG traces
    - 'if [[ "$TRACE" ]]; then export DEBUG=puppeteer:*; fi'
@@ -254,11 +254,11 @@ puppeteer:
    name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    when: always
    paths:
      - $PUPPETEER_PROJECT_DIR/puppeteer/reports/
      - $PUPPETEER_PROJECT_DIR/reports/puppeteer.*
      - $PUPPETEER_PROJECT_DIR/puppeteer/screenshots/
    reports:
      junit:
        - $PUPPETEER_PROJECT_DIR/puppeteer/reports/TEST_REPORT.xml
        - $PUPPETEER_PROJECT_DIR/reports/puppeteer.xunit.xml
    expire_in: 1 day
  rules:
    - !reference [.acceptance-policy, rules]