Skip to content

Commit 047fecd

Browse files
committed
Trying new approach for CI storybook testing
1 parent d679e27 commit 047fecd

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

.github/workflows/chromatic.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Chromatic"
1+
name: "Chromatic & Storybook Tests"
22

33
on:
44
push:
@@ -13,8 +13,6 @@ on:
1313
jobs:
1414
chromatic-deployment:
1515
runs-on: ubuntu-latest
16-
outputs:
17-
storybook-url: ${{ steps.chromatic_publish.outputs.storybookUrl }}
1816
steps:
1917
- name: Checkout repository
2018
uses: actions/checkout@v2
@@ -31,17 +29,16 @@ jobs:
3129
run: npm install
3230

3331
- name: Publish to Chromatic
34-
id: chromatic_publish
3532
uses: chromaui/action@v1
3633
with:
3734
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
3835
exitOnceUploaded: true
3936
exitZeroOnChanges: true
4037
workingDir: packages/lib
4138
forceRebuild: true
39+
4240
storybook-tests:
4341
runs-on: ubuntu-latest
44-
needs: chromatic-deployment
4542
steps:
4643
- name: Checkout repository
4744
uses: actions/checkout@v2
@@ -55,10 +52,16 @@ jobs:
5552
- name: Install dependencies
5653
run: npm install
5754

55+
- name: Build Storybook
56+
run: |
57+
cd packages/lib
58+
npm run build-storybook -- --quiet
59+
60+
- name: Serve Storybook
61+
run: npx http-server ./packages/lib/storybook-static -p 6006 &
62+
5863
- name: Run Storybook Tests
5964
run: |
6065
cd packages/lib
6166
npx playwright install --with-deps
6267
npm run test-storybook
63-
env:
64-
SB_URL: "${{ needs.chromatic-deployment.outputs.storybook-url }}"

packages/lib/vitest.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const dirname = typeof __dirname !== "undefined" ? __dirname : path.dirname(file
99
export default defineConfig({
1010
// Workaround to prevent fail during first text execution (https://github.com/storybookjs/storybook/issues/32049)
1111
optimizeDeps: {
12-
include: ["react/jsx-dev-runtime"],
12+
include: ["react", "react-dom", "react/jsx-runtime", "react/jsx-dev-runtime", "@emotion/react", "@emotion/styled"],
1313
},
1414
test: {
1515
projects: [
@@ -20,7 +20,6 @@ export default defineConfig({
2020
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
2121
storybookTest({
2222
configDir: path.join(dirname, ".storybook"),
23-
storybookUrl: process.env.SB_URL ?? "http://localhost:6006",
2423
}),
2524
],
2625
test: {

0 commit comments

Comments
 (0)