Skip to content

Commit

Permalink
Download chromium before running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacov authored and openshift-merge-robot committed Aug 12, 2019
1 parent 3514b4e commit 1a6391b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/Godeps/_workspace/src/github.com/openshift/console
/frontend/.cache-loader
/frontend/__coverage__
/frontend/__chrome_browser__
/frontend/**/node_modules
/frontend/public/bower_components
/frontend/public/dist
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ yarn run test-gui-openshift
This will include the normal k8s CRUD tests and CRUD tests for OpenShift
resources.

#### Using specific version of Chrome browser

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 instlled by the system, it is also posible 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 enviroment variables.
Downloading chrome requires `curl`, `unzip` and `sha256sum` command line utilities installed.

```
# # For Chrome Version 76.0.3809.0 (Developer Build) (64-bit)
$ export FORCE_CHRMOE_BRANCH_BASE="665006"
$ export FORCE_CHRMOE_BRANCH_SHA256SUM="a1ae2e0950828f991119825f62c24464ab3765aa219d150a94fb782a4c66a744"
$ ./test-gui.sh e2e
```

#### 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
32 changes: 32 additions & 0 deletions test-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@
set -exuo pipefail

cd frontend

if [ -v FORCE_CHRMOE_BRANCH_BASE ];
then
BRANCH_BASE=${FORCE_CHRMOE_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_CHRMOE_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

Expand Down
5 changes: 5 additions & 0 deletions test-prow-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ export BRIDGE_BASE_ADDRESS="$(oc get consoles.config.openshift.io cluster -o jso
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

# Chrome Version 76.0.3809.0 (Developer Build) (64-bit)
# get the branch base position for a specific chrmoe version using https://omahaproxy.appspot.com/
export FORCE_CHRMOE_BRANCH_BASE="665006"
export FORCE_CHRMOE_BRANCH_SHA256SUM="a1ae2e0950828f991119825f62c24464ab3765aa219d150a94fb782a4c66a744"

./test-gui.sh ${1:-e2e}

0 comments on commit 1a6391b

Please sign in to comment.