-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add storybook for UI testing (#74032)
### Why? This PR initialized the Storybook for UI, a11y, and screen testing for Dev Overlay and future potential. Closes NDX-587
- Loading branch information
1 parent
d1b00ed
commit a12192c
Showing
13 changed files
with
1,514 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,3 +56,6 @@ test-timings.json | |
*.tsbuildinfo | ||
.swc/ | ||
.turbo | ||
|
||
# Storybook | ||
*storybook.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { StorybookConfig } from '@storybook/react-webpack5' | ||
|
||
import { join, dirname } from 'path' | ||
|
||
/** | ||
* This function is used to resolve the absolute path of a package. | ||
* It is needed in projects that use Yarn PnP or are set up within a monorepo. | ||
*/ | ||
function getAbsolutePath(value: string): any { | ||
return dirname(require.resolve(join(value, 'package.json'))) | ||
} | ||
const config: StorybookConfig = { | ||
stories: [ | ||
'../stories/**/*.mdx', | ||
'../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)', | ||
], | ||
addons: [ | ||
getAbsolutePath('@storybook/addon-webpack5-compiler-swc'), | ||
getAbsolutePath('@storybook/addon-onboarding'), | ||
getAbsolutePath('@storybook/addon-essentials'), | ||
getAbsolutePath('@chromatic-com/storybook'), | ||
getAbsolutePath('@storybook/addon-interactions'), | ||
], | ||
framework: { | ||
name: getAbsolutePath('@storybook/react-webpack5'), | ||
options: {}, | ||
}, | ||
} | ||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { Preview } from '@storybook/react' | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
export default preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,9 @@ | |
"prepublishOnly": "cd ../../ && turbo run build", | ||
"types": "tsc --declaration --emitDeclarationOnly --stripInternal --declarationDir dist", | ||
"typescript": "tsec --noEmit", | ||
"ncc-compiled": "taskr ncc" | ||
"ncc-compiled": "taskr ncc", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
"taskr": { | ||
"requires": [ | ||
|
@@ -153,6 +155,7 @@ | |
"@babel/traverse": "7.22.5", | ||
"@babel/types": "7.22.5", | ||
"@capsizecss/metrics": "3.4.0", | ||
"@chromatic-com/storybook": "^3.2.2", | ||
"@edge-runtime/cookies": "6.0.0", | ||
"@edge-runtime/ponyfill": "4.0.0", | ||
"@edge-runtime/primitives": "6.0.0", | ||
|
@@ -168,6 +171,14 @@ | |
"@next/swc": "15.1.1-canary.12", | ||
"@opentelemetry/api": "1.6.0", | ||
"@playwright/test": "1.41.2", | ||
"@storybook/addon-essentials": "^8.4.7", | ||
"@storybook/addon-interactions": "^8.4.7", | ||
"@storybook/addon-onboarding": "^8.4.7", | ||
"@storybook/addon-webpack5-compiler-swc": "^1.0.5", | ||
"@storybook/blocks": "^8.4.7", | ||
"@storybook/react": "^8.4.7", | ||
"@storybook/react-webpack5": "^8.4.7", | ||
"@storybook/test": "^8.4.7", | ||
"@swc/core": "1.9.3", | ||
"@swc/types": "0.1.7", | ||
"@taskr/clear": "1.1.0", | ||
|
@@ -306,6 +317,7 @@ | |
"source-map-loader": "5.0.0", | ||
"source-map08": "npm:[email protected]", | ||
"stacktrace-parser": "0.1.10", | ||
"storybook": "^8.4.7", | ||
"stream-browserify": "3.0.0", | ||
"stream-http": "3.1.1", | ||
"strict-event-emitter": "0.5.0", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/next/src/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.