`cypress run` 명령어 옵션 정리
Cypress로테스트를 진행하는 cypress run
명령어의 옵션에 대해 정리하겠습니다.
--help, -h
cypress run --help
cypress run -h
명령어 정보를 출력합니다.
--browser, -b
cypress run --browser /usr/bin/chromium
cypress run -b /usr/bin/chromium
테스트를 진행할 브라우저를 지정합니다. 브라우저 이름이나 경로를 입력합니다. 브라우저 이름을 입력했을 경우에는 chrome
, chromium
, edge
, electron
, firefox
를 인식하며 Cypress가 시스템에서 찾아 테스트를 진행합니다. 경로의 경우에는 해당 경로의 브라우저를 실행하여 진행합니다.
--config, -c
cypress run --config pageLoadTimeout=100000,watchForFileChanges=false
cypress run -c pageLoadTimeout=100000,watchForFileChanges=false
테스트의 설정 값을 지정합니다. Key-Value 형태로, 다수의 항목의 경우에는 ,를 사용합니다.
--config-file, -C
cypress run --config-file ./cypress/config.json
cypress run -C ./cypress/config.json
cypress run -C false
파일 형태로 저장된 설정 파일을 지정합니다. 매번 값을 입력해야 하는 cypress run 명령어보다 파일로 저장해 불러오는 방법입니다. 경로를 입력하거나 false값을 입력하여 설정을 사용하지 않도록 지정할 수 있습니다.
--env, -e
cypress run --env mode=development,port=4040
cypress run -e mode=development,port=4040
Cypress의 환경변수를 지정합니다. Key-Value 형태로, 다수의 항목의 경우에는 ,를 사용합니다.
그렇다면 config와 env의 차이는 무엇일까요? 이 부분에 대해서는 별로도 다루겠습니다.
--headless
cypress run --headless
Cypress에서 테스트를 진행할 때, 브라우저를 표시하지 않도록 지정합니다. 테스트 진행과정은 터미널에서만 볼 수 있습니다.
--headed
cypress run --headed
Cypress의 Electron에서 headless 테스트를 진행하도록 지정합니다.
--no-exit
cypress run --no-exit
Cypress의 Test Runner가 종료하지 않도록 지정합니다.
--spec, -s
cypress run --spec "./cypress/integration/example/actions.spec.js,./cypress/integration/example/misc.spec.js"
특정 파일을 지정하여 테스트합니다. , 로 여러 파일을 지정할 수 있습니다.
--quiet, -q
cypress run --quiet
cypress run -q
테스트 결과가 통과인 경우 결과를 표시하지 않도록 지정합니다.
--project, -P
cypress run --project ./packages/react
cypress run --P ./packages/react
작업을 진행할 프로젝트 경로를 지정합니다.
--port, -p
cypress run --port 8080
cypress run -p 8080
문서에는 별다른 설명이 있지 않습니다. 기본 포트를 정의합니다.
--reporter, -r
cypress run --reporter json
cypress run -r json
기본 지원 reporter는 teamcity, junit, json입니다.
--reporter-options, -o
cypress run --reporter junit --reporter-options mochaFile=result.xml,toConsole=true
cypress run -r junit --reporter-options mochaFile=result.xml,toConsole=true
--key, -k
cypress run --key develop-abc
이 옵션은 Cypress Dashboard service에 기록할 때 사용합니다.
These flags can only be used when recording to the Cypress Dashboard service.
기록할 프로젝트(Dashboard) 키를 지정합니다. CYPRESS_RECORD_KEY를 지정했다면 생략할 수 있습니다.
--record
export CYPRESS_RECORD_KEY=develop-abc
cypress run --record
이 옵션은 Cypress Dashboard service에 기록할 때 사용합니다.
These flags can only be used when recording to the Cypress Dashboard service.
Cypress Dashboard에 기록합니다. CYPRESS_RECORD_KEY 값을 Dashboard에서 받아 지정하여 사용합니다. (사용방법) 만약 해제하고 싶다면, cypress run --record false 하면 됩니다.
--group
cypress run --group develop-env
이 옵션은 Cypress Dashboard service에 기록할 때 사용합니다.
These flags can only be used when recording to the Cypress Dashboard service.
--recode 옵션과 함께 사용하여 Dashboard에 테스트를 그룹화시킵니다.
--parallel
cypress run --parallel
이 옵션은 Cypress Dashboard service에 기록할 때 사용합니다.
These flags can only be used when recording to the Cypress Dashboard service.
병렬로 테스트를 진행합니다.
--ci-build-id
cypress run --ci-build-id BUILD_NUMBER
이 옵션은 Cypress Dashboard service에 기록할 때 사용합니다.
These flags can only be used when recording to the Cypress Dashboard service.
--tag, -t
cypress run --tag "develop"
cypress run -t "develop"
이 옵션은 Cypress Dashboard service에 기록할 때 사용합니다.
These flags can only be used when recording to the Cypress Dashboard service.
테스트 결과물에 태그를 추가합니다.
출처 : Cypress-Command-line
'해본 것 > Cypress' 카테고리의 다른 글
Cypress로 React Unit Test 회고 (0) | 2020.07.30 |
---|---|
Cypress 명령어 (0) | 2020.07.27 |
`cypress cache` 명령어 옵션 정리 (0) | 2020.07.27 |
Cypress 설치 (0) | 2020.07.26 |