Install
yarn install chrome driver geckodriver selenium-side-runner selenium-webdriver
When faced jest envrioment error.
"jest": { "setupFiles": [ "./test/jestsetup.js" ], // "snapshotSerializers": [ // "enzyme-to-json/serializer" // ], "testEnvironment": "jest-environment-selenium", "setupTestFrameworkScriptFile": "jest-environment-selenium/dist/setup.js" },
Install in AWS EC2-user
Installing ChromeDriver
Change directory to a temp folder.
Get ChromeDriver using wget
Unzip ChromeDriver
Move ChromeDriver to the bin applications folder.
# move to /tmp cd/tmp/ # download chrome driver sudo wget https://chromedriver.storage.googleapis.com/83.0.4103.39/chromedriver_linux64.zip unzip chromedriver_linux64.zip sudo mv chromedriver /usr/bin/chromedriver # check version chromedriver --version
Install google chrome
move to temp
install using wget
# move to /tmp cd/tmp/ # download google chrome curl https://intoli.com/install-google-chrome.sh | bash sudo mv /usr/bin/google-chrome-stable /usr/bin/google-chrome # check version google-chrome --version && which google-chrome
The configuration
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