0

I would like to know how to properly configure TestCafe to save artifacts so that if somethings fails in CI, it would be easier to troubleshoot.

Our tests are triggered in CI/CD (inside docker container) each time a developer commits to their feature branch. Running tests locally, videos and screenshots are saved to testcafe/artifacs/* respectively in case of a failure. Tested that if a testcase does fail, it shows like it saved the screenshot, but in the end it doesn't save it.

Screenshot:
/builds/projectX/projectX/testcafe/artifacts/screenshots/2021-05-10_10-58-43/test-15/Chrome_89.0.4389.90_Linux_0.0/errors/1.png

Snippet from .testcaferc.json:

    "screenshots": {
    "path": "artifacts/screenshots",
    "takeOnFails": true,
    "fullPage": true
  },
  "videoPath": "artifacts/videos",
  "videoOptions": {
    "failedOnly": true
  },

From .gitlab-ci.yml:

  artifacts:
    paths:
      - testcafe/artifacts/
badatjs
  • 11
  • 1
  • If you run TestCafe inside a container, artifacts will be saved inside the container, so if you want to see them, you have to get them out of the container. – pavelsaman May 10 '21 at 11:38
  • 1
    Actually solved it by adding a simple row to gitlab config file: artifacts: when: on_failure paths: - testcafe/artifacts/ expire_in: 1 day – badatjs May 12 '21 at 08:39

0 Answers0