Skip to content

Commit

Permalink
[RNMobile] Address Android E2E tests failure by setting fixed version…
Browse files Browse the repository at this point in the history
…s of Appium drivers (#58408)

* Detect and install required versions of Appium drivers

* Enable Android E2E tests
  • Loading branch information
fluiddot authored Jan 30, 2024
1 parent 90e9bc9 commit 8345d2b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ concurrency:
jobs:
test:
runs-on: macos-12
# Disable for now until we fix failures in the job.
if: false
# if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
matrix:
native-test-name: [gutenberg-editor-rendering]
Expand Down
36 changes: 28 additions & 8 deletions packages/react-native-editor/bin/test-e2e-setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash -e

# =================================================================
# Appium Drivers
#
# NOTE: Please update the following versions when upgrading Appium.
# =================================================================
UI_AUTOMATOR_2_VERSION="2.32.3"
XCUITEST_VERSION="5.7.0"

set -o pipefail

if command -v appium >/dev/null 2>&1; then
Expand All @@ -23,18 +31,30 @@ function log_error() {

output=$($APPIUM_CMD driver list --installed --json)

if echo "$output" | grep -q 'uiautomator2'; then
log_info "UiAutomator2 available."
# UiAutomator2 driver installation
matched_version=$(echo "$output" | jq -r '.uiautomator2.version // empty')
if [ -z "$matched_version" ]; then
log_info "UiAutomator2 not installed, installing version $UI_AUTOMATOR_2_VERSION..."
$APPIUM_CMD driver install "uiautomator2@$UI_AUTOMATOR_2_VERSION"
elif [ "$matched_version" = "$UI_AUTOMATOR_2_VERSION" ]; then
log_info "UiAutomator2 version $UI_AUTOMATOR_2_VERSION is available."
else
log_info "UiAutomator2 not found, installing..."
$APPIUM_CMD driver install uiautomator2
log_info "UiAutomator2 version $matched_version is installed, replacing it with version $UI_AUTOMATOR_2_VERSION..."
$APPIUM_CMD driver uninstall uiautomator2
$APPIUM_CMD driver install "uiautomator2@$UI_AUTOMATOR_2_VERSION"
fi

if echo "$output" | grep -q 'xcuitest'; then
log_info "XCUITest available."
# XCUITest driver installation
matched_version=$(echo "$output" | jq -r '.xcuitest.version // empty')
if [ -z "$matched_version" ]; then
log_info "XCUITest not installed, installing version $XCUITEST_VERSION..."
$APPIUM_CMD driver install "xcuitest@$XCUITEST_VERSION"
elif [ "$matched_version" = "$XCUITEST_VERSION" ]; then
log_info "XCUITest version $XCUITEST_VERSION is available."
else
log_info "XCUITest not found, installing..."
$APPIUM_CMD driver install xcuitest
log_info "XCUITest version $matched_version is installed, replacing it with version $XCUITEST_VERSION..."
$APPIUM_CMD driver uninstall xcuitest
$APPIUM_CMD driver install "xcuitest@$XCUITEST_VERSION"
fi

CONFIG_FILE="$(pwd)/__device-tests__/helpers/device-config.json"
Expand Down

0 comments on commit 8345d2b

Please sign in to comment.