Skip to content

Commit 09a9ef3

Browse files
committed
fix: make visual test works in CI
1 parent 292e8b7 commit 09a9ef3

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

.github/workflows/shared-component-visual-tests.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,17 @@ jobs:
4949
if: steps.playwright-cache.outputs.cache-hit != 'true'
5050
run: "yarn playwright install --with-deps --only-shell"
5151

52-
- name: Run Visual tests
52+
- name: Build Element Web resources
53+
# Needed to prepare language files
54+
run: "yarn build:res"
55+
56+
- name: Build storybook dependencies
57+
# When the first test is ran, it will fail because the dependencies are not yet built.
58+
# This step is to ensure that the dependencies are built before running the tests.
59+
run: "yarn test:storybook:ci"
60+
continue-on-error: true
61+
62+
- name: Run Visual tests 2
5363
run: "yarn test:storybook:ci"
5464

5565
- name: Upload received images & diffs

.storybook/main.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ Please see LICENSE files in the repository root for full details.
77

88
import type { StorybookConfig } from "@storybook/react-vite";
99
import path from "node:path";
10-
import { fileURLToPath } from "node:url";
1110
import { nodePolyfills } from "vite-plugin-node-polyfills";
12-
import { mergeConfig } from "vite";
13-
14-
const __filename = fileURLToPath(import.meta.url);
15-
const __dirname = path.dirname(__filename);
11+
const { mergeConfig } = await import("vite");
1612

1713
const config: StorybookConfig = {
1814
stories: ["../src/shared-components/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
@@ -30,7 +26,7 @@ const config: StorybookConfig = {
3026
resolve: {
3127
alias: {
3228
// Alias used by i18n.tsx
33-
$webapp: path.resolve(__dirname, "../webapp"),
29+
$webapp: path.resolve("webapp"),
3430
},
3531
},
3632
// Needed for counterpart to work

0 commit comments

Comments
 (0)