diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /mobile/android/fenix/automation/taskcluster/androidTest/robo-test.sh | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/fenix/automation/taskcluster/androidTest/robo-test.sh')
-rwxr-xr-x | mobile/android/fenix/automation/taskcluster/androidTest/robo-test.sh | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/mobile/android/fenix/automation/taskcluster/androidTest/robo-test.sh b/mobile/android/fenix/automation/taskcluster/androidTest/robo-test.sh new file mode 100755 index 0000000000..c2b6ee76f9 --- /dev/null +++ b/mobile/android/fenix/automation/taskcluster/androidTest/robo-test.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# This script does the following: +# 1. Retrieves gcloud service account token +# 2. Activates gcloud service account +# 3. Connects to Google's Firebase Test Lab (using Flank) +# 4. Executes Robo test +# 5. Puts any artifacts into the test_artifacts folder + +# If a command fails then do not proceed and fail this script too. +set -e + +get_abs_filename() { + relative_filename="$1" + echo "$(cd "$(dirname "$relative_filename")" && pwd)/$(basename "$relative_filename")" +} + +# Basic parameter check +if [[ $# -lt 1 ]]; then + echo "Error: please provide a Flank configuration" + display_help + exit 1 +fi + +device_type="$1" # flank-arm-robo-test.yml | flank-x86-robo-test.yml +APK_APP="$2" +JAVA_BIN="/usr/bin/java" +PATH_TEST="./automation/taskcluster/androidTest" +FLANK_BIN="/builds/worker/test-tools/flank.jar" +ARTIFACT_DIR="/builds/worker/artifacts" +RESULTS_DIR="${ARTIFACT_DIR}/results" + +echo +echo "ACTIVATE SERVICE ACCT" +echo +gcloud config set project "$GOOGLE_PROJECT" +gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS" +echo +echo +echo + +set +e + +flank_template="${PATH_TEST}/flank-${device_type}.yml" +if [ -f "$flank_template" ]; then + echo "Using Flank template: $flank_template" +else + echo "Error: Flank template not found: $flank_template" + exit 1 +fi + +APK_APP="$(get_abs_filename $APK_APP)" + +function failure_check() { + echo + echo + if [[ $exitcode -ne 0 ]]; then + echo "FAILURE: Robo test run failed, please check above URL" + else + echo "Robo test was successful!" + fi + + echo + echo "RESULTS" + echo + + mkdir -p /builds/worker/artifacts/github + chmod +x $PATH_TEST/parse-ui-test.py + $PATH_TEST/parse-ui-test.py \ + --exit-code "${exitcode}" \ + --log flank.log \ + --results "${RESULTS_DIR}" \ + --output-md "${ARTIFACT_DIR}/github/customCheckRunText.md" \ + --device-type "${device_type}" +} + +echo +echo "FLANK VERSION" +echo +$JAVA_BIN -jar $FLANK_BIN --version +echo +echo + +echo +echo "EXECUTE ROBO TEST" +echo +set -o pipefail && $JAVA_BIN -jar $FLANK_BIN android run \ + --config=$flank_template \ + --app=$APK_APP \ + --local-result-dir="${RESULTS_DIR}" \ + --project=$GOOGLE_PROJECT \ + --client-details=commit=${MOBILE_HEAD_REV:-None},pullRequest=${PULL_REQUEST_NUMBER:-None} \ + | tee flank.log + +exitcode=$? +failure_check + +exit $exitcode |