SuperAPI AI Directory

peach-e2e-run

Testing & quality

View repository

Updated 10-15 21:38

About this skill

Run E2E scenario

./e2e.sh Run the scenario via CLI. (playwright-cli based) For debugging, quickly check with agent-browser eval.

Tool role division

Purpose Tool
Scenario execution ./e2e.sh run (playwright-cli based)
Selector debugging/DOM check agent-browser eval (fast)
iframe debugging ./e2e/pwc.sh eval (fallback)

Workflow

1. 환경 확인 (setup)
2. 탭 목록 → 사용자에게 탭 번호 확인
3. 시나리오 목록 → 사용자 선택
4. --tab N으로 지정된 탭에서 시나리오 실행
5. 결과 보고 (에러 시 agent-browser eval로 디버깅)

Step 1: Environment check

cd e2e && ./e2e.sh setup

setupAutomatically check/install all of these environments (Chrome Beta, agent-browser, playwright-cli, CDP connection). If CDP is not connected: ./e2e.sh chrome Run request.

Step 2: Tab check

cd e2e && ./e2e.sh status

Show the tab list to the user and "Which tab number should it run in?" confirm.

Tab numbers start from 0. Check in the status output. chrome:// tabs are excluded from the list. Only actual page tabs are shown.

[0] 페이지 제목
        https://example.com/...
[1] NAVER
        https://www.naver.com/

[번호]가 --tab NIs the same as N in.

Use the tab the user is logged into as-is. No environment (local/test/prod) distinction.

Step 3: Scenario list

cd e2e && ./e2e.sh list

Step 4: Execution

cd e2e && ./e2e.sh run --tab 0 1                       # 0번 탭, 1번 시나리오
cd e2e && ./e2e.sh run --tab 0 1-3                     # 1~3번 순차
cd e2e && ./e2e.sh run --tab 0 all                     # 전체
cd e2e && ./e2e.sh run 1                               # 탭 미지정 → 자동 탐지

--tab Nis converted to a URL after CDP lookup and passed to E2E_TAB_URL as an environment variable. lib/connect.jsIf no tab is specified, the first non-chrome page tab is automatically selected.

Beware of empty browser: Chrome Beta에 chrome:// If there is only a tab and no page tab, connect.js throws an error. In this case, you must first open a page tab:

agent-browser connect 9222
agent-browser tab new "https://www.google.com"

Or write the scenario so that it opens the tab directly.

Step 5: Result report + debugging

  • ✨ 완료! → Success report
  • ❌ 에러: → Quickly debug with agent-browser eval:
  • CDP error: Session with given id not found → Session disconnection recovery:
    agent-browser connect 9222
    agent-browser tab list
    agent-browser tab N       # 올바른 탭 번호
    agent-browser eval "document.title"  # 복구 확인 후 재실행
    
# CDP 연결 (1회)
agent-browser connect 9222

# 현재 URL 확인
agent-browser eval "location.href"

# 셀렉터 존재 여부
agent-browser eval "document.querySelector('.target') !== null"

# 버튼 목록
agent-browser eval "JSON.stringify(Array.from(document.querySelectorAll('button')).map(function(b){return b.innerText}))"

# 요소 개수
agent-browser eval "document.querySelectorAll('tr').length"

Debugging inside an iframe is not possible with agent-browser → playwright-cli fallback:

./e2e/pwc.sh eval "document.querySelector('iframe[src*=target]').contentDocument.querySelector('#element').innerText"

native dialog scenario rules

  • For scenarios with native dialogs, use the local recorder pattern . Global page.on('dialog', dialog.accept()) Do not install by default.
  • window.alert/confirm override 시 finallymust be reverted in.
  • page.on('dialog', handler) If needed, install only before/after specific steps → page.off('dialog', handler) disable.
  • process.exit(0) Do not use fixed termination → try/catch/finally + exitCode use pattern.
  • Page-state-dependent logic must explicitly wait before clicking (e.g., window.json_data.pay_method === 'point' check, then click the payment button).

Details: peach-e2e-browse/references/native-dialog-주의사항.md reference

External service switching

Entering external sites (Google, Gmail, etc.) uses the load + 2초 지연 + 직접 이동 fallback pattern. Details: peach-e2e-browse/references/외부서비스-링크전환-패턴.md reference

Tab selection rules

  • Normal execution: --tab N (for fast execution)
  • Debugging/reproduction/incident analysis: E2E_TAB_ID preferred (prevents index drift)
# targetId 조회
curl -s http://127.0.0.1:9222/json | jq -r '.[] | select(.type=="page" and (.url|startswith("chrome")|not)) | [.id,.title,.url] | @tsv'

# targetId로 실행
cd e2e && E2E_TAB_ID=<targetId> ./e2e.sh run '시나리오/대상.js'

Details: peach-e2e-browse/references/탭-선택-패턴.md reference