diff --git a/.gitignore b/.gitignore index 8871c6170..428641642 100644 --- a/.gitignore +++ b/.gitignore @@ -95,6 +95,7 @@ coverage mattermost-license.txt *.mattermost-license detox/artifacts +detox/detox_pixel_4_xl_api_30 # Bundle artifact *.jsbundle diff --git a/detox/.detoxrc.json b/detox/.detoxrc.json index 0c801f679..ba72e036c 100644 --- a/detox/.detoxrc.json +++ b/detox/.detoxrc.json @@ -22,7 +22,7 @@ "binaryPath": "../android/app/build/outputs/apk/debug/app-debug.apk", "build": "cd .. && ./node_modules/.bin/jetify && cd android && ./gradlew clean assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ../detox", "device": { - "avdName": "detox_emu_api_30" + "avdName": "detox_pixel_4_xl_api_30" } }, "android.emu.release": { @@ -30,7 +30,7 @@ "binaryPath": "../android/app/build/outputs/apk/release/app-release.apk", "build": "cd .. && ./node_modules/.bin/jetify && cd android && ./gradlew clean assembleRelease assembleAndroidTest -DtestBuildType=release && cd ../detox", "device": { - "avdName": "detox_emu_api_30" + "avdName": "detox_pixel_4_xl_api_30" } } }, diff --git a/detox/android_emulator/config.ini b/detox/android_emulator/config.ini new file mode 100644 index 000000000..bd7703f6f --- /dev/null +++ b/detox/android_emulator/config.ini @@ -0,0 +1,49 @@ +AvdId = Detox_Pixel_4_XL_API_30 +PlayStore.enabled = false +abi.type = x86 +avd.ini.displayname = Detox Pixel 4 XL API 30 +avd.ini.encoding = UTF-8 +disk.dataPartition.size = 6g +fastboot.chosenSnapshotFile = +fastboot.forceChosenSnapshotBoot = no +fastboot.forceColdBoot = no +fastboot.forceFastBoot = yes +hw.accelerometer = no +hw.arc = false +hw.gyroscope = no +hw.audioInput = no +hw.audioOutput = no +hw.battery = yes +hw.camera.back = virtualscene +hw.camera.front = emulated +hw.cpu.arch = x86 +hw.cpu.ncore = 4 +hw.dPad = no +hw.device.hash2 = MD5:80326cf5b53c08af25d4243cb231faa9 +hw.device.manufacturer = Google +hw.device.name = pixel_4_xl +hw.gps = no +hw.gpu.enabled = yes +hw.gpu.mode = auto +hw.initialOrientation = Portrait +hw.keyboard = yes +hw.lcd.density = 560 +hw.lcd.height = 3040 +hw.lcd.width = 1440 +hw.mainKeys = no +hw.ramSize = 2048 +hw.sdCard = no +hw.sensors.orientation = yes +hw.sensors.proximity = yes +hw.trackBall = no +image.sysdir.1 = system-images/android-30/google_apis/x86/ +runtime.network.latency = none +runtime.network.speed = full +sdcard.size = 0 +showDeviceFrame = yes +skin.dynamic = yes +skin.name = pixel_4_xl +skin.path = /change_to_absolute_path/pixel_4_xl_skin +tag.display = Google APIs +tag.id = google_apis +vm.heapSize = 576 diff --git a/detox/android_emulator/pixel_4_xl_skin/back.webp b/detox/android_emulator/pixel_4_xl_skin/back.webp new file mode 100644 index 000000000..0c50d7a89 Binary files /dev/null and b/detox/android_emulator/pixel_4_xl_skin/back.webp differ diff --git a/detox/android_emulator/pixel_4_xl_skin/layout b/detox/android_emulator/pixel_4_xl_skin/layout new file mode 100644 index 000000000..6268acea8 --- /dev/null +++ b/detox/android_emulator/pixel_4_xl_skin/layout @@ -0,0 +1,36 @@ +parts { + device { + display { + width 1440 + height 3040 + x 0 + y 0 + } + } + portrait { + background { + image back.webp + } + foreground { + mask mask.webp + cutout emu01 + } + } +} +layouts { + portrait { + width 1571 + height 3332 + event EV_SW:0:1 + part1 { + name portrait + x 0 + y 0 + } + part2 { + name device + x 61 + y 195 + } + } +} diff --git a/detox/android_emulator/pixel_4_xl_skin/mask.webp b/detox/android_emulator/pixel_4_xl_skin/mask.webp new file mode 100644 index 000000000..06d58c8d2 Binary files /dev/null and b/detox/android_emulator/pixel_4_xl_skin/mask.webp differ diff --git a/detox/android_emulator/quickbootChoice.ini b/detox/android_emulator/quickbootChoice.ini new file mode 100644 index 000000000..636f7b116 --- /dev/null +++ b/detox/android_emulator/quickbootChoice.ini @@ -0,0 +1 @@ +saveOnExit = true diff --git a/detox/create_android_emulator.sh b/detox/create_android_emulator.sh new file mode 100755 index 000000000..1bd6c909e --- /dev/null +++ b/detox/create_android_emulator.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -ex +set -o pipefail + +NAME=detox_pixel_4_xl_api_30 + +if emulator -list-avds | grep -q $NAME; then + echo "'${NAME}' Android virtual device already exists." +else + # Create virtual device in a relative "detox_pixel_4_xl_api_30" folder + avdmanager create avd -n $NAME -k 'system-images;android-30;google_apis;x86' -g google_apis -p $NAME -d 'pixel' + + # Copy predefined config and skin + cp -r android_emulator/ $NAME/ + sed -i -e "s|skin.path = /change_to_absolute_path/pixel_4_xl_skin|skin.path = $(pwd)/${NAME}/pixel_4_xl_skin|g" $NAME/config.ini + + echo "Android virtual device successfully created: ${NAME}" +fi diff --git a/detox/package.json b/detox/package.json index 48d38455c..5e2caddb8 100644 --- a/detox/package.json +++ b/detox/package.json @@ -24,7 +24,7 @@ "uuid": "8.3.2" }, "scripts": { - "e2e:android-create-emulator": "avdmanager create avd -n detox_emu_api_30 -k 'system-images;android-30;google_apis;x86' -g google_apis -d 'pixel'", + "e2e:android-create-emulator": "./create_android_emulator.sh", "e2e:android-build": "detox build -c android.emu.debug", "e2e:android-test": "detox test -c android.emu.debug", "e2e:android-build-release": "detox build -c android.emu.release",