Skip to content

Commit

Permalink
tests: use Chrome version from builder image
Browse files Browse the repository at this point in the history
* We now have a way to version the builder image per branch, so updating
  the builder image in master won't break older release-* branches.
* The versions downloaded from omahaproxy are prerelease versions. We
  should be testing against stable Chrome.
* For local development, we can always override the ChromeDriver version:
  yarn webdriver-update --versions.chrome="$CHROME_VERSION"
* We have scripts `webdriver-update-fedora` and `webdriver-update-macos`
  to make this easy on Fedora and macOS.
  • Loading branch information
spadgett committed May 14, 2020
1 parent 21a1261 commit 7f6a882
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 65 deletions.
25 changes: 4 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,32 +210,15 @@ If you your local Chrome version doesn't match the Chromedriver version from the
```
yarn run webdriver-update --versions.chrome=77.0.3865.120
```
Or if you are using macOS (OS X), run:
For Fedora, you can use:
```
# automatically select the correct Chrome version
yarn run webdriver-update-macos
yarn run webdriver-update-fedora
```


You can look up the version number you need at [omahaProxy.appspot.com](https://omahaproxy.appspot.com/).

#### Using specific version of Chrome browser (Linux only)

Integration tests are run in a headless Chrome driven by a [ChromeDriver](https://chromedriver.chromium.org/downloads). Each ChromeDriver supports specific Chrome versions.

By default test use the Chrome browser installed by the system. On Linux systems, it is possible to [download](https://www.chromium.org/getting-involved/download-chromium)
a specific version of Chrome browser by setting a [branch position](https://omahaproxy.appspot.com/) and sha256sum (of zip package) using environment variables.
Downloading chrome requires `curl`, `unzip`, and `sha256sum` command line utilities installed.

For macOS, you can use:
```
# # For Chrome Version 76.0.3809.0 (Developer Build) (64-bit)
$ export FORCE_CHROME_BRANCH_BASE="665006"
$ export FORCE_CHROME_BRANCH_SHA256SUM="a1ae2e0950828f991119825f62c24464ab3765aa219d150a94fb782a4c66a744"
$ ./test-gui.sh e2e
yarn run webdriver-update-macos
```

Chromium version to be used by CI jobs is defined in [chromium-version.sh](chromium-version.sh) script.

#### How the Integration Tests Run in CI

The end-to-end tests run against pull requests using [ci-operator](https://github.com/openshift/ci-operator/).
Expand Down
6 changes: 0 additions & 6 deletions chromium-version.sh

This file was deleted.

40 changes: 6 additions & 34 deletions test-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,14 @@ set -exuo pipefail

cd frontend

if [ -v FORCE_CHROME_BRANCH_BASE ];
then
BRANCH_BASE=${FORCE_CHROME_BRANCH_BASE}
export CHROME_BINARY_PATH="${PWD}/__chrome_browser__/${BRANCH_BASE}/chrome-linux/chrome"

# look for chrome binary
if [ -x "${CHROME_BINARY_PATH}" ];
then
echo "chrmoe binary for branch ${BRANCH_BASE} already exists"
else
CHROME_DIR="${PWD}/__chrome_browser__"
CHROME_DOWNLOAD_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots"

# download
mkdir -p "${CHROME_DIR}/${BRANCH_BASE}"
curl -G "${CHROME_DOWNLOAD_URL}/o/Linux_x64%2F${BRANCH_BASE}%2Fchrome-linux.zip" \
-d "alt=media" \
> "${CHROME_DIR}/chrome-linux-${BRANCH_BASE}.zip"
unzip "${CHROME_DIR}/chrome-linux-${BRANCH_BASE}.zip" -d "${CHROME_DIR}/${BRANCH_BASE}"

# check sha256sum
if [ "$(sha256sum "${CHROME_DIR}/chrome-linux-${BRANCH_BASE}.zip" | cut -f 1 -d ' ')" != "${FORCE_CHROME_BRANCH_SHA256SUM}" ];
then
rm -rf "${CHROME_DIR:?}/${BRANCH_BASE}"

echo "ERROR: chrmoe binary sha256 missmatch"
exit 1
fi
fi
fi

yarn install
yarn run webdriver-update
if [ -z "${CHROME_VERSION-}" ]; then
yarn run webdriver-update
else
yarn run webdriver-update --versions.chrome="$CHROME_VERSION"
fi

if [ $# -gt 0 ] && [ -n "$1" ];
then
if [ $# -gt 0 ] && [ -n "$1" ]; then
yarn run test-suite --suite "$1" --params.openshift true
else
yarn run test-gui --params.openshift true
Expand Down
5 changes: 1 addition & 4 deletions test-prow-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,4 @@ export BRIDGE_BASE_ADDRESS
oc apply -f ./frontend/integration-tests/data/htpasswd-secret.yaml
oc patch oauths cluster --patch "$(cat ./frontend/integration-tests/data/patch-htpasswd.yaml)" --type=merge

# get the branch base position for a specific chromium version using https://omahaproxy.appspot.com/
source ./chromium-version.sh

./test-gui.sh "${1:-e2e}"
CHROME_VERSION=$(google-chrome --version) ./test-gui.sh "${1:-e2e}"

0 comments on commit 7f6a882

Please sign in to comment.