पाठ 13 / 25
CI/CD Integration
Storybook tests को अपने CI/CD pipeline में integrate करें।
CI/CD workflow
हर commit पर component quality ensure करने के लिए Storybook tests को अपने CI/CD pipeline में integrate करें। Interaction tests, accessibility tests, और visual tests को automatically चलाएँ।
GitHub Actions example
यहाँ GitHub Actions में Storybook tests कैसे चलाएँ।
name: Storybook Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm install
- run: npm run build-storybook
- run: npm run test-storybook
- uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}Test automation benefits
CI/CD integration component regressions को जल्दी पकड़ता है, accessibility compliance ensure करता है, और deployments में design consistency को maintain करता है।
Push से पहले tests को locally चलाना
CI में push करने से पहले issues को पकड़ने के लिए Storybook tests को locally चलाएँ।
# Run interaction tests
npm run test-storybook
# Run visual tests against local build
npm run build-storybook
npx chromatic --local