Skip to content

Commit 89208a9

Browse files
author
Krzysztof Wojnar
committed
chore(e2e): review comments applied
1 parent 681b135 commit 89208a9

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

scripts/e2e/detox-utils.cjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ const apkBulidArchitecture = isRunningCI ? 'x86_64' : 'arm64-v8a';
1212
const testButlerApkPath = isRunningCI ? ['../Example/e2e/apps/test-butler-app-2.2.1.apk'] : undefined;
1313

1414
function detectLocalAndroidEmulator() {
15-
// "DETOX_ADB_NAME" can be set for local developement
16-
const detoxAdbName = process.env.DETOX_ADB_NAME ?? null;
17-
if (detoxAdbName !== null) {
18-
return detoxAdbName
15+
// "DETOX_AVD_NAME" can be set for local developement
16+
const detoxAvdName = process.env.DETOX_AVD_NAME ?? null;
17+
if (detoxAvdName !== null) {
18+
return detoxAvdName
1919
}
2020

2121
// Fallback: try to use Android SDK
@@ -37,14 +37,14 @@ function detectLocalAndroidEmulator() {
3737
// TODO: consider giving user a choice here.
3838
return avdList[0];
3939
} catch (error) {
40-
const errorMessage = `Failed to find Android emulator. Set "DETOX_ADB_NAME" env variable pointing to one. Cause: ${error}`
40+
const errorMessage = `Failed to find Android emulator. Set "DETOX_AVD_NAME" env variable pointing to one. Cause: ${error}`
4141
console.error(errorMessage);
4242
throw new Error(errorMessage);
4343
}
4444
}
4545

4646
function detectAndroidEmulatorName() {
47-
return isRunningCI ? CI_ADB_NAME : detectLocalAndroidEmulator();
47+
return isRunningCI ? CI_ADB_NAME : detectLocalAndroidEmulator(); // ??
4848
}
4949

5050
/**

scripts/e2e/ios-devices.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
const DEFAULT_APPLE_MODEL = 'iPhone 17';
2-
const DEVICE_MODEL = process.env.E2E_APPLE_DEVICE || DEFEAULT_APPLE_MODEL
1+
const DEFAULT_APPLE_DEVICE = 'iPhone 17';
32
const DEFEAULT_IOS_VERSION = 'iOS 26.2';
43

4+
/**
5+
* @return {string}
6+
*/
7+
function getAppleDevice() {
8+
return process.env.E2E_APPLE_DEVICE || DEFAULT_APPLE_DEVICE;
9+
}
510
/**
611
* @return {`iOS ${string}`} requested version of ios, or default if not specified
712
*/
813
function getIOSVersion() {
9-
const passedVersion = process.env.E2E_IOS_VERSION;
10-
if (passedVersion) {
11-
if (passedVersion.startsWith('iOS ')) {
12-
return /** @type {`iOS ${string}`} */ (passedVersion);
13-
}
14-
return `iOS ${passedVersion}`;
14+
const passedVersion = process.env.E2E_IOS_VERSION;
15+
if (passedVersion) {
16+
if (passedVersion.startsWith('iOS ')) {
17+
return /** @type {`iOS ${string}`} */ (passedVersion);
1518
}
16-
return DEFEAULT_IOS_VERSION;
19+
return `iOS ${passedVersion}`;
20+
}
21+
return DEFEAULT_IOS_VERSION;
1722
}
1823

1924
/**
@@ -22,16 +27,15 @@ function getIOSVersion() {
2227
* @property {`iOS ${string}`} os - operation system version
2328
*/
2429

25-
/**
30+
/**
2631
* @satisfies {AppleDevice}
2732
* @readonly
2833
* */
2934
const iosDevice = {
30-
type: DEVICE_MODEL,
31-
os: getiosVersion(),
35+
type: getAppleDevice(),
36+
os: getIOSVersion(),
3237
};
3338

3439
module.exports = {
3540
iosDevice,
36-
getiosVersion,
3741
};

0 commit comments

Comments
 (0)