Skip to content

Conversation

@jose-digiweb
Copy link
Owner

@jose-digiweb jose-digiweb commented Jan 30, 2026

This PR introduces a comprehensive testing infrastructure for the project.

It adds:

  • A new workspace package @bangeyhodhy/testing-config for shared test configs.
  • Vitest setup in apps/web for unit and integration testing.
  • Playwright setup in apps/web for E2E testing.
  • A test-specific Prisma schema and generation script to enable integration tests using SQLite, bypassing the need for a running Postgres instance in the test environment.
  • Example tests to demonstrate usage.

Note: To run tests, first run cd packages/database && bun run test:setup to generate the Prisma client for the test environment. Then run bun run test or bun run test:e2e in apps/web.


PR created automatically by Jules for task 3844062497082502480 started by @jose-digiweb

Summary by CodeRabbit

  • Tests

    • Added end-to-end tests to verify homepage UI and contact info, plus unit and integration tests for components and database.
    • Introduced Vitest and Playwright setups, test runners, and test utilities for robust local and CI testing.
  • Chores

    • Added test configurations, scripts, and a lightweight testing-config package; updated project ignores for local test databases.

✏️ Tip: You can customize this high-level summary in your review settings.

- 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]>
@google-labs-jules
Copy link

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel
Copy link

vercel bot commented Jan 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bange-yhodhy-artwork Error Error Jan 31, 2026 10:50am

@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Playwright & Vitest configs
apps/web/playwright.config.ts, apps/web/vitest.config.ts, packages/testing-config/vitest.config.ts, apps/web/vitest.setup.ts
Add Playwright config (baseURL, browsers, webServer), Vitest configs (project-level and shared package), and Vitest setup for Testing Library.
Web tests
apps/web/e2e/home.spec.ts, apps/web/src/components/ui/button.test.tsx, apps/web/src/lib/prisma-integration.test.ts
Add E2E test for homepage, unit tests for Button component, and a Prisma SQLite integration test exercising create/read of Artwork.
Web package manifest
apps/web/package.json
Add test scripts (test, test:e2e) and multiple devDependencies for Playwright, Vitest, Testing Library, Playwright, and related tooling.
Database test support
packages/database/index.ts, packages/database/prisma/schema.test.prisma, packages/database/package.json, packages/database/.gitignore
Introduce test Prisma schema (SQLite), add test DB setup script, ignore *.db, and make exported database conditional on isTest (uses plain PrismaClient for file-based SQLite vs Neon adapter for production).
Testing-config package
packages/testing-config/package.json, packages/testing-config/tsconfig.json
Add a new internal package exporting a reusable Vitest config and minimal tsconfig for the package.

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through configs, tests in tow,
Playwright, Vitest—watch us grow,
SQLite hums beneath my paws,
Assertions pass with tiny applause,
A rabbit cheers: the suite's aglow! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Setup Testing Infrastructure' directly and accurately describes the main change—establishing a comprehensive testing framework across the repository.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-testing-setup-3844062497082502480

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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.
If bun dev ends up using a different port (env override or port already in use), Playwright will wait on the wrong URL. Consider deriving the port from process.env.PORT so 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 to resolve.alias for 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 in resolve.alias at 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants