Fairy ' s

[QA] PlayWright Study #1 본문

QA

[QA] PlayWright Study #1

berafairy 2025. 2. 3. 21:00

 

Playwright 기본 요구 사항

  • Node.js 18, 20, 22
  • Windows 10+, Windows Server 2016+ Windows Subset for Linux (WSL).
  • macOS 13 Ventura

PlayWright 기본 명령어

# Playwright Install
npm init playwright@latest

# Playwright Test
npx playwright test

# HTML Test Report
npx playwright show-report

# UI Mod
npx playwright test --ui

# Playwright Update
npx playwright install --with-deps

# Codegen
npx playwright codegen https://url

Codegen

Codegen 명령어 실행 후 테스트 할 브라우저가 생성되면, 테스트할 동작 진행 후 자동 작성된 코드를 복사한다.
복사한 코드로 .spec.js 파일을 생성하여 test 명령어를 실행하면 등록된 코드의 테스트가 자동으로 실행되며, 리포트가 저장된다.

test 명령어로 js 파일에 대한 테스트가 정상 처리 되지 않으면 확장자를 spec.js 혹은 test.js로 수정하고, 다음 명령어를 실행해본다. 아래 명령어 입력 시에 작성한 js 파일이 인식되지 않으면 몇 가지 확인과 수정이 필요하다.

npx playwright test --list


- playwright 테스트용인 경우엔 test 명령어로 실행이 가능하지만, 독립적인 스크립트의 경우 node 명령어로 실행 해야 한다.

 

 

Comments