From 76223fcc193d657bed22bffcabd77033f518180b Mon Sep 17 00:00:00 2001 From: Viktor Tsvetkov <142901247+vtsvetkov-splunk@users.noreply.github.com> Date: Mon, 12 Feb 2024 15:00:52 +0100 Subject: [PATCH] generate screenshots on CI --- .github/workflows/storybook-tests.yml | 10 +++++++++- ui/.storybook/preview.tsx | 7 ++++++- ui/.storybook/test-runner.ts | 5 ----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/storybook-tests.yml b/.github/workflows/storybook-tests.yml index 2f8149870..6d63e9111 100644 --- a/.github/workflows/storybook-tests.yml +++ b/.github/workflows/storybook-tests.yml @@ -32,7 +32,15 @@ jobs: run: | npx concurrently --kill-others --success first -n "SB,TEST" \ "npx http-server storybook-static --port 6006 --silent" \ - "npx wait-on tcp:6006 && yarn test-storybook" + "npx wait-on tcp:6006 && yarn test-storybook -u" + - name: Push updated screenshots + uses: actions/checkout@v4 + - run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add \*.png + git commit -m "update screenshots [skip ci]" + git push - uses: actions/upload-artifact@v4 name: 'Upload test report' if: ${{ failure() }} diff --git a/ui/.storybook/preview.tsx b/ui/.storybook/preview.tsx index 3f1bcfa45..e4a80e83d 100644 --- a/ui/.storybook/preview.tsx +++ b/ui/.storybook/preview.tsx @@ -11,7 +11,12 @@ initialize({ }, onUnhandledRequest(req) { const url = req.url; - const skipList = ['bundle.js', 'hot-update.js', 'http://localhost:6006/index.json']; + const skipList = [ + 'bundle.js', + 'hot-update.js', + 'http://localhost:6006/index.json', + '.woff', + ]; const shouldRequestBeBypassed = skipList.some((passItem) => url.includes(passItem)); if (!shouldRequestBeBypassed) { console.warn('Found an unhandled %s request to %s', req.method, url); diff --git a/ui/.storybook/test-runner.ts b/ui/.storybook/test-runner.ts index 946d33775..fac1ad5b5 100644 --- a/ui/.storybook/test-runner.ts +++ b/ui/.storybook/test-runner.ts @@ -50,11 +50,6 @@ const config: TestRunnerConfig = { customSnapshotIdentifier, storeReceivedOnFailure: true, customReceivedDir, - customDiffConfig: { - threshold: 0.3, - }, - failureThreshold: 0.01, - failureThresholdType: 'percent', }); }, };