-
Notifications
You must be signed in to change notification settings - Fork 0
Setup Testing Infrastructure #1
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
base: main
Are you sure you want to change the base?
Conversation
- Added `packages/testing-config` with shared Vitest configuration. - Configured Vitest in `apps/web` with unit and integration tests. - Configured Playwright in `apps/web` for E2E tests. - Added `packages/database/prisma/schema.test.prisma` for SQLite-based testing. - Added `test:setup` script to `packages/database` to generate test client. - Updated `packages/database/index.ts` to support local SQLite for testing. - Added example unit test for Button component. - Added example integration test for Prisma. - Added example E2E test for Home page. Co-authored-by: jose-digiweb <[email protected]>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds end-to-end and unit testing infrastructure (Playwright, Vitest), test files for web UI and Prisma integration, a shared testing-config package, Playwright/Vitest configs and setup, and database changes to support an SQLite test mode and test schema. Changes
Sequence Diagram(s)sequenceDiagram
participant Playwright as Playwright Test
participant DevServer as Dev Server (bun dev)
participant WebApp as Web Application
participant DB as Test DB (SQLite)
Playwright->>DevServer: start / reuse server (baseURL)
Playwright->>WebApp: HTTP request to "/"
WebApp->>DB: PrismaClient (isTest -> SQLite) query/create
DB-->>WebApp: return data
WebApp-->>Playwright: HTTP response (page HTML)
Playwright->>Playwright: assert UI elements (contact, heading)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/web/package.json`:
- Around line 53-75: Add `@prisma/client` to the apps/web package.json
devDependencies so the test import in
apps/web/src/lib/prisma-integration.test.ts resolves reliably; update the
"devDependencies" block to include the appropriate version of "@prisma/client"
(match workspace or `@bangeyhodhy/database` version) and run install to regenerate
lockfiles.
🧹 Nitpick comments (2)
apps/web/playwright.config.ts (1)
3-35: Align baseURL with the dev server port deterministically.
Ifbun devends up using a different port (env override or port already in use), Playwright will wait on the wrong URL. Consider deriving the port fromprocess.env.PORTso the test runner and server stay in sync.♻️ Proposed tweak
-const PORT = 3000; +const PORT = Number(process.env.PORT ?? 3000);apps/web/vitest.config.ts (1)
6-15: Consider moving the alias toresolve.aliasfor shared usage.Vitest 4.x supports
test.alias, but this option is intended for test-specific aliases. Since@is shared between the app and tests, it belongs inresolve.aliasat the top level. The current placement works but doesn't follow recommended patterns.🔧 Suggested adjustment
export default mergeConfig(baseConfig, defineConfig({ plugins: [react()], + resolve: { + alias: { + '@': resolve(__dirname, './src'), + }, + }, test: { environment: 'jsdom', setupFiles: './vitest.setup.ts', include: ['src/**/*.test.{ts,tsx}'], - alias: { - '@': resolve(__dirname, './src'), - }, }, }));
- Added `packages/testing-config` with shared Vitest configuration. - Configured Vitest in `apps/web` with unit and integration tests. - Configured Playwright in `apps/web` for E2E tests. - Added `packages/database/prisma/schema.test.prisma` for SQLite-based testing. - Added `test:setup` script to `packages/database` to generate test client. - Updated `packages/database/index.ts` to support local SQLite for testing. - Added example unit test for Button component. - Added example integration test for Prisma. - Added example E2E test for Home page. - Added `@prisma/client` to `apps/web` devDependencies. Co-authored-by: jose-digiweb <[email protected]>
This PR introduces a comprehensive testing infrastructure for the project.
It adds:
@bangeyhodhy/testing-configfor shared test configs.apps/webfor unit and integration testing.apps/webfor E2E testing.Note: To run tests, first run
cd packages/database && bun run test:setupto generate the Prisma client for the test environment. Then runbun run testorbun run test:e2einapps/web.PR created automatically by Jules for task 3844062497082502480 started by @jose-digiweb
Summary by CodeRabbit
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.