Skip to content

Commit 26abb5b

Browse files
committed
ci: added chromatic
1 parent 7d099a4 commit 26abb5b

File tree

7 files changed

+559
-17
lines changed

7 files changed

+559
-17
lines changed

.github/actions/test/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ inputs:
66
github_token:
77
description: GitHub token
88
required: true
9+
chromatic_token:
10+
description: Chromatic token
11+
required: true
912

1013
runs:
1114
using: composite
@@ -23,6 +26,13 @@ runs:
2326
shell: bash
2427
run: npx nx build headless
2528

29+
- name: Publish to Chromatic
30+
uses: chromaui/action@v1
31+
# Chromatic GitHub Action options
32+
with:
33+
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
34+
projectToken: ${{ inputs.github_token }}
35+
2636
# - name: Build Daisy Theme
2737
# shell: bash
2838
# run: npx nx build daisy

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ jobs:
2828
uses: ./.github/actions/test
2929
with:
3030
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
chromatic_token: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"commit": "git-cz",
1212
"format:fix": "pretty-quick --staged",
1313
"prepare": "husky install",
14-
"test:headless": "nx component-test headless --watch"
14+
"test:headless": "nx component-test headless --watch",
15+
"story:headless": "nx build-storybook headless"
1516
},
1617
"devDependencies": {
1718
"@builder.io/qwik": "0.101.0",
@@ -51,6 +52,7 @@
5152
"all-contributors-cli": "^6.24.0",
5253
"autoprefixer": "^10.4.13",
5354
"axe-core": "4.6.3",
55+
"chromatic": "6.17.3",
5456
"commitizen": "^4.3.0",
5557
"commitlint": "^17.4.3",
5658
"country-list-json": "1.1.0",

packages/headless/package.json

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,7 @@
2020
"node": ">=16.0.0"
2121
},
2222
"private": false,
23-
"scripts": {
24-
"build": "qwik build",
25-
"build.lib": "vite build --mode lib",
26-
"build.types": "tsc --emitDeclarationOnly",
27-
"dev": "vite --mode ssr",
28-
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
29-
"fmt": "prettier --write .",
30-
"fmt.check": "prettier --check .",
31-
"release": "np",
32-
"start": "vite --open --mode ssr",
33-
"qwik": "qwik",
34-
"storybook1": "storybook dev -p 6006",
35-
"build-storybook1": "storybook build"
36-
},
23+
"scripts": {},
3724
"dependencies": {
3825
"@floating-ui/dom": "1.0.10"
3926
}

packages/headless/project.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@
9393
}
9494
}
9595
},
96+
"test-storybook": {
97+
"executor": "nx:run-commands",
98+
"options": {
99+
"command": "pnpm test-storybook --url http://localhost:4400",
100+
"cwd": "packages/headless"
101+
}
102+
},
96103
"component-test": {
97104
"executor": "@nrwl/cypress:cypress",
98105
"options": {

packages/headless/src/components/accordion/accordion.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ type Story = StoryObj<AccordionProps>;
1414
export const Primary: Story = {
1515
render: () => (
1616
<Accordion>
17-
<AccordionItem label="Item 1">This is a test</AccordionItem>
17+
<AccordionItem label="Item 1">This is a test 1</AccordionItem>
1818
</Accordion>
1919
),
2020
play: async ({ canvasElement }) => {
2121
const canvas = within(canvasElement);
2222

2323
await userEvent.click(canvas.getByText('Item 1'));
2424

25-
await expect(canvas.getByText('This is a test')).toBeInTheDocument();
25+
await expect(canvas.getByText('This is a test 1')).toBeInTheDocument();
2626
},
2727
};

0 commit comments

Comments
 (0)