forked from Ivasoft/mattermost-mobile
fix(e2e): use AOSP Android emulator for Detox test (#7440)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
AvdId = Detox_Pixel_4_XL_API_31
|
||||
AvdId = change_avd_id
|
||||
PlayStore.enabled = false
|
||||
abi.type = x86_64
|
||||
avd.ini.displayname = Detox Pixel 4 XL API 31
|
||||
abi.type = change_type
|
||||
avd.ini.displayname = change_avd_displayname
|
||||
avd.ini.encoding = UTF-8
|
||||
disk.dataPartition.size = 6g
|
||||
fastboot.chosenSnapshotFile =
|
||||
@@ -16,7 +16,7 @@ hw.audioOutput = no
|
||||
hw.battery = yes
|
||||
hw.camera.back = virtualscene
|
||||
hw.camera.front = emulated
|
||||
hw.cpu.arch = x86_64
|
||||
hw.cpu.arch = change_cpu_arch
|
||||
hw.cpu.ncore = 4
|
||||
hw.dPad = no
|
||||
hw.device.hash2 = MD5:80326cf5b53c08af25d4243cb231faa9
|
||||
@@ -36,14 +36,14 @@ hw.sdCard = no
|
||||
hw.sensors.orientation = yes
|
||||
hw.sensors.proximity = yes
|
||||
hw.trackBall = no
|
||||
image.sysdir.1 = system-images/android-31/google_apis/x86_64/
|
||||
image.sysdir.1 = change_to_image_sysdir/
|
||||
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
|
||||
skin.path = change_to_absolute_path/pixel_4_xl_skin
|
||||
tag.display = Default Android System Image
|
||||
tag.id = default
|
||||
vm.heapSize = 576
|
||||
|
||||
@@ -1,19 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Reference: Download Android (AOSP) Emulators - https://github.com/wix/Detox/blob/master/docs/guide/android-dev-env.md#android-aosp-emulators
|
||||
# sdkmanager "system-images;android-31;default;arm64-v8a"
|
||||
# sdkmanager --licenses
|
||||
|
||||
set -ex
|
||||
set -o pipefail
|
||||
|
||||
NAME=detox_pixel_4_xl_api_31
|
||||
SDK_VERSION=31
|
||||
NAME="detox_pixel_4_xl_api_${SDK_VERSION}"
|
||||
|
||||
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_31" folder
|
||||
avdmanager create avd -n $NAME -k 'system-images;android-31;google_apis;x86_64' -g google_apis -p $NAME -d 'pixel'
|
||||
CPU_ARCH_FAMILY=''
|
||||
CPU_ARCH=''
|
||||
if [[ $(uname -p) == 'arm' ]]; then
|
||||
CPU_ARCH_FAMILY=arm64-v8a
|
||||
CPU_ARCH=arm64
|
||||
else
|
||||
CPU_ARCH_FAMILY=x86_64
|
||||
CPU_ARCH=x86_64
|
||||
fi
|
||||
|
||||
# Create virtual device in a relative "detox_pixel_4_xl_api_${SDK_VERSION}" folder
|
||||
avdmanager create avd -n $NAME -k "system-images;android-${SDK_VERSION};default;${CPU_ARCH_FAMILY}" -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
|
||||
sed -i -e "s|AvdId = change_avd_id|AvdId = ${NAME}|g" $NAME/config.ini
|
||||
sed -i -e "s|avd.ini.displayname = change_avd_displayname|avd.ini.displayname = Detox Pixel 4 XL API ${SDK_VERSION}|g" $NAME/config.ini
|
||||
sed -i -e "s|abi.type = change_type|abi.type = ${CPU_ARCH_FAMILY}|g" $NAME/config.ini
|
||||
sed -i -e "s|hw.cpu.arch = change_cpu_arch|hw.cpu.arch = ${CPU_ARCH}|g" $NAME/config.ini
|
||||
sed -i -e "s|image.sysdir.1 = change_to_image_sysdir/|image.sysdir.1 = system-images/android-${SDK_VERSION}/default/${CPU_ARCH_FAMILY}/|g" $NAME/config.ini
|
||||
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
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// - Use element testID when selecting an element. Create one if none.
|
||||
// *******************************************************************
|
||||
|
||||
import {Setup} from '@support/server_api';
|
||||
import {Setup, System} from '@support/server_api';
|
||||
import {
|
||||
serverOneUrl,
|
||||
siteOneUrl,
|
||||
@@ -24,9 +24,12 @@ import {expect} from 'detox';
|
||||
|
||||
describe('Account - Settings - About', () => {
|
||||
const serverOneDisplayName = 'Server 1';
|
||||
let isLicensed: boolean;
|
||||
let testUser: any;
|
||||
|
||||
beforeAll(async () => {
|
||||
const {license} = await System.apiGetClientLicense(siteOneUrl);
|
||||
isLicensed = license.IsLicensed === 'true';
|
||||
const {user} = await Setup.apiInit(siteOneUrl);
|
||||
testUser = user;
|
||||
|
||||
@@ -65,7 +68,11 @@ describe('Account - Settings - About', () => {
|
||||
await expect(AboutScreen.databaseValue).toBeVisible();
|
||||
await expect(AboutScreen.databaseSchemaVersionTitle).toHaveText('Database Schema Version:');
|
||||
await expect(AboutScreen.databaseSchemaVersionValue).toBeVisible();
|
||||
await expect(AboutScreen.licensee).toBeVisible();
|
||||
if (isLicensed) {
|
||||
await expect(AboutScreen.licensee).toBeVisible();
|
||||
} else {
|
||||
await expect(AboutScreen.licensee).not.toBeVisible();
|
||||
}
|
||||
await expect(AboutScreen.learnMoreText).toHaveText('Learn more about Enterprise Edition at ');
|
||||
await expect(AboutScreen.learnMoreUrl).toBeVisible();
|
||||
await expect(AboutScreen.copyright).toHaveText(`Copyright 2015-${new Date().getFullYear()} Mattermost, Inc. All rights reserved`);
|
||||
|
||||
Reference in New Issue
Block a user