Files
sam-scenarios/sales-management.json

183 lines
16 KiB
JSON
Raw Normal View History

{
"id": "sales-management",
"name": "Full CRUD 테스트: 매출관리",
"version": "2.0.0",
"auth": {
"role": "admin"
},
"menuNavigation": {
"level1": "회계관리",
"level2": "매출관리"
},
"screenshotPolicy": {
"captureOnFail": true,
"captureOnPass": false
},
"steps": [
{
"id": 1,
"name": "[회계관리 > 매출관리] 페이지 로드 대기",
"action": "wait",
"timeout": 3000
},
{
"id": 2,
"name": "[회계관리 > 매출관리] 테이블 로드 대기",
"action": "wait_for_table",
"timeout": 15000
},
{
"id": 3,
"name": "[회계관리 > 매출관리] [INSPECT] UI 구조 검증 + 초기 행수 저장",
"action": "evaluate",
"script": "(async()=>{const R={phase:'INSPECT'};const rows=document.querySelectorAll('table tbody tr');R.rowCount=rows.length;window.__E2E_ROWS_BEFORE__=rows.length;const createBtn=Array.from(document.querySelectorAll('button')).find(b=>/등록/.test(b.innerText?.trim()));R.hasCreateBtn=!!createBtn;R.createBtnText=createBtn?.innerText?.trim()||'';const ths=Array.from(document.querySelectorAll('table thead th')).map(th=>th.innerText?.trim()).filter(Boolean);R.columns=ths.join(',').substring(0,200);R.ok=R.rowCount>=0&&R.hasCreateBtn;R.info='rows:'+R.rowCount+',cols:'+ths.length;return JSON.stringify(R);})()",
"timeout": 15000,
"phase": "INSPECT"
},
{
"id": 4,
"name": "[회계관리 > 매출관리] [CREATE] 매출 등록 버튼 클릭",
"action": "click_button",
"value": "등록",
"timeout": 10000,
"phase": "CREATE"
},
{
"id": 5,
"name": "[회계관리 > 매출관리] [CREATE] 등록 폼 로드 대기",
"action": "wait",
"timeout": 3000
},
{
"id": 6,
"name": "[회계관리 > 매출관리] [CREATE] 거래처+매출유형+품목 입력 + 자동계산 검증 + 등록",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const sv=(el,v)=>{const p=el.tagName==='TEXTAREA'?HTMLTextAreaElement.prototype:HTMLInputElement.prototype;const ns=Object.getOwnPropertyDescriptor(p,'value')?.set;if(ns)ns.call(el,v);else el.value=v;el.dispatchEvent(new Event('input',{bubbles:true}));el.dispatchEvent(new Event('change',{bubbles:true}));};const ts=window.__E2E_TS__||(()=>{const n=new Date();const p=v=>v.toString().padStart(2,'0');return n.getFullYear()+p(n.getMonth()+1)+p(n.getDate())+'_'+p(n.getHours())+p(n.getMinutes())+p(n.getSeconds());})();window.__E2E_TS__=ts;const toastInfo=()=>{const t=document.querySelectorAll('[data-sonner-toast],[role=\"status\"],[class*=\"toast\"],[class*=\"Toast\"],[class*=\"Toaster\"] [data-content]');return{count:t.length,text:t.length>0?Array.from(t).pop()?.innerText?.trim().substring(0,100):''};};const R={phase:'CREATE',ts};await w(1000);const labels=Array.from(document.querySelectorAll('label'));const vendorLabel=labels.find(l=>l.innerText?.includes('거래처'));if(vendorLabel){const container=vendorLabel.closest('.space-y-2')||vendorLabel.parentElement;const combo=container?.querySelector('button[role=\"combobox\"]');if(combo){combo.click();await w(800);const lb=document.querySelector('[role=\"listbox\"]');if(lb){const opts=lb.querySelectorAll('[role=\"option\"]');if(opts.length>0){R.vendorName=opts[0].innerText?.trim();window.__E2E_VENDOR__=R.vendorName;opts[0].click();await w(500);}}else{document.dispatchEvent(new KeyboardEvent('keydown',{key:'Escape',bubbles:true}));await w(200);}}}const typeLabel=labels.find(l=>/매출.*유형|매출유형/.test(l.innerText));if(typeLabel){const container=typeLabel.closest('.space-y-2')||typeLabel.parentElement;const combo=container?.querySelector('button[role=\"combobox\"]');if(combo){combo.click();await w(800);const lb=document.querySelector('[role=\"listbox\"]');if(lb){const opt=Array.from(lb.querySelectorAll('[role=\"option\"]')).find(o=>o.innerText?.includes('상품'));if(opt){opt.click();await w(500);}else{const first=lb.querySelector('[role=\"option\"]');if(first){first.click();await w(500);}}}else{document.dispatchEvent(new KeyboardEvent('keydown',{key:'Escape',bubbles:true}));await w(200);}}}const nameInput=document.querySelector('input[placeholder=\"품목명\"]');if(!nameInput){R.error='품목명 입력란 없음';R.ok=false;return JSON.stringify(R);}sv(nameInput,'E2E_TEST_매출품목_'+ts);await w(300);const itemRow=nameInput.closest('tr');if(itemRow){const numInputs=Array.from(itemRow.querySelectorAll('input[inputmode=\"numeric\"]'));R.numericInputCount=numInputs.length;if(numInputs.length>=2){numInputs[0].focus();await w(100);sv(numInputs[0],'10');numInputs[0].dispatchEvent(new Event('blur',{bubbles:true}));await w(500);numInputs[1].focus();await w(100);sv(numInputs[1],'50000');numInputs[1].dispatchEvent(new Event('blur',{bubbles:true}));await w(500);}const noteInput=itemRow.querySelector('input[placeholder=\"적요\"]');if(noteInput){sv(noteInput,'E2E_TEST_적요_'+ts);await w(300);}}await w(1500);const pageText=document.body.innerText;R.hasSupply500k=pageText.includes('500,000')||pageText.includes('500000');R.hasVat50k=pageText.includes('50,000')||pageText.includes('50000');const submitBtn=Array.from(document.querySelectorAll('button')).find(b=>b.innerText?.trim()==='등록'&&b.offsetParent!==null&&!b.disabled);if(!submitBtn){R.error='등록 버튼 없음';R.ok=false;return JSON.stringify(R);}submitBtn.click();await w(3000);R.toast=toastInfo();R.url=location.pathname+location.search;R.ok=true;return JSON.stringify(R);})()",
"timeout": 45000,
"phase": "CREATE"
},
{
"id": 7,
"name": "[회계관리 > 매출관리] [CREATE] 등록 후 대기",
"action": "wait",
"timeout": 3000
},
{
"id": 8,
"name": "[회계관리 > 매출관리] [CREATE] 목록 복귀",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const onForm=location.search.includes('mode=new')||location.search.includes('mode=edit')||location.search.includes('mode=view')||new RegExp('/(new|[0-9]+|[0-9a-f]{8,})$').test(location.pathname);if(onForm){const btn=Array.from(document.querySelectorAll('button,a')).find(b=>/목록|취소|뒤로/.test(b.innerText?.trim()));if(btn){btn.click();await w(2000);}else{history.back();await w(2000);}}return JSON.stringify({url:location.pathname+location.search});})()",
"timeout": 10000,
"phase": "CREATE"
},
{
"id": 9,
"name": "[회계관리 > 매출관리] [CREATE] 목록 안정화 대기",
"action": "wait",
"timeout": 2000
},
{
"id": 10,
"name": "[회계관리 > 매출관리] [VERIFY] 생성 데이터 확인 (행수 증가 + 금액 대조)",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const R={phase:'VERIFY_CREATE'};await w(500);const rows=document.querySelectorAll('table tbody tr');R.rowCount=rows.length;let found=Array.from(rows).find(r=>r.innerText?.includes('E2E_TEST_'));if(!found){const ths=document.querySelectorAll('table thead th');const sortTh=Array.from(ths).find(th=>/일자|날짜|No|번호/.test(th.innerText?.trim()));if(sortTh){sortTh.click();await w(1500);sortTh.click();await w(1500);}const rows2=document.querySelectorAll('table tbody tr');found=Array.from(rows2).find(r=>r.innerText?.includes('E2E_TEST_'));R.rowCount=rows2.length;if(found)R.info='found after sort';}R.found=!!found;if(found)R.foundText=found.innerText?.substring(0,100);R.ok=R.found;return JSON.stringify(R);})()",
"timeout": 15000,
"phase": "VERIFY"
},
{
"id": 11,
"name": "[회계관리 > 매출관리] [READ] 첫 행 클릭 → 상세 페이지 진입",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const R={phase:'READ'};const rows=document.querySelectorAll('table tbody tr');if(rows.length===0){R.error='테이블 행 없음';R.ok=false;return JSON.stringify(R);}rows[0].click();await w(2500);R.detailUrl=location.pathname+location.search;R.isDetailPage=location.search.includes('mode=view')||/\\/[0-9]+/.test(location.pathname);R.ok=R.isDetailPage;return JSON.stringify(R);})()",
"timeout": 15000,
"phase": "READ"
},
{
"id": 12,
"name": "[회계관리 > 매출관리] [READ] 상세 페이지 대기",
"action": "wait",
"timeout": 2000
},
{
"id": 13,
"name": "[회계관리 > 매출관리] [READ] 상세 데이터 검증 (E2E_TEST_ 품목명/적요/금액)",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const ts=window.__E2E_TS__||'';const R={phase:'READ_VERIFY'};R.url=location.pathname+location.search;const inputs=Array.from(document.querySelectorAll('input,textarea')).filter(i=>i.offsetParent!==null);const hasTestData=inputs.some(i=>i.value?.includes('E2E_TEST_'));const bodyHasTest=document.body.innerText.includes('E2E_TEST_');R.fieldCount=inputs.length;R.hasTestData=hasTestData||bodyHasTest;R.hasItemName=inputs.some(i=>i.value?.includes('E2E_TEST_매출품목'));R.hasNote=inputs.some(i=>i.value?.includes('E2E_TEST_적요'));const pageText=document.body.innerText;R.hasSupply500k=pageText.includes('500,000')||pageText.includes('500000');R.ok=R.hasTestData;return JSON.stringify(R);})()",
"timeout": 15000,
"phase": "READ"
},
{
"id": 14,
"name": "[회계관리 > 매출관리] [UPDATE] 수정 모드 진입 + 수량 변경(10→20) + 재계산 검증 + 저장",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const sv=(el,v)=>{const p=el.tagName==='TEXTAREA'?HTMLTextAreaElement.prototype:HTMLInputElement.prototype;const ns=Object.getOwnPropertyDescriptor(p,'value')?.set;if(ns)ns.call(el,v);else el.value=v;el.dispatchEvent(new Event('input',{bubbles:true}));el.dispatchEvent(new Event('change',{bubbles:true}));};const ts=window.__E2E_TS__||'';const toastInfo=()=>{const t=document.querySelectorAll('[data-sonner-toast],[role=\"status\"],[class*=\"toast\"],[class*=\"Toast\"],[class*=\"Toaster\"] [data-content]');return{count:t.length,text:t.length>0?Array.from(t).pop()?.innerText?.trim().substring(0,100):''};};const R={phase:'UPDATE'};const editBtn=Array.from(document.querySelectorAll('button')).find(b=>b.innerText?.trim()==='수정');if(!editBtn){R.error='수정 버튼 없음';R.ok=false;return JSON.stringify(R);}editBtn.click();await w(2000);R.editUrl=location.pathname+location.search;const nameInput=document.querySelector('input[placeholder=\"품목명\"]');const itemRow=nameInput?.closest('tr');if(itemRow){const numInputs=Array.from(itemRow.querySelectorAll('input[inputmode=\"numeric\"]'));if(numInputs.length>=1){numInputs[0].focus();await w(100);sv(numInputs[0],'20');numInputs[0].dispatchEvent(new Event('blur',{bubbles:true}));await w(1000);}R.modified='수량→20';}await w(1500);const pageText=document.body.innerText;R.hasSupply1M=pageText.includes('1,000,000')||pageText.includes('1000000');R.hasVat100k=pageText.includes('100,000')||pageText.includes('100000');const saveBtn=Array.from(document.querySelectorAll('button')).find(b=>(b.innerText?.trim()==='저장')&&b.offsetParent!==null&&!b.disabled);if(saveBtn){saveBtn.click();await w(3000);}R.toast=toastInfo();R.ok=true;return JSON.stringify(R);})()",
"timeout": 35000,
"phase": "UPDATE"
},
{
"id": 15,
"name": "[회계관리 > 매출관리] [UPDATE] 저장 후 대기",
"action": "wait",
"timeout": 3000
},
{
"id": 16,
"name": "[회계관리 > 매출관리] [UPDATE] 수정 내용 검증 (공급가액 1,000,000 재계산 확인)",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const toastInfo=()=>{const t=document.querySelectorAll('[data-sonner-toast],[role=\"status\"],[class*=\"toast\"],[class*=\"Toast\"],[class*=\"Toaster\"] [data-content]');return{count:t.length,text:t.length>0?Array.from(t).pop()?.innerText?.trim().substring(0,100):''};};const R={phase:'VERIFY_UPDATE'};const pageText=document.body.innerText;R.toast=toastInfo();const toastOk=R.toast.text&&(/수정|완료|저장|성공/.test(R.toast.text));R.hasSupply1M=pageText.includes('1,000,000')||pageText.includes('1000000');R.toastOk=toastOk;R.ok=toastOk||R.hasSupply1M;return JSON.stringify(R);})()",
"timeout": 15000,
"phase": "UPDATE"
},
{
"id": 17,
"name": "[회계관리 > 매출관리] [UPDATE] 목록 복귀",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const onForm=location.search.includes('mode=new')||location.search.includes('mode=edit')||location.search.includes('mode=view')||new RegExp('/(new|[0-9]+|[0-9a-f]{8,})$').test(location.pathname);if(onForm){const btn=Array.from(document.querySelectorAll('button,a')).find(b=>/목록|취소|뒤로/.test(b.innerText?.trim()));if(btn){btn.click();await w(2000);}else{history.back();await w(2000);}}return JSON.stringify({url:location.pathname+location.search});})()",
"timeout": 10000,
"phase": "UPDATE"
},
{
"id": 18,
"name": "[회계관리 > 매출관리] [UPDATE] 목록 안정화 대기",
"action": "wait",
"timeout": 2000
},
{
"id": 19,
"name": "[회계관리 > 매출관리] [DELETE] 데이터 삭제 (첫 행 → 상세 → 삭제 → 확인)",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const ts=window.__E2E_TS__||'';const toastInfo=()=>{const t=document.querySelectorAll('[data-sonner-toast],[role=\"status\"],[class*=\"toast\"],[class*=\"Toast\"],[class*=\"Toaster\"] [data-content]');return{count:t.length,text:t.length>0?Array.from(t).pop()?.innerText?.trim().substring(0,100):''};};const R={phase:'DELETE'};if(!location.search.includes('mode=view')&&!location.search.includes('mode=edit')){const rows=document.querySelectorAll('table tbody tr');if(rows.length===0){R.error='테이블 행 없음';R.ok=false;return JSON.stringify(R);}rows[0].click();await w(2500);}const delBtn=Array.from(document.querySelectorAll('button')).find(b=>b.innerText?.trim()==='삭제');if(!delBtn){R.error='삭제 버튼 없음';R.ok=false;return JSON.stringify(R);}delBtn.click();await w(1000);const cfm=Array.from(document.querySelectorAll('[role=\"alertdialog\"] button,[role=\"dialog\"] button,button')).find(b=>/확인|삭제|예|Yes/.test(b.innerText?.trim())&&b!==delBtn&&b.offsetParent!==null);if(cfm){cfm.click();await w(3000);}R.toast=toastInfo();R.ok=true;return JSON.stringify(R);})()",
"timeout": 35000,
"phase": "DELETE",
"critical": true
},
{
"id": 20,
"name": "[회계관리 > 매출관리] [DELETE] 삭제 후 대기",
"action": "wait",
"timeout": 3000
},
{
"id": 21,
"name": "[회계관리 > 매출관리] [DELETE] 목록 복귀",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const onForm=location.search.includes('mode=new')||location.search.includes('mode=edit')||location.search.includes('mode=view')||new RegExp('/(new|[0-9]+|[0-9a-f]{8,})$').test(location.pathname);if(onForm){const btn=Array.from(document.querySelectorAll('button,a')).find(b=>/목록|취소|뒤로/.test(b.innerText?.trim()));if(btn){btn.click();await w(2000);}else{history.back();await w(2000);}}return JSON.stringify({url:location.pathname+location.search});})()",
"timeout": 10000,
"phase": "DELETE"
},
{
"id": 22,
"name": "[회계관리 > 매출관리] [DELETE] 목록 안정화 대기",
"action": "wait",
"timeout": 2000
},
{
"id": 23,
"name": "[회계관리 > 매출관리] [VERIFY] 삭제 확인 (행수 원복 검증)",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const ts=window.__E2E_TS__||'E2E_TEST_';const R={phase:'VERIFY_DELETE'};await w(1000);if(location.search.includes('mode=view')||location.search.includes('mode=edit')){const btn=Array.from(document.querySelectorAll('button,a')).find(b=>/목록/.test(b.innerText?.trim()));if(btn){btn.click();await w(2000);}else{history.back();await w(2000);}}const rows=document.querySelectorAll('table tbody tr');R.rowCount=rows.length;const found=Array.from(rows).find(r=>r.innerText?.includes(ts));R.stillExists=!!found;R.ok=!found;R.info='rows:'+rows.length+(found?',E2E data still exists':',E2E data removed');return JSON.stringify(R);})()",
"timeout": 15000,
"phase": "VERIFY"
}
]
}