Skip to content

Commit

Permalink
ci(chromatic): enable ui regression testing with themes
Browse files Browse the repository at this point in the history
  • Loading branch information
YossiSaadi committed May 20, 2024
1 parent 8d6a84c commit 0719772
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
11 changes: 11 additions & 0 deletions packages/core/.storybook/modes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default {
light: {
theme: "light-app-theme"
},
dark: {
theme: "dark-app-theme"
},
black: {
theme: "black-app-theme"
}
};
7 changes: 5 additions & 2 deletions packages/core/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
UsageGuidelines,
withMemoryStats,
RelatedComponent,
MultipleStoryElementsWrapper,
StorybookLink
} from "vibe-storybook-components";
import CanvasWrapper from "../src/storybook/components/canvas-wrapper/CanvasWrapper";
Expand All @@ -37,13 +36,17 @@ import { generateAutocompletion } from "storybook-addon-playground";
import introCode from "../src/storybook/stand-alone-documentaion/playground/playground-helpers";
import reactDocgenOutput from "../src/storybook/stand-alone-documentaion/playground/react-docgen-output.json";
import withLiveEdit from "../src/storybook/decorators/withLiveEdit/withLiveEdit";
import modes from "./modes";

const fontLoader = async () => ({
fonts: await document.fonts.ready // Fixing Chromatic tests flakiness - taking snapshots after fonts are loaded
});

const preview: Preview = {
parameters: {
chromatic: {
modes
},
controls: {
sort: "alpha",
expanded: true
Expand Down Expand Up @@ -147,7 +150,7 @@ const preview: Preview = {
}
}
},

loaders: isChromatic() && document.fonts ? [fontLoader] : []
};

Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"@babel/preset-typescript": "^7.23.3",
"@babel/standalone": "^7.24.4",
"@babel/types": "^7.24.0",
"@chromatic-com/storybook": "^1.4.0",
"@hot-loader/react-dom": "^16.13.0",
"@jest/transform": "^29.7.0",
"@mdx-js/loader": "^2.0.0-rc.2",
Expand Down
37 changes: 35 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,17 @@
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@chromatic-com/storybook@^1.4.0":
version "1.4.0"
resolved "https://registry.npmjs.org/@chromatic-com/storybook/-/storybook-1.4.0.tgz#5cb1c68ecf32c55fe4ab8a8e3271022845169c00"
integrity sha512-CpskwN1RsgaDMSe7mnwrmst9XeLfvrSbCJOc/eaHIDzhSiKhdbbEF83cYjMYnvODPMW8QNVdw9gWMh+yzBQtSw==
dependencies:
chromatic "^11.3.2"
filesize "^10.0.12"
jsonfile "^6.1.0"
react-confetti "^6.1.0"
strip-ansi "^7.1.0"

"@cnakazawa/watch@^1.0.3":
version "1.0.4"
resolved "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a"
Expand Down Expand Up @@ -7285,6 +7296,11 @@ chownr@^2.0.0:
resolved "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece"
integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==

chromatic@^11.3.2:
version "11.3.5"
resolved "https://registry.npmjs.org/chromatic/-/chromatic-11.3.5.tgz#980a02fed612fcf9ace84fb50ab4c43b7380a5d1"
integrity sha512-M3xCyoEIjdcsXX3NhN60joXxEthy+wxNEcsCMM0u9u8Yna7tJvwvOsJStbOJDwEBo6TdIKckARN3BbArpduFbA==

chromatic@^7.5.3:
version "7.6.0"
resolved "https://registry.npmjs.org/chromatic/-/chromatic-7.6.0.tgz#b05cad35d47f6410efa5bca6b35af6fae6e540bc"
Expand Down Expand Up @@ -9866,6 +9882,11 @@ filelist@^1.0.4:
dependencies:
minimatch "^5.0.1"

filesize@^10.0.12:
version "10.1.2"
resolved "https://registry.npmjs.org/filesize/-/filesize-10.1.2.tgz#33bb71c5c134102499f1bc36e6f2863137f6cb0c"
integrity sha512-Dx770ai81ohflojxhU+oG+Z2QGvKdYxgEr9OSA8UVrqhwNHjfH9A8f5NKfg83fEH8ZFA5N5llJo5T3PIoZ4CRA==

fill-range@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7"
Expand Down Expand Up @@ -12993,7 +13014,7 @@ jsonfile@^2.1.0:
optionalDependencies:
graceful-fs "^4.1.6"

jsonfile@^6.0.1:
jsonfile@^6.0.1, jsonfile@^6.1.0:
version "6.1.0"
resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
Expand Down Expand Up @@ -16488,6 +16509,13 @@ react-colorful@^5.1.2:
resolved "https://registry.npmjs.org/react-colorful/-/react-colorful-5.6.1.tgz#7dc2aed2d7c72fac89694e834d179e32f3da563b"
integrity sha512-1exovf0uGTGyq5mXQT0zgQ80uvj2PCwvF8zY1RN9/vbJVSjSo3fsB/4L3ObbF7u70NduSiK4xu4Y6q1MHoUGEw==

react-confetti@^6.1.0:
version "6.1.0"
resolved "https://registry.npmjs.org/react-confetti/-/react-confetti-6.1.0.tgz#03dc4340d955acd10b174dbf301f374a06e29ce6"
integrity sha512-7Ypx4vz0+g8ECVxr88W9zhcQpbeujJAVqL14ZnXJ3I23mOI9/oBVTQ3dkJhUmB0D6XOtCZEM6N0Gm9PMngkORw==
dependencies:
tween-functions "^1.2.0"

[email protected]:
version "21.8.0"
resolved "https://registry.npmjs.org/react-dates/-/react-dates-21.8.0.tgz#355c3c7a243a7c29568fe00aca96231e171a5e94"
Expand Down Expand Up @@ -18364,7 +18392,7 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1:
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1:
strip-ansi@^7.0.1, strip-ansi@^7.1.0:
version "7.1.0"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==
Expand Down Expand Up @@ -19173,6 +19201,11 @@ tuf-js@^2.2.0:
debug "^4.3.4"
make-fetch-happen "^13.0.0"

tween-functions@^1.2.0:
version "1.2.0"
resolved "https://registry.npmjs.org/tween-functions/-/tween-functions-1.2.0.tgz#1ae3a50e7c60bb3def774eac707acbca73bbc3ff"
integrity sha512-PZBtLYcCLtEcjL14Fzb1gSxPBeL7nWvGhO5ZFPGqziCcr8uvHp0NDmdjBchp6KHL+tExcg0m3NISmKxhU394dA==

type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
Expand Down

0 comments on commit 0719772

Please sign in to comment.