Skip to content

Commit

Permalink
Add updatePantherChromeDriver.sh to have corresponding chrome driver …
Browse files Browse the repository at this point in the history
…in travis ci available
  • Loading branch information
robertfausk committed Sep 21, 2020
1 parent 630ccba commit f4057bb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ cache:

install:
- '.scenarios.lock/install "${SCENARIO}" "${DEPENDENCIES}"'
- bin/updatePantherChromeDriver.sh

script:
- vendor/bin/phpunit -v --coverage-clover=coverage.clover
Expand Down
38 changes: 38 additions & 0 deletions bin/updatePantherChromeDriver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# ensure that symfony/panther's chromeDriver matches installed chromium version
# this needs chromium and symfony/panther (in vendor folder) to be installed

cd vendor/symfony/panther/chromedriver-bin

chromiumVersion=$(chromium --product-version 2>&1;);
googleChromeVersion=$(google-chrome --product-version 2>&1;);
if [[ ${chromiumVersion} == *"."*"."* ]]; then
chromiumVersion="$( cut -d '.' -f 1 <<< "$chromiumVersion" )";
echo "Found chromiumVersion ${chromiumVersion}";
chromeDriverVersion="_${chromiumVersion}"
elif [[ ${googleChromeVersion} == *"."*"."* ]]; then
googleChromeVersion="$( cut -d '.' -f 1 <<< "$googleChromeVersion" )";
echo "Found googleChromeVersion ${googleChromeVersion}";
chromeDriverVersion="_${googleChromeVersion}"
else
"No google-chrome or chromium found. Using latest release..."
chromeDriverVersion=""
fi

chromeDriver=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE${chromeDriverVersion});
echo "Downloading ChromeDriver version ${chromeDriver} from https://chromedriver.storage.googleapis.com/LATEST_RELEASE${chromeDriverVersion} ..."

declare -a binaries=("chromedriver_linux64" "chromedriver_mac64" "chromedriver_win32")
for name in "${binaries[@]}"
do
curl -s https://chromedriver.storage.googleapis.com/${chromeDriver}/${name}.zip -O
unzip -q -o ${name}.zip
rm ${name}.zip
if [[ -f "chromedriver" ]]; then
mv chromedriver ${name}
fi
done

curl -s https://chromedriver.storage.googleapis.com/${chromeDriver}/notes.txt -O
echo "Done."

0 comments on commit f4057bb

Please sign in to comment.