Files
frontend/docs/01.playweight_test_login.md
T

85 lines
6.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
pnpm exec playwright test tests/multi-device-auth.spec.ts --project=chromium
cd frontend/apps/cs
pnpm test:playwright
💡 요약 및 권장 가이드 device-id의 유지 처리
로그아웃 시 파기 대상: 인증 토큰 쿠키 (access-token, refresh-token)
로그아웃 시 유지 대상: 기기 식별자 쿠키 및 로컬 스토리지 데이터 (device-id)
따라서 현재 구성하신 대로 쿠키/로컬 스토리지 상의 device-id는 로그아웃 시 지우지 않고 브라우저에 영속적으로 남겨두는 설계가 가장 안전하고 올바른 아키텍처입니다.
[WebServer]
[WebServer] > cs@0.1.0 dev /Users/changwng/workspace.ona/frontend/apps/cs
[WebServer] > next dev
[WebServer]
[WebServer] ⚠ Warning: Next.js inferred your workspace root, but it may not be correct.
[WebServer] We detected multiple lockfiles and selected the directory of /Users/changwng/package-lock.json as the root directory.
[WebServer] To silence this warning, set `outputFileTracingRoot` in your Next.js config, or consider removing one of the lockfiles if it's not needed.
[WebServer] See https://nextjs.org/docs/app/api-reference/config/next-config-js/output#caveats for more information.
[WebServer] Detected additional lockfiles:
[WebServer] * /Users/changwng/workspace.ona/frontend/pnpm-lock.yaml
[WebServer]
[WebServer] ▲ Next.js 15.5.18
[WebServer] - Local: http://localhost:3000
[WebServer] - Network: http://192.168.0.250:3000
[WebServer] - Environments: .env.local
[WebServer] - Experiments (use with caution):
[WebServer] · proxyTimeout: 600000
[WebServer]
[WebServer] ✓ Starting...
[WebServer] ✓ Ready in 1733ms
[WebServer] ✓ Compiled /middleware in 114ms (161 modules)
[WebServer] ○ Compiling /dashboard ...
[WebServer] ✓ Compiled /dashboard in 4.3s (6804 modules)
Running 14 tests using 1 worker
[WebServer] GET /dashboard 200 in 4913ms
[WebServer] ○ Compiling /api/proxy/[...url] ...
[WebServer] ✓ Compiled /api/proxy/[...url] in 10.2s (7070 modules)
[WebServer] [BFF Proxy Error] Backend returned status 401 for user-service/login
[WebServer] [BFF Proxy Error Body] {"status":400,"message":"해당 사용자가 없습니다.","code":"B001"}
[WebServer] POST /api/proxy/user-service/login 401 in 10766ms
✘ 1 [chromium] › tests/multi-device-auth.spec.ts:64:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 1. 로그인 성공 시 httpOnly refresh-token 쿠키 설정 (10.8s)
- 2 [chromium] › tests/multi-device-auth.spec.ts:81:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 2. PC/모바일/태블릿 독립 refresh-token 발급
- 3 [chromium] › tests/multi-device-auth.spec.ts:115:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 3. Silent Refresh RTR - 새 토큰 교체
- 4 [chromium] › tests/multi-device-auth.spec.ts:138:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 4. PC RTR 갱신 후 모바일 세션 독립 유지
- 5 [chromium] › tests/multi-device-auth.spec.ts:161:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 5. Replay Attack - 구 토큰 재주입 → 400
- 6 [chromium] › tests/multi-device-auth.spec.ts:195:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 6. refresh-token 없이 silent refresh → 401
- 7 [chromium] › tests/multi-device-auth.spec.ts:207:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 7. 잘못된 비밀번호 → 401
- 8 [chromium] › tests/multi-device-auth.spec.ts:217:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 8. 존재하지 않는 ID → 401
- 9 [chromium] › tests/multi-device-auth.spec.ts:227:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 9. 로그아웃 후 쿠키 전체 삭제
- 10 [chromium] › tests/multi-device-auth.spec.ts:250:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 10. PC 로그아웃 후 모바일 세션 독립 유지
- 11 [chromium] › tests/multi-device-auth.spec.ts:272:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 11. UI 로그인 후 httpOnly 쿠키 E2E 확인
- 12 [chromium] › tests/multi-device-auth.spec.ts:306:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 12. 동일 계정 3개 브라우저 동시 로그인
- 13 [chromium] › tests/multi-device-auth.spec.ts:341:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 13. sameSite=Strict 쿠키 속성 확인
- 14 [chromium] › tests/multi-device-auth.spec.ts:353:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 14. 연속 3회 RTR 갱신 - 4개 고유 토큰
1) [chromium] › tests/multi-device-auth.spec.ts:64:7 › 다중 디바이스 인증 & Refresh Token Rotation (RTR) 테스트 › 1. 로그인 성공 시 httpOnly refresh-token 쿠키 설정
Error: expect(received).toBe(expected) // Object.is equality
Expected: 200
Received: 401
67 | headers: { "X-Device-Id": DEVICE_PC },
68 | });
> 69 | expect(response.status()).toBe(200);
| ^
70 |
71 | const headers = response.headersArray();
72 | const refreshToken = getCookieValue(headers, "refresh-token");
at /Users/changwng/workspace.ona/frontend/apps/cs/tests/multi-device-auth.spec.ts:69:31
Error Context: test-results/multi-device-auth-다중-디바이스--4f452-ttpOnly-refresh-token-쿠키-설정-chromium/error-context.md
attachment #2: trace (application/zip) ─────────────────────────────────────────────────────────
test-results/multi-device-auth-다중-디바이스--4f452-ttpOnly-refresh-token-쿠키-설정-chromium/trace.zip
Usage:
pnpm exec playwright show-trace test-results/multi-device-auth-다중-디바이스--4f452-ttpOnly-refresh-token-쿠키-설정-chromium/trace.zip