Skip to content

Commit 6dc4a35

Browse files
authored
chore(chromatic): remove g90 theme from snapshots (#22243)
1 parent a986ad7 commit 6dc4a35

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

docs/testing.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,43 @@ test step-by-step to debug what's going on. It will also allow you to interact
9797
with the page to quickly find selectors you can use to find items to run tests
9898
against.
9999

100+
#### Chromatic Visual Regression Testing
101+
102+
Chromatic is used for visual regression testing of Storybook stories. By
103+
default, stories are tested in the following modes:
104+
105+
- `g10` theme
106+
- `g100` theme
107+
- `breakpoint-sm` viewport
108+
109+
The `g90` theme is intentionally excluded from global Chromatic coverage to
110+
reduce snapshot volume. However, individual stories can opt into g90 coverage
111+
when needed.
112+
113+
##### Opting a Story into g90 Coverage
114+
115+
To include g90 theme snapshots for a specific story, import `allModes` from the
116+
Storybook modes configuration and add it to the story's parameters:
117+
118+
```js
119+
import { allModes } from '../../.storybook/modes';
120+
121+
export const MyStory = {
122+
parameters: {
123+
chromatic: {
124+
modes: {
125+
g10: allModes['g10'],
126+
g90: allModes['g90'], // Opt into g90 coverage
127+
g100: allModes['g100'],
128+
},
129+
},
130+
},
131+
};
132+
```
133+
134+
This approach allows targeted g90 coverage for stories where it's specifically
135+
needed, such as when addressing theme-specific bugs or visual regressions.
136+
100137
## FAQ
101138

102139
### Why am I seeing `browserType.launch: Executable doesn't exist at ../path`?

packages/react/.storybook/preview.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,11 @@ const parameters = {
328328
},
329329
},
330330
chromatic: {
331+
// g90 is intentionally excluded from global Chromatic coverage to reduce
332+
// snapshot volume. Individual stories can opt into g90 coverage by setting
333+
// parameters.chromatic.modes to include allModes.g90
331334
modes: {
332335
g10: allModes['g10'],
333-
g90: allModes['g90'],
334336
g100: allModes['g100'],
335337
'breakpoint-sm': allModes['breakpoint-sm'],
336338
},

0 commit comments

Comments
 (0)