Selenium 설치
UI 프로젝트에 selenium node 모듈 추가
yarn install chrome driver geckodriver selenium-side-runner selenium-webdriver
ChromeDriver 설치
Change directory to a temp folder.
cd /tmp/
Get ChromeDriver using wget
sudo wget https://chromedriver.storage.googleapis.com/89.0.4389.23/chromedriver_linux64.zip
Unzip ChromeDriver
unzip chromedriver_linux64.zip
Move ChromeDriver to the bin applications folder.
sudo mv chromedriver /usr/bin/chromedriver
설치 확인
chromedriver --version
google chrome 설치
go to temp
cd /tmp/
Install using curl
curl https://intoli.com/install-google-chrome.sh | bash
sudo mv /usr/bin/google-chrome-stable /usr/bin/google-chrome
설치 확인
google-chrome --version && which google-chrome
Jest 에러 발생시 설정 추가
"jest": { "setupFiles": [ "./test/jestsetup.js" ], // "snapshotSerializers": [ // "enzyme-to-json/serializer" // ], "testEnvironment": "jest-environment-selenium", "setupTestFrameworkScriptFile": "jest-environment-selenium/dist/setup.js" },
Selenium 설정
has been configured Chrome for Linux, Firefox for UI tester.
pacakge.json
Attach script on pacakge.json
"scripts": { "test-chrome:dev": "selenium-side-runner --debug --timeout 30000 --config-file selenium/config/chrome-dev.yml selenium/*.side", "test-chrome:stg": "selenium-side-runner --debug --timeout 30000 --config-file selenium/config/chrome-stg.yml selenium/*.side", "test-firefox:dev": "selenium-side-runner --debug --timeout 30000 --config-file selenium/config/firefox-dev.yml selenium/*.side", "test-firefox:stg": "selenium-side-runner --debug --timeout 30000 --config-file selenium/config/firefox-stg.yml selenium/*.side" }
Set yml
create folder selenium/config
make chrome-dev.yml, chrome-stg.yml
make firefox-dev.yml, firefox-stg.yml
# chrome-dev.yml capabilities: browserName: "chrome" goog:chromeOptions: args: - headless - no-sandbox - disable-infobars - disable-gpu - disable-dev-shm-usage baseUrl: "http://dev-builder.justten.io"
# firefox-dev.yml capabilities: browserName: "firefox" baseUrl: "http://dev-builder.justten.io/"
Run
move inside project
run cli
yarn run test-chrome:dev