diff --git a/login.json b/login.json index cec4dd5..05f84b9 100644 --- a/login.json +++ b/login.json @@ -1,42 +1,47 @@ { "id": "login-test", - "name": "로그인 테스트 (끝판왕)", + "name": "로그인 테스트", "screenshotPolicy": { "onErrorOnly": true, "captureOn": ["error", "fail", "timeout", "404", "500", "blocked"] }, - "description": "로그인 페이지 UI 검증, 로그인 실패/성공, 대시보드 진입, 로그아웃까지 전체 인증 플로우 테스트", + "description": "로그아웃 → 로그인 페이지 UI 검증 → 로그인 실패/성공 → 대시보드 진입 테스트", "baseUrl": "https://dev.codebridge-x.com", "timeout": 30000, "tags": ["auth", "login", "critical"], "auth": { "username": "TestUser5", - "password": "password123!", - "wrongPassword": "wrongpassword" - }, - "selectors": { - "usernameInput": "#userId", - "passwordInput": "#password", - "rememberMeCheckbox": "input[type='checkbox']", - "forgotPasswordButton": "button:has-text('비밀번호를 잊으셨나요?')", - "loginButton": "button[type='submit']", - "passwordToggle": "button:has(.lucide-eye)", - "userProfileButton": "button:has-text('홍킬동')", - "logoutButton": "button:has-text('로그아웃')" + "password": "password123!" }, "steps": [ { "id": 1, - "name": "로그인 페이지 접속", - "action": "navigate", - "target": "/ko/login", - "expected": { - "url": "/ko/login", - "visible": ["로그인", "환영합니다", "SAM MES", "아이디", "비밀번호"] - } + "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'; } const headerBtns = document.querySelectorAll('header button, nav button, [class*=\"header\"] button'); for (const b of headerBtns) { if (b.querySelector('img') || b.querySelector('[class*=\"avatar\"]')) { b.click(); return 'Avatar button clicked'; } } return 'Profile button not found'; })()" }, { "id": 2, + "name": "로그아웃 클릭", + "action": "click", + "target": "로그아웃" + }, + { + "id": 3, + "name": "로그인 페이지 도착 대기", + "action": "wait", + "timeout": 3000 + }, + { + "id": 4, + "name": "로그인 페이지 확인", + "action": "verify_url", + "expected": { + "url_contains": "/ko/login" + } + }, + { + "id": 5, "name": "필수 검증 #5: 목업 페이지 감지", "action": "verify_not_mockup", "checks": [ @@ -46,222 +51,122 @@ ], "expected": "정상 페이지 (목업 아님)" }, - { - "id": 3, - "name": "UI 요소 검증 - 입력 필드", - "action": "verify_elements", - "checks": [ - "아이디 입력 필드 placeholder: '아이디를 입력하세요'", - "비밀번호 입력 필드 placeholder: '비밀번호를 입력하세요'", - "비밀번호 표시/숨김 토글 버튼 존재" - ], - "expected": "모든 입력 필드 정상" - }, - { - "id": 4, - "name": "UI 요소 검증 - 옵션", - "action": "verify_elements", - "checks": [ - "로그인 상태 유지 체크박스 존재", - "비밀번호 찾기 링크 존재", - "로그인 버튼 존재" - ], - "expected": "모든 옵션 요소 정상" - }, - { - "id": 5, - "name": "비밀번호 표시/숨김 토글 테스트", - "action": "click", - "target": "#password ~ button, button:has(.lucide-eye), button:has(.lucide-eye-off)", - "expected": "비밀번호 필드 type이 'text'로 변경 (표시 모드)" - }, { "id": 6, - "name": "비밀번호 숨김 복원", - "action": "click", - "target": "#password ~ button, button:has(.lucide-eye), button:has(.lucide-eye-off)", - "expected": "비밀번호 필드 type이 'password'로 복원 (숨김 모드)" + "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": 7, - "name": "로그인 실패 테스트 - 빈 필드", - "action": "click", - "target": "button[type='submit']", - "expected": "유효성 검사 에러 또는 로그인 실패 메시지" + "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": "fill", - "target": "#userId", - "value": "TestUser5", - "expected": "아이디 필드에 값 입력됨" + "name": "로그인 실패 테스트 - 빈 필드", + "action": "click", + "target": "button[type='submit']" }, { "id": 9, - "name": "로그인 실패 테스트 - 잘못된 비밀번호", - "action": "fill", - "target": "#password", - "value": "wrongpassword", - "expected": "비밀번호 필드에 값 입력됨" + "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": "click", - "target": "button[type='submit']", - "expected": "로그인 실패 에러 메시지 표시", - "verify": { - "type": "error_message", - "contains": ["실패", "오류", "일치하지 않", "incorrect", "failed"] - } + "name": "아이디 입력", + "action": "fill", + "target": "#userId", + "value": "TestUser5" }, { "id": 11, - "name": "비밀번호 필드 초기화", - "action": "clear", + "name": "잘못된 비밀번호 입력", + "action": "fill", "target": "#password", - "expected": "비밀번호 필드 비워짐" + "value": "wrongpassword" }, { "id": 12, - "name": "올바른 비밀번호 입력", - "action": "fill", - "target": "#password", - "value": "password123!", - "expected": "올바른 비밀번호 입력됨" + "name": "잘못된 비밀번호로 로그인 시도", + "action": "click", + "target": "button[type='submit']" }, { "id": 13, - "name": "필수 검증 #2: 로그인 버튼 클릭", - "action": "click", - "target": "button[type='submit']", - "verify": { - "url_should_change": true, - "no_error_page": true, - "api_call": "POST /api/v1/auth/login" - }, - "expected": "로그인 성공 및 대시보드로 이동" + "name": "로그인 실패 메시지 확인", + "action": "wait", + "timeout": 2000 }, { "id": 14, - "name": "대시보드 페이지 확인", - "action": "wait_for_navigation", + "name": "실패 후 로그인 페이지 유지 확인", + "action": "verify_url", "expected": { - "url_contains": "/dashboard", - "visible": ["대시보드", "홍킬동"] + "url_contains": "/login" } }, { "id": 15, - "name": "사용자 정보 표시 확인", + "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 확인", "action": "verify_elements", "checks": [ "사용자명 '홍킬동' 표시", - "메뉴 영역 표시", - "SAM 로고 표시" + "메뉴 영역 표시" ], "expected": "사용자 정보 및 메인 레이아웃 정상" }, - { - "id": 16, - "name": "세션 유지 확인 - 페이지 새로고침", - "action": "reload", - "expected": "새로고침 후에도 로그인 상태 유지" - }, - { - "id": 17, - "name": "새로고침 후 대시보드 유지 확인", - "action": "verify_url", - "expected": { - "url_contains": "/dashboard", - "visible": ["대시보드", "홍킬동"] - } - }, - { - "id": 18, - "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'; } const headerBtns = document.querySelectorAll('header button, nav button, [class*=\"header\"] button'); for (const b of headerBtns) { if (b.querySelector('img') || b.querySelector('[class*=\"avatar\"]')) { b.click(); return 'Avatar button clicked'; } } return 'Profile button not found'; })()", - "expected": "사용자 메뉴 드롭다운 열림" - }, - { - "id": 19, - "name": "로그아웃 버튼 클릭", - "action": "click", - "target": "로그아웃", - "expected": "로그아웃 처리 및 로그인 페이지로 이동" - }, { "id": 20, - "name": "로그아웃 후 로그인 페이지 확인", - "action": "verify_url", - "expected": { - "url_contains": "/login", - "visible": ["로그인", "아이디", "비밀번호"] - } + "name": "세션 유지 확인 - 페이지 새로고침", + "action": "reload" }, { "id": 21, - "name": "로그아웃 후 보호된 페이지 접근 시도", - "action": "navigate", - "target": "/ko/dashboard", - "expected": "로그인 페이지로 리다이렉트" - }, - { - "id": 22, - "name": "재로그인 테스트", - "action": "evaluate", - "script": "(async () => { const uid = document.querySelector('#userId'); const pwd = document.querySelector('#password'); if (!uid || !pwd) return 'Login form not found'; uid.value = 'TestUser5'; uid.dispatchEvent(new Event('input', {bubbles:true})); pwd.value = 'password123!'; pwd.dispatchEvent(new Event('input', {bubbles:true})); await new Promise(r => setTimeout(r, 300)); const btn = document.querySelector('button[type=\"submit\"]'); if (btn) btn.click(); return 'Re-login submitted'; })()", - "expected": "재로그인 성공" - }, - { - "id": 23, - "name": "최종 확인 - 대시보드 진입", + "name": "새로고침 후 대시보드 유지 확인", "action": "verify_url", "expected": { - "url_contains": "/dashboard", - "visible": ["대시보드", "홍킬동"] + "url_contains": "/dashboard" } } ], - "requiredVerifications": [ - { - "id": 2, - "name": "등록/저장 버튼 (로그인)", - "steps": [13], - "criteria": "로그인 버튼 클릭 -> API 호출 -> 대시보드 이동" - }, - { - "id": 5, - "name": "목업 페이지 감지", - "steps": [2], - "criteria": "입력 필드 동작, 버튼 클릭 가능" - } - ], "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": "로그아웃" - } + { "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": "홍킬동" - }, + "validUser": { "username": "TestUser5", "password": "password123!", "displayName": "홍킬동" }, "invalidPassword": "wrongpassword" } }