diff --git a/README.md b/README.md index 12156d9..163b1eb 100644 --- a/README.md +++ b/README.md @@ -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 <gleb@kensho.com> © 2016 diff --git a/src/generate-gitlab-file.js b/src/generate-gitlab-file.js index 0d284dc..c43d49c 100644 --- a/src/generate-gitlab-file.js +++ b/src/generate-gitlab-file.js @@ -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) => { diff --git a/test/.gitlab-ci.yml b/test/.gitlab-ci.yml index 8251945..64eae3d 100644 --- a/test/.gitlab-ci.yml +++ b/test/.gitlab-ci.yml @@ -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" diff --git a/test2/.gitlab-ci.yml b/test2/.gitlab-ci.yml index 4c2e53e..3b0597c 100644 --- a/test2/.gitlab-ci.yml +++ b/test2/.gitlab-ci.yml @@ -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" diff --git a/test4/.gitlab-ci.yml b/test4/.gitlab-ci.yml index 50d6357..bc3c038 100644 --- a/test4/.gitlab-ci.yml +++ b/test4/.gitlab-ci.yml @@ -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: