Detox/E2E: Update android emulator using Pixel 4 XL (#5354)

* update android emulator using Pixel 4 XL for detox tests

* update per comment
This commit is contained in:
Saturnino Abril 2021-04-28 06:56:30 +08:00 committed by GitHub
parent e7d5f2c194
commit 6cf94d7be6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 109 additions and 3 deletions

1
.gitignore vendored
View file

@ -95,6 +95,7 @@ coverage
mattermost-license.txt
*.mattermost-license
detox/artifacts
detox/detox_pixel_4_xl_api_30
# Bundle artifact
*.jsbundle

View file

@ -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"
}
}
},

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

View file

@ -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
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1 @@
saveOnExit = true

View file

@ -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

View file

@ -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",