Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
feat(screenshots): saving screenshots as artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jul 12, 2016
1 parent f0823d8 commit 2a18974
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,22 @@ To print debug messages during the build, start the tool with environment variab
DEBUG=multi ...
```

The generated GitLab CI also collects the screenshots collected by Cypress as artifacts

```
.job_template: &e2e_test_definition
artifacts:
when: on_failure
expire_in: 1 month
paths:
- cypress/screenshots/
script:
- cypress ci --spec "output/$CI_BUILD_NAME.js"
```

This should help debug test problems, because Cypress should save the screenshots on failure
when running in the CI mode.

### Small print

Author: Kensho, Gleb Bahmutov <[email protected]> © 2016
Expand Down
5 changes: 5 additions & 0 deletions src/generate-gitlab-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ build-specs:
# Hidden job that defines an anchor named 'e2e_test_definition'
# This job will be automatically assigned "test" phase
.job_template: &e2e_test_definition
artifacts:
when: on_failure
expire_in: 1 month
paths:
- cypress/screenshots/
script:
`
script.forEach((testCommand) => {
Expand Down
5 changes: 5 additions & 0 deletions test/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ build-specs:
# Hidden job that defines an anchor named 'e2e_test_definition'
# This job will be automatically assigned "test" phase
.job_template: &e2e_test_definition
artifacts:
when: on_failure
expire_in: 1 month
paths:
- cypress/screenshots/
script:
- cypress ci --spec "output/$CI_BUILD_NAME.js"

Expand Down
5 changes: 5 additions & 0 deletions test2/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ build-specs:
# Hidden job that defines an anchor named 'e2e_test_definition'
# This job will be automatically assigned "test" phase
.job_template: &e2e_test_definition
artifacts:
when: on_failure
expire_in: 1 month
paths:
- cypress/screenshots/
script:
- cypress ci --spec "cypress/integration/$CI_BUILD_NAME.js"

Expand Down
5 changes: 5 additions & 0 deletions test4/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ build-specs:
# Hidden job that defines an anchor named 'e2e_test_definition'
# This job will be automatically assigned "test" phase
.job_template: &e2e_test_definition
artifacts:
when: on_failure
expire_in: 1 month
paths:
- cypress/screenshots/
script:
- cypress ci --spec cypress/integration/$CI_BUILD_NAME.js --reporter json
after_script:
Expand Down

0 comments on commit 2a18974

Please sign in to comment.