From 6de3a0781182c657812e95559a7855ebd7e0e617 Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Wed, 28 Jan 2026 14:14:40 -0700 Subject: [PATCH] Remove and cleanup storybook testing --- .gitea/workflows/ci.yaml | 6 ++---- .gitignore | 6 +++--- .storybook/test-runner.js | 33 --------------------------------- README.md | 1 - __mocks__/styleMock.js | 3 --- docs/TESTING_GUIDE.md | 9 +++++++++ package.json | 2 -- vitest.config.mjs | 1 - 8 files changed, 14 insertions(+), 47 deletions(-) delete mode 100644 .storybook/test-runner.js delete mode 100644 __mocks__/styleMock.js diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 235e3bf..2786a46 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -486,10 +486,8 @@ jobs: with: { node-version: 20 } - run: npm ci - run: npm run storybook:build:github - # Temporarily disabled - test-runner needs updates for Storybook 10.x compatibility - # Will be re-enabled once test-runner compatibility issues are resolved - # - run: npm run test:sb - # env: { CI: true } + # Storybook is used for component documentation only. + # Component tests (tests/components/*.test.tsx) provide all test coverage. lint: runs-on: [self-hosted, macos-latest] diff --git a/.gitignore b/.gitignore index 65b8b33..d02fa27 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ npm-cache/ # Lighthouse CI results /lhci-results/ +/.lighthouseci/ # Ignore other image files (but not visual regression snapshots) *.png @@ -76,9 +77,8 @@ next-env.d.ts *storybook.log storybook-static -# storybook config files (to avoid git changes when switching between local and production) -.storybook/main.js -.storybook/preview.js +# Storybook build output (config files should be committed) +storybook-static # Gitea runner runtime files .runner diff --git a/.storybook/test-runner.js b/.storybook/test-runner.js deleted file mode 100644 index 73bd29a..0000000 --- a/.storybook/test-runner.js +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = { - // Test runner configuration - testMatch: ["**/*.stories.@(js|jsx|ts|tsx)"], - testTimeout: 30000, - retries: 2, - // Fix for the StorybookTestRunnerError initialization issue - setupFilesAfterEnv: [ - "/node_modules/@storybook/test-runner/jest-setup.js", - ], - // Ensure proper module resolution - moduleNameMapping: { - "^@/(.*)$": "/app/$1", - }, - // Test environment configuration - testEnvironment: "jsdom", - // Transform configuration - transform: { - "^.+\\.(js|jsx|ts|tsx)$": [ - "babel-jest", - { presets: ["@babel/preset-env", "@babel/preset-react"] }, - ], - }, - // Module file extensions - moduleFileExtensions: ["js", "jsx", "ts", "tsx", "json"], - // Ignore patterns - testPathIgnorePatterns: ["/node_modules/", "/.next/"], - // Coverage configuration - collectCoverageFrom: [ - "app/**/*.{js,jsx,ts,tsx}", - "!app/**/*.d.ts", - "!app/**/*.stories.{js,jsx,ts,tsx}", - ], -}; diff --git a/README.md b/README.md index 40be15c..5cba928 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,6 @@ The Storybook configuration automatically detects the environment: - `npm run e2e:ui` - Run E2E tests with UI - `npm run e2e:serve` - Start dev server and run E2E tests - `npm run lhci` - Run performance tests -- `npm run test:sb` - Run Storybook tests ### Storybook diff --git a/__mocks__/styleMock.js b/__mocks__/styleMock.js deleted file mode 100644 index f7b01ba..0000000 --- a/__mocks__/styleMock.js +++ /dev/null @@ -1,3 +0,0 @@ -// Mock CSS imports for tests -// This prevents jsdom from trying to parse Tailwind CSS v4 syntax -export default {}; diff --git a/docs/TESTING_GUIDE.md b/docs/TESTING_GUIDE.md index 9be8be9..97b9b52 100644 --- a/docs/TESTING_GUIDE.md +++ b/docs/TESTING_GUIDE.md @@ -190,6 +190,15 @@ describe("Input – behaviour specifics", () => { npm run visual:test ``` +### Storybook + +**Storybook is used for component documentation and visual review only.** It is not used for automated testing. + +- Component tests (`tests/components/*.test.tsx`) provide all test coverage previously handled by Storybook test-runner +- Storybook stories (`stories/*.stories.js`) serve as living documentation and visual examples +- Interaction functions are inlined in story files for demonstration purposes +- Run Storybook locally with `npm run storybook` for component development and review + ### Accessibility Testing Accessibility is tested at two levels: diff --git a/package.json b/package.json index cf985a6..1d2c323 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "test:watch": "vitest", "test:ui": "vitest --ui", "test:component": "vitest run tests/components", - "test:sb": "storybook dev -p 6006 & wait-on http://localhost:6006 && test-storybook --url http://localhost:6006", "e2e": "playwright test", "test:e2e": "playwright test", "e2e:ui": "playwright test --ui", @@ -64,7 +63,6 @@ "@storybook/addon-a11y": "^10.2.0", "@storybook/addon-interactions": "^8.6.14", "@storybook/nextjs": "^10.2.0", - "@storybook/test-runner": "^0.24.2", "@svgr/webpack": "^8.1.0", "@tailwindcss/postcss": "^4.1.11", "@testing-library/jest-dom": "^6.8.0", diff --git a/vitest.config.mjs b/vitest.config.mjs index c78a9e1..f764ab9 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -32,7 +32,6 @@ export default defineConfig({ "tests/e2e/**/*.e2e.test.{js,jsx,ts,tsx}", ], exclude: [ - "tests/e2e/**/*.storybook.test.{js,jsx,ts,tsx}", "tests/e2e/**/*.spec.{js,jsx,ts,tsx}", ], // Disable CSS processing in tests to avoid jsdom parsing errors with Tailwind v4