From 2a70780544816ab9151c8313158f01f695a42320 Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Mon, 18 Dec 2023 14:39:28 +0100 Subject: [PATCH] Add job summary for visual tests --- .gitlab-ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2123a0b..56fb6847 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,8 +25,18 @@ storybook:test: - npm ci - npm run storybook:dev & - curl --fail -sv --retry 30 --retry-delay 3 --head --retry-all-errors http://127.0.0.1:6006 - - npm run storybook:test:all -- --ci + - npm run storybook:test:all -- --ci || exit_code=$? + - | + if [[ $exit_code -ne 0 && -d "__snapshots__/__diff_output__" ]]; then + echo -e "\e[0Ksection_start:`date +%s`:glpa_summary\r\e[0KHeader of the summary" + echo "Storybook tests failed." + echo "Check for rendering differences at http://gitlab.com/code0-tech/base-ui/-/jobs/$CI_JOB_ID/artifacts/browse/__snapshots__/__diff_output__/" + echo "If the changes are intended, update the fixtures with npm run storybook:test:update" + echo -e "\e[0Ksection_end:`date +%s`:glpa_summary\r\e[0K" + fi + exit $exit_code artifacts: + when: on_failure paths: - __snapshots__/__diff_output__ expire_in: 7 days