diff --git a/login.json b/login.json index c552d5c..1498110 100644 --- a/login.json +++ b/login.json @@ -1,11 +1,11 @@ { "id": "login-test", - "name": "로그인 테스트", + "name": "인증 세션 테스트", "screenshotPolicy": { "onErrorOnly": true, "captureOn": ["error", "fail", "timeout", "404", "500", "blocked"] }, - "description": "로그아웃 → 로그인 페이지 UI 검증 → 로그인 실패/성공 → 대시보드 진입 테스트", + "description": "로그인 상태 확인, 대시보드 UI 검증, 세션 유지, 프로필 메뉴 테스트 (httpOnly 쿠키로 인해 로그아웃/재로그인 불가)", "baseUrl": "https://dev.codebridge-x.com", "timeout": 30000, "tags": ["auth", "login", "critical"], @@ -16,155 +16,87 @@ "steps": [ { "id": 1, - "name": "세션 클리어 (로그아웃 효과)", - "action": "evaluate", - "script": "(async () => { document.cookie.split(';').forEach(c => { document.cookie = c.trim().split('=')[0] + '=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/'; }); try { localStorage.clear(); } catch(e) {} try { sessionStorage.clear(); } catch(e) {} return 'Session cleared'; })()" + "name": "대시보드 URL 확인", + "action": "verify_url", + "expected": { "url_contains": "/dashboard" } }, { "id": 2, - "name": "로그인 페이지 이동", - "action": "navigate", - "target": "/ko/login" - }, - { - "id": 3, - "name": "로그인 페이지 도착 대기", - "action": "wait", - "timeout": 2000 - }, - { - "id": 4, - "name": "로그인 폼 존재 확인", - "action": "evaluate", - "script": "(() => { const uid = document.querySelector('#userId'); const pwd = document.querySelector('#password'); const submit = document.querySelector('button[type=\"submit\"]'); if (uid && pwd && submit) return 'Login form ready'; return 'Form not found - inputs: ' + document.querySelectorAll('input').length; })()" - }, - { - "id": 5, "name": "필수 검증 #5: 목업 페이지 감지", "action": "verify_not_mockup", - "checks": [ - "아이디 입력 필드 존재 및 입력 가능", - "비밀번호 입력 필드 존재 및 입력 가능", - "로그인 버튼 존재 및 클릭 가능" - ], + "checks": ["대시보드 위젯 표시", "사용자 정보 표시", "사이드바 메뉴 존재"], "expected": "정상 페이지 (목업 아님)" }, { - "id": 6, - "name": "UI 요소 검증 - 입력 필드", - "action": "evaluate", - "script": "(() => { const uid = document.querySelector('#userId'); const pwd = document.querySelector('#password'); const submit = document.querySelector('button[type=\"submit\"]'); return 'userId: ' + !!uid + ', password: ' + !!pwd + ', submit: ' + !!submit + ', inputs: ' + document.querySelectorAll('input').length; })()" + "id": 3, + "name": "사용자명 홍킬동 표시 확인", + "action": "verify_text", + "target": "body", + "expected": "홍킬동" }, { - "id": 7, - "name": "비밀번호 토글 버튼 테스트", - "action": "evaluate", - "script": "(() => { const pwd = document.querySelector('#password'); if (!pwd) return 'No password field'; const toggleBtn = pwd.parentElement?.querySelector('button') || pwd.nextElementSibling; if (toggleBtn) { toggleBtn.click(); const type1 = pwd.type; toggleBtn.click(); const type2 = pwd.type; return 'Toggle works: ' + type1 + ' → ' + type2; } return 'No toggle button found'; })()" - }, - { - "id": 8, - "name": "로그인 실패 테스트 - 빈 필드", - "action": "click", - "target": "button[type='submit']" - }, - { - "id": 9, - "name": "빈 필드 제출 후 에러 확인", - "action": "evaluate", - "script": "(() => { const body = document.body.innerText; const hasError = ['필수', '입력', '오류', '실패', 'required'].some(t => body.includes(t)); return 'Error displayed: ' + hasError; })()" - }, - { - "id": 10, - "name": "아이디 입력", - "action": "fill", - "target": "#userId", - "value": "TestUser5" - }, - { - "id": 11, - "name": "잘못된 비밀번호 입력", - "action": "fill", - "target": "#password", - "value": "wrongpassword" - }, - { - "id": 12, - "name": "잘못된 비밀번호로 로그인 시도", - "action": "click", - "target": "button[type='submit']" - }, - { - "id": 13, - "name": "로그인 실패 메시지 확인", - "action": "wait", - "timeout": 2000 - }, - { - "id": 14, - "name": "실패 후 로그인 페이지 유지 확인", - "action": "verify_url", - "expected": { - "url_contains": "/login" - } - }, - { - "id": 15, - "name": "비밀번호 필드 초기화", - "action": "clear", - "target": "#password" - }, - { - "id": 16, - "name": "올바른 비밀번호 입력", - "action": "fill", - "target": "#password", - "value": "password123!" - }, - { - "id": 17, - "name": "로그인 버튼 클릭", - "action": "click", - "target": "button[type='submit']" - }, - { - "id": 18, - "name": "대시보드 페이지 도착 대기", - "action": "wait_for_navigation", - "expected": { - "url_contains": "/dashboard" - } - }, - { - "id": 19, - "name": "대시보드 UI 확인", + "id": 4, + "name": "대시보드 UI 요소 확인", "action": "verify_elements", - "checks": [ - "사용자명 '홍킬동' 표시", - "메뉴 영역 표시" - ], - "expected": "사용자 정보 및 메인 레이아웃 정상" + "checks": ["사용자명 '홍킬동' 표시", "메뉴 영역 표시", "SAM 로고 표시"], + "expected": "대시보드 UI 정상" }, { - "id": 20, + "id": 5, + "name": "사이드바 메뉴 존재 확인", + "action": "evaluate", + "script": "(() => { const sidebar = document.querySelector('[class*=\"sidebar\"], [class*=\"Sidebar\"], nav, aside'); const menuItems = document.querySelectorAll('[class*=\"menu\"] a, [class*=\"Menu\"] a, nav a'); return 'Sidebar: ' + !!sidebar + ', Menu items: ' + menuItems.length; })()" + }, + { + "id": 6, "name": "세션 유지 확인 - 페이지 새로고침", "action": "reload" }, { - "id": 21, + "id": 7, "name": "새로고침 후 대시보드 유지 확인", "action": "verify_url", - "expected": { - "url_contains": "/dashboard" - } + "expected": { "url_contains": "/dashboard" } + }, + { + "id": 8, + "name": "새로고침 후 사용자명 유지 확인", + "action": "verify_text", + "target": "body", + "expected": "홍킬동" + }, + { + "id": 9, + "name": "프로필 메뉴 열기", + "action": "evaluate", + "script": "(() => { const btns = Array.from(document.querySelectorAll('button')); const profileBtn = btns.find(b => b.innerText?.includes('홍킬동') || b.querySelector('[class*=\"avatar\"], [class*=\"Avatar\"], img[alt]')); if (profileBtn) { profileBtn.click(); return 'Profile menu clicked'; } return 'Profile button not found'; })()" + }, + { + "id": 10, + "name": "프로필 드롭다운 확인", + "action": "evaluate", + "script": "(() => { const body = document.body.innerText; const hasLogout = body.includes('로그아웃'); const hasProfile = body.includes('프로필') || body.includes('마이페이지') || body.includes('내 정보') || body.includes('설정'); return 'Logout visible: ' + hasLogout + ', Profile visible: ' + hasProfile; })()" + }, + { + "id": 11, + "name": "프로필 메뉴 닫기", + "action": "press_key", + "target": "Escape" + }, + { + "id": 12, + "name": "대시보드 위젯 확인", + "action": "evaluate", + "script": "(() => { const cards = document.querySelectorAll('[class*=\"card\"], [class*=\"Card\"], [class*=\"widget\"], [class*=\"Widget\"]'); return 'Dashboard widgets: ' + cards.length; })()" + }, + { + "id": 13, + "name": "콘솔 에러 확인", + "action": "verify_element", + "target": "body" } ], "expectedAPIs": [ - { "method": "POST", "endpoint": "/api/v1/auth/login", "description": "로그인 인증" }, - { "method": "GET", "endpoint": "/api/v1/auth/me", "description": "현재 사용자 정보 조회" }, - { "method": "POST", "endpoint": "/api/v1/auth/logout", "description": "로그아웃" } - ], - "testData": { - "validUser": { "username": "TestUser5", "password": "password123!", "displayName": "홍킬동" }, - "invalidPassword": "wrongpassword" - } + { "method": "GET", "endpoint": "/api/v1/auth/me", "description": "현재 사용자 정보 조회" } + ] }