Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI-329 : integrating tests with storybook #337

Merged
merged 23 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Chromatic"

on: push

jobs:
chromatic:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pnpm/action-setup@v2
name: install pnpm
with:
version: 8.10.0
run_install: false

- name: Install dependencies
run: pnpm install

- name: Run Chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: packages/phoenix
36 changes: 36 additions & 0 deletions .github/workflows/storybook-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Storybook Tests'
on: push
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 20.9.0

- uses: pnpm/action-setup@v2
name: install pnpm
with:
version: 8.10.0
run_install: false

- name: Install dependencies
run: pnpm install

- name: Install Playwright
run: npx playwright install --with-deps

- name: Build Storybook
run: pnpm build-storybook --quiet
working-directory: packages/phoenix

- name: Install wait-on
run: pnpm add -D wait-on
working-directory: packages/phoenix

- name: Serve Storybook and run tests
run: pnpm test-storybook:ci
working-directory: packages/phoenix
6 changes: 4 additions & 2 deletions packages/phoenix/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ module.exports = {
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions"
"@storybook/addon-interactions",
"@chromatic-com/storybook",
"storybook-addon-rtl"
],
"framework": {
"name": "@storybook/vue3-vite",
"options": {}
},
"docs": {
"docsPage": false
autodocs: true
},
async viteFinal(config, { configType }) {
config.resolve.alias['~'] = `${path.resolve(__dirname, 'src')}/`;
Expand Down
1 change: 0 additions & 1 deletion packages/phoenix/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import '../src/assets/main.css';
import '@youcan/ui-core/tokens';

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
Expand Down
4 changes: 4 additions & 0 deletions packages/phoenix/chromatic.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"projectId": "Project:66432575dd302195a63c304b",
"zip": true
}
32 changes: 22 additions & 10 deletions packages/phoenix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"name": "@youcan/ui-vue3",
"version": "2.6.0-beta.3",
"description": "YouCan Vue3 components library",
"author": "YouCan <[email protected]> (https://github.com/youcan-shop/)",
"author": {
"name": "YouCan",
"email": "[email protected]",
"url": "https://github.com/youcan-shop/"
},
"license": "MIT",
"homepage": "https://github.com/youcan-shop/youcan-ui",
"keywords": [
Expand Down Expand Up @@ -55,7 +59,10 @@
"lint": "eslint .",
"storybook": "storybook dev -p 6007",
"build-storybook": "storybook build",
"bench": "node vue3.bench.mjs"
"bench": "node vue3.bench.mjs",
"chromatic": "chromatic --exit-zero-on-changes",
"test-storybook": "test-storybook --url http://127.0.0.1:6007",
"test-storybook:ci": "npx concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"npx http-server storybook-static --port 6007 --silent\" \"npx wait-on tcp:6007 && pnpm test-storybook --url http://127.0.0.1:6007\""
},
"peerDependencies": {
"vue": "^3.4.5"
Expand All @@ -66,26 +73,31 @@
"vue-slicksort": "^2.0.5"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.3.4",
"@iconify-json/line-md": "^1.1.20",
"@iconify-json/tabler": "^1.1.53",
"@storybook/addon-essentials": "^7.6.10",
"@storybook/addon-interactions": "^7.6.10",
"@storybook/addon-links": "^7.6.10",
"@storybook/blocks": "^7.6.10",
"@storybook/test": "^7.6.10",
"@storybook/vue3": "^7.6.10",
"@storybook/vue3-vite": "^7.6.10",
"@storybook/addon-essentials": "^8.0.10",
"@storybook/addon-interactions": "^8.0.10",
"@storybook/addon-links": "^8.0.10",
"@storybook/blocks": "^8.0.10",
"@storybook/test": "^8.0.10",
"@storybook/test-runner": "^0.18.0",
"@storybook/vue3": "^8.0.10",
"@storybook/vue3-vite": "^8.0.10",
"@types/node": "18.7.15",
"@types/quill": "^2.0.14",
"@vitejs/plugin-vue": "^5.0.2",
"@vueuse/core": "^9.9.0",
"@youcan/ui-core": "*",
"@youcan/ui-icons": "*",
"@youcan/ui-visuals": "*",
"chromatic": "^11.3.1",
"playwright": "^1.44.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "1.54.8",
"storybook": "^7.6.10",
"storybook": "^8.0.10",
"storybook-addon-rtl": "^1.0.0",
"typescript": "4.8.2",
"unocss": "^0.47.6",
"vite": "^5.0.11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const SidebarSubitem_: Story = {
<Sidebar>
<template #items>
<SidebarItem v-bind="item">
<SidebarSubitem v-bind="args">
<SidebarItem/>
<SidebarSubitem v-bind="args" />
</SidebarItem>
</template>
</Sidebar>
`,
Expand Down
Loading
Loading