Skip to content

Commit

Permalink
chore: 717 Add Chromatic and Storybook (#723)
Browse files Browse the repository at this point in the history
* chore: 717 Add Chromatic and Storybook

* add comment

* update package.json
  • Loading branch information
tihuan authored Feb 6, 2024
1 parent 8f31b2b commit 3977efd
Show file tree
Hide file tree
Showing 30 changed files with 32,046 additions and 18,008 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/push_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ jobs:
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
# Chromatic needs full Git history graph
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
Expand All @@ -106,10 +109,21 @@ jobs:
make dev-env-server build-for-server-dev
cd client
npx playwright install
- name: Smoke tests (without annotations feature)
run: |
cd client && make smoke-test
./node_modules/codecov/bin/codecov --yml=../.codecov.yml --root=../ --gcov-root=../ -C -F frontend,javascript,smokeTest
- name: Publish to Chromatic
uses: chromaui/action@latest
with:
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: ./client
# This is `npm run build-archive-storybook`
buildScriptName: "build-archive-storybook"

- name: Upload FE test results as an artifact
if: always()
uses: actions/upload-artifact@v3
Expand Down
23 changes: 23 additions & 0 deletions client/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { StorybookConfig } from "@storybook/react-webpack5";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-onboarding",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-webpack5",
options: {
builder: {
useSWC: true,
},
},
},
docs: {
autodocs: "tag",
},
};
export default config;
15 changes: 15 additions & 0 deletions client/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
3 changes: 2 additions & 1 deletion client/__tests__/e2e/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

/* eslint-disable no-await-in-loop -- await in loop is needed to emulate sequential user actions */
import { test, expect, Page } from "@playwright/test";
import { Page } from "@playwright/test";
import { test, expect } from "@chromatic-com/playwright";

import { getElementCoordinates, tryUntil } from "./puppeteerUtils";
import mockSetup from "./playwright.global.setup";
Expand Down
416 changes: 416 additions & 0 deletions client/build-storybook.log

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion client/configuration/eslint/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ module.exports = {
"spaced-comment": ["error", "always", { exceptions: ["*"] }],
"no-param-reassign": "off",
"object-curly-newline": ["error", { consistent: true }],
"react/prop-types": [0],
"react/prop-types": "off",
"react/require-default-props": "off",
"react/jsx-props-no-spreading": "off",
"space-before-function-paren": "off",
"@typescript-eslint/space-before-function-paren": "off",
"function-paren-newline": "off",
Expand Down
2 changes: 1 addition & 1 deletion client/configuration/webpack/SUPPORTED_BROWSERS_REGEX.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3977efd

Please sign in to comment.