셀레니움을 통한 웹 테스트 준비 스크립트
드라이버 가져오기
ChromeDriver
get_chromedriver.sh
#!/bin/bashos_name=`uname`chromedriver_dir="chromedriver"if [ ! -d $chromedriver_dir ]; thenmkdir $chromedriver_dirfiecho "downloading chromedriver"if [[ $os_name == 'Linux' && ! -f $chromedriver_dir/chromedriver ]]; thencd chromedriver && curl -L https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip > tmp.zip && unzip -o tmp.zip && rm tmp.zip# wait until download finishsleep 5elif [[ $os_name == 'Darwin' && ! -f $chromedriver_dir/chromedriver ]]; thencd chromedriver && curl -L https://chromedriver.storage.googleapis.com/2.29/chromedriver_mac64.zip | tar xzsleep 5fi
GeckoDriver
get_geckdriver.sh
#!/bin/bashos_name=`uname`if [ -f geckodriver ]; thenexit 0fiecho "downloading gechdriver"if [[ $os_name == 'Linux' ]]; thencd ../ && curl -L https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-linux64.tar.gz | tar xzsleep 5elif [[ $os_name == 'Darwin' ]]; thencd ../ && curl -L https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-macos.tar.gz | tar xzsleep 5fi
Selenium
Selenium 가져오기
get_selenium.sh
#!/bin/bash#check if selenium server is up runningpid=`lsof -ti tcp:4444`if [ $? -eq 0 ]thenkill -9 $pidfijava -jar -Dwebdriver.gecko.driver=../geckodriver -Dwebdriver.chrome.driver="chromedriver/chromedriver" ../webdriverio-test/selenium-server-standalone-3.0.1.jar &
환경설정
Linux
setup_linux_env.sh
#!/bin/bashif [ "${TRAVIS_OS_NAME}" == "linux" ]thenexport CHROME_BIN="/usr/bin/google-chrome"export DISPLAY=:99.0sh -e /etc/init.d/xvfb start &fi
OSX
setup_osx_env.sh
#!/bin/bashif [ "${TRAVIS_OS_NAME}" == "osx" ]thenbrew cask install google-chromesudo Xvfb :99 -ac -screen 0 1024x768x8 &export CHROME_BIN="/Applications/Google Chrome.app"fi
테스트환경 검사
test_setup.sh
#!/bin/bashEXIT_STATUS=0function check_command {"$@"local STATUS=$?if [ $STATUS -ne 0 ]; thenecho "error with $1 ($STATUS)" >&2EXIT_STATUS=$STATUSfi}check_command tests/scripts/get_geckdriver.shsleep 5check_command tests/scripts/get_selenium.shsleep 5check_command tests/scripts/get_chromedriver.shsleep 10check_command tests/scripts/selenium_connect.shsleep 10exit $EXIT_STATUS
'Ep 01. B급 개발' 카테고리의 다른 글
HTML TO PDF with phantomjs (0) | 2018.05.13 |
---|---|
Javascript XPath를 이용해서 Dom Element 가져오기 (0) | 2018.05.13 |
Spring-boot RestAPI 와 Spring Security OAuth2 연동(spring-boot 1.5.10 기준) (0) | 2018.05.13 |
Technical writing에 관하여_1 (0) | 2018.03.07 |