From 6fd02f41c08d038cd8f61dd0ca783a37b2864c2a Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Tue, 8 Jul 2025 00:13:15 +0000
Subject: [PATCH 1/2] feat: Add unit, integration, and E2E tests
- Add Vitest setup for canvas mocking and global API mocks.
- Add Playwright configuration and basic E2E tests for the homepage.
- Implement unit tests for representative shared/ui components (ThemeToggleButton, CubeModel).
- Implement unit tests for a hypothetical entities component (PostCard).
- Implement unit tests for a features component (LoginForm).
- Implement integration tests for a views component (AuthPage login flow).
- Update package.json with new testing dependencies.
---
e2e/home.e2e.spec.ts | 75 +++++++
package.json | 3 +
playwright.config.ts | 77 ++++++++
pnpm-lock.yaml | 115 +++++++++--
.../post/ui/__tests__/PostCard.test.tsx | 90 +++++++++
.../auth/ui/__tests__/LoginForm.test.tsx | 127 ++++++++++++
src/shared/ui/__tests__/Cube.test.tsx | 115 +++++++++++
.../ui/__tests__/ThemeToggleButton.test.tsx | 105 ++++++++++
.../AuthPageLoginIntegration.test.tsx | 110 +++++++++++
tests/setup.ts | 185 ++++++++++++++++++
vitest.config.ts | 17 ++
11 files changed, 1002 insertions(+), 17 deletions(-)
create mode 100644 e2e/home.e2e.spec.ts
create mode 100644 playwright.config.ts
create mode 100644 src/entities/post/ui/__tests__/PostCard.test.tsx
create mode 100644 src/features/auth/ui/__tests__/LoginForm.test.tsx
create mode 100644 src/shared/ui/__tests__/Cube.test.tsx
create mode 100644 src/shared/ui/__tests__/ThemeToggleButton.test.tsx
create mode 100644 src/views/login/ui/__tests__/AuthPageLoginIntegration.test.tsx
create mode 100644 tests/setup.ts
diff --git a/e2e/home.e2e.spec.ts b/e2e/home.e2e.spec.ts
new file mode 100644
index 00000000..6a403a7c
--- /dev/null
+++ b/e2e/home.e2e.spec.ts
@@ -0,0 +1,75 @@
+import { test, expect } from '@playwright/test';
+
+test.describe('Homepage E2E Tests', () => {
+ test.beforeEach(async ({ page }) => {
+ // 모든 테스트 전에 홈페이지로 이동
+ await page.goto('/');
+ });
+
+ test('should load the homepage and display the correct title', async ({ page }) => {
+ // 페이지 타이틀 확인 (Next.js
의 태그 기준)
+ // 실제 프로젝트의 타이틀로 변경해야 함
+ await expect(page).toHaveTitle(/3D Blog/i); // 프로젝트 이름에 맞게 수정
+ });
+
+ test('should display a canvas for 3D content', async ({ page }) => {
+ // react-three-fiber Canvas는