Files
sam-scenarios/edge-rapid-click-save-sales.json

68 lines
5.1 KiB
JSON
Raw Permalink Normal View History

{
"id": "edge-rapid-click-save-sales",
"name": "엣지 케이스: 저장 버튼 연타 (판매 > 거래처관리)",
"version": "1.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": 5000
},
{
"id": 3,
"name": "등록 폼 열기",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const R={phase:'OPEN_FORM'};const priorities=['등록','추가','작성','글쓰기','신규'];const exclude=['신규업체','신규거래'];let btn=null;for(const kw of priorities){ btn=Array.from(document.querySelectorAll('button')).find(b=>{ const t=b.innerText?.trim()||''; if(exclude.some(e=>t.includes(e)))return false; return t.includes(kw)&&b.offsetParent!==null&&!b.disabled; });if(btn)break;}if(!btn){btn=Array.from(document.querySelectorAll('button')).find(b=>b.innerText?.trim()?.startsWith('+')&&b.offsetParent!==null);}if(!btn){R.err='등록 버튼 없음';R.ok=true;return JSON.stringify(R);}R.btnText=btn.innerText?.trim();btn.click();await w(2500);R.url=location.pathname+location.search;R.ok=true;return JSON.stringify(R);})()",
"timeout": 15000,
"phase": "OPEN_FORM"
},
{
"id": 4,
"name": "폼 렌더링 대기",
"action": "wait",
"timeout": 2000
},
{
"id": 6,
"name": "저장 버튼 연타 (5회, 50ms 간격)",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const R={phase:'RAPID_CLICK_SAVE'};const btn=Array.from(document.querySelectorAll('button')).find(b=>{ const t=b.innerText?.trim()||''; return(/저장|등록|확인|제출/.test(t))&&b.offsetParent!==null&&!b.disabled;});if(!btn){R.err='저장/등록 버튼 없음';R.ok=true;return JSON.stringify(R);}R.btnText=btn.innerText?.trim();let clickCount=0;for(let i=0;i<5;i++){btn.click();clickCount++;await w(50);}R.clickCount=clickCount;await w(2000);R.ok=true;return JSON.stringify(R);})()",
"timeout": 15000,
"phase": "RAPID_CLICK_SAVE"
},
{
"id": 7,
"name": "연타 후 상태 확인",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const R={phase:'RAPID_CLICK_RESULT'};await w(2000);const dialogs=document.querySelectorAll('[role=\"dialog\"],[role=\"alertdialog\"],[aria-modal=\"true\"]');const visibleDialogs=Array.from(dialogs).filter(d=>d.offsetParent!==null);R.dialogCount=visibleDialogs.length;const toasts=document.querySelectorAll('[data-sonner-toast],[role=\"status\"],[class*=\"toast\"],[class*=\"Toast\"]');R.toastCount=toasts.length;if(toasts.length>0){R.toastTexts=Array.from(toasts).map(t=>t.innerText?.trim().substring(0,80)).filter(Boolean);}const hasError=document.querySelector('[class*=\"error\"],[class*=\"Error\"],[role=\"alert\"]');R.hasError=!!hasError;R.url=location.pathname+location.search;R.pageStable=!document.querySelector('.loading,.spinner,[class*=\"skeleton\"]');R.ok=R.dialogCount<=1&&!R.hasError;R.info=R.dialogCount<=1&&!R.hasError?'✅ 연타 클릭 후 정상 상태':'❌ 연타 클릭 후 비정상 상태 (다중 모달/에러)';return JSON.stringify(R);})()",
"timeout": 10000,
"phase": "RAPID_CLICK_RESULT"
},
{
"id": 8,
"name": "폼/모달 닫기",
"action": "evaluate",
"script": "(async()=>{const w=ms=>new Promise(r=>setTimeout(r,ms));const R={phase:'CLOSE_FORM'};const dlg=document.querySelector('[role=\"alertdialog\"],[role=\"dialog\"]');if(dlg&&dlg.offsetParent!==null){ const closeBtn=dlg.querySelector('button[class*=\"close\"]')||Array.from(dlg.querySelectorAll('button')).find(b=>/닫기|확인|취소|Close/.test(b.innerText?.trim())); if(closeBtn){closeBtn.click();await w(500);} else{document.dispatchEvent(new KeyboardEvent('keydown',{key:'Escape',bubbles:true}));await w(500);}}if(location.search.includes('mode=new')||location.search.includes('mode=edit')){ const backBtn=Array.from(document.querySelectorAll('button,a')).find(b=>/목록|취소|뒤로/.test(b.innerText?.trim())); if(backBtn){backBtn.click();await w(2000);} else{history.back();await w(2000);}}const modal=document.querySelector('[role=\"dialog\"],[aria-modal=\"true\"],[class*=\"modal\"]:not([class*=\"tooltip\"])');if(modal&&modal.offsetParent!==null){ const xBtn=modal.querySelector('button[class*=\"close\"],[aria-label=\"닫기\"],[aria-label=\"Close\"]')||Array.from(modal.querySelectorAll('button')).find(b=>/닫기|취소|Close/.test(b.innerText?.trim())); if(xBtn){xBtn.click();await w(500);} else{document.dispatchEvent(new KeyboardEvent('keydown',{key:'Escape',bubbles:true}));await w(500);}}R.url=location.pathname+location.search;R.ok=true;return JSON.stringify(R);})()",
"timeout": 10000,
"phase": "CLOSE_FORM"
}
]
}