Skip to content

Commit

Permalink
Bug fix testing env (#235)
Browse files Browse the repository at this point in the history
* Expand GitHub actions environment

* Bug fix the path to chromedriver

* Only install the chrome driver if google chrome is installed.

* Debug tests/build-test-env.sh installing Chrome
  • Loading branch information
asset-web authored Oct 24, 2023
1 parent 912ef43 commit 736a4de
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
28 changes: 15 additions & 13 deletions deploy/fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,21 @@ def make_virtualenv(env="dev", configure_apache=False, clone_repo=False, branch=

# Install local copy of the chromedriver
if env in ("dev", "test",):
with change_dir(venv_dir + "/bin"):
# Download the correct chrome driver version for the version of google chrome that is currently installed,
# ref: https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection#:~:text=Each%20version%20of%20ChromeDriver%20supports,3683.
google_chrome_version = caller('google-chrome --version').strip("Google Chrome ")
chrome_driver_version = google_chrome_version[:google_chrome_version.rindex(".")]
version = urllib2.urlopen('https://chromedriver.storage.googleapis.com/LATEST_RELEASE_'+chrome_driver_version).read()
caller('wget https://chromedriver.storage.googleapis.com/' + version + '/chromedriver_linux64.zip')
caller('ls -l')
caller('rm -f chromedriver')
caller('unzip -o chromedriver_linux64.zip')
caller('ls -l')
caller('rm chromedriver_linux64.zip*')
caller('ls -l')
with change_dir(venv_dir + "/bin"):
# Only install the chrome driver if google chrome is installed.
if caller('which google-chrome'):
# Download the correct chrome driver version for the version of google chrome that is currently installed,
# ref: https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection#:~:text=Each%20version%20of%20ChromeDriver%20supports,3683.
google_chrome_version = caller('google-chrome --version').strip("Google Chrome ")
chrome_driver_version = google_chrome_version[:google_chrome_version.rindex(".")]
version = urllib2.urlopen('https://chromedriver.storage.googleapis.com/LATEST_RELEASE_'+chrome_driver_version).read()
caller('wget https://chromedriver.storage.googleapis.com/' + version + '/chromedriver_linux64.zip')
caller('ls -l')
caller('rm -f chromedriver')
caller('unzip -o chromedriver_linux64.zip')
caller('ls -l')
caller('rm chromedriver_linux64.zip*')
caller('ls -l')


def deploy(env="dev", branch="master", using_apache=True, migrate_db=True, use_local_mode=False, use_pip_sync=False, requirements="requirements", project_dir=PROJECT_ROOT):
Expand Down
2 changes: 1 addition & 1 deletion tests/base_selenium_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setUpClass(cls):
cls.display = Display(visible=0, size=(1920, 1080))
cls.display.start()
# ref: https://github.com/SeleniumHQ/selenium/issues/12746
service = webdriver.ChromeService(executable_path="../../../bin/chromedriver")
service = webdriver.ChromeService(executable_path=settings.BASE_DIR + "/../../../bin/chromedriver")
cls.driver = webdriver.Chrome(service=service)
cls.driver.implicitly_wait(10)

Expand Down
8 changes: 6 additions & 2 deletions tests/build-test-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ sudo apt-get install -y python3-wheel-whl

echo "Set up alias for python3.8"
which python3
# which python3.8
# alias python3.8="python3"
which python3.8

# Install Chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt-get install -y ./google-chrome-stable_current_amd64.deb
which google-chrome
google-chrome --version

cd $GITHUB_WORKSPACE
cd lib/test/src/temmpo

Expand Down

0 comments on commit 736a4de

Please sign in to comment.