Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Make Loki work more consistently (#63859)

Ryan Laurie1ed050b03d01
diff --git a/.github/workflows/loki-update.yml b/.github/workflows/loki-update.yml
index b4232ffb9e0..4f8d19e9c8c 100644
--- a/.github/workflows/loki-update.yml
+++ b/.github/workflows/loki-update.yml
@@ -26,26 +26,8 @@ jobs:
- name: Compile CLJS
run: yarn build-pure:cljs
- - name: Build Storybook
- # We won't be able to use Storybook play's `userEvent` with production build
- # see https://github.com/storybookjs/storybook/issues/19758
- run: NODE_ENV=development yarn build-storybook
-
- - name: Serve Storybook
- run: yarn http-server storybook-static -p 6006 &
- shell: bash
-
- - name: Wait for Storybook to become available
- run: |
- echo "Waiting for Storybook to be served..."
- while ! curl --silent --fail http://localhost:6006; do
- sleep 5
- echo "Retrying..."
- done
- echo "Storybook is being served!"
-
- name: Update Loki Snapshots
- run: yarn test-visual:loki || yarn test-visual:loki-approve-diff && yarn test-visual:loki-prune
+ run: yarn test-visual:loki:ci || yarn test-visual:loki-approve-diff && yarn test-visual:loki-prune
- name: Check for changes
id: check-changes
diff --git a/.github/workflows/loki.yml b/.github/workflows/loki.yml
index 6d6ea05a603..a82a8c5ad1d 100644
--- a/.github/workflows/loki.yml
+++ b/.github/workflows/loki.yml
@@ -53,14 +53,8 @@ jobs:
- name: Compile CLJS
run: NODE_ENV=development yarn build-pure:cljs
- - name: Build Storybook
- # We won't be able to use Storybook play's `userEvent` with production build
- # see https://github.com/storybookjs/storybook/issues/19758
- run: NODE_ENV=development yarn build-storybook
-
- name: Run Loki Visual Tests
- run: |
- yarn loki --requireReference --reactUri file:./storybook-static --chromeFlags='--headless --disable-gpu' --verboseRenderer
+ run: yarn test-visual:loki:ci
- name: Generate Visual Report on Failure
if: failure()
diff --git a/docs/developers-guide/visual-tests.md b/docs/developers-guide/visual-tests.md
index c90a111d24f..60383d99e9f 100644
--- a/docs/developers-guide/visual-tests.md
+++ b/docs/developers-guide/visual-tests.md
@@ -12,7 +12,8 @@ Before running Loki tests locally, ensure that both Storybook and Docker are run
### Commands
-- Run Visual Tests: `yarn test-visual:loki`
+- Run Visual Tests: `yarn test-visual:loki` (Note: do not commit screenshots from this, use the CI variant below, they will be more consistent)
+- Run Visual Tests in CI: `yarn test-visual:loki:ci`
- Update failing snapshots: `yarn test-visual:loki-approve-diff`
- Generate an HTML Report: `yarn test-visual:loki-report`
- Generate and Open Report: `yarn test-visual:loki-report-open`
diff --git a/package.json b/package.json
index e396de16488..efe42deafd7 100644
--- a/package.json
+++ b/package.json
@@ -483,7 +483,8 @@
"test-unit-keep-cljs": "jest --maxWorkers=4",
"test-unit-watch": "yarn test-unit --watch",
"test-unit-watch:cljs": "yarn concurrently -n 'cljs,tests' 'yarn build-watch:cljs' 'yarn test-unit-keep-cljs --watch'",
- "test-visual:loki": "loki test --chromeFlags='--headless --disable-gpu'",
+ "test-visual:loki": "NODE_ENV=development loki test --chromeFlags='--headless --disable-gpu' ",
+ "test-visual:loki:ci": "yarn build-storybook && yarn test-visual:loki --reactUri file:./storybook-static --verboseRenderer",
"test-visual:loki-approve-diff": "ls .loki/difference | xargs -I _ find .loki/current -name _ | xargs -I _ cp _ .loki/reference/",
"test-visual:loki-prune": "ls .loki/reference | grep -v \"$(ls .loki/current)\" | xargs -I {} rm .loki/reference/{}",
"test-visual:loki-report": "node frontend/test/generate-loki-report-json.js && reg-cli --from .loki/report.json --report .loki/report.html",