Skip to content

Commit f7403ca

Browse files
author
Krzysztof Wojnar
committed
chore(e2e): unified to RNS_E2E_AVD_NAME env var
1 parent d3d5c5b commit f7403ca

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

.github/workflows/android-e2e-test-fabric.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
disable-animations: false
8787
force-avd-creation: false
8888
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
89-
avd-name: e2e_emulator
89+
rns_e2e_avd_name: e2e_emulator
9090
arch: x86_64
9191
script: echo "Generated AVD snapshot for caching."
9292

@@ -102,7 +102,7 @@ jobs:
102102
disable-animations: false
103103
force-avd-creation: false
104104
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
105-
avd-name: e2e_emulator
105+
rns_e2e_avd_name: e2e_emulator
106106
arch: x86_64
107107
script: yarn test-e2e-android
108108

.github/workflows/android-e2e-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
disable-animations: false
8787
force-avd-creation: false
8888
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
89-
avd-name: e2e_emulator
89+
rns_e2e_avd_name: e2e_emulator
9090
arch: x86_64
9191
script: echo "Generated AVD snapshot for caching."
9292

@@ -102,7 +102,7 @@ jobs:
102102
disable-animations: false
103103
force-avd-creation: false
104104
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
105-
avd-name: e2e_emulator
105+
rns_e2e_avd_name: e2e_emulator
106106
arch: x86_64
107107
script: yarn test-e2e-android
108108

scripts/e2e/detox-utils.cjs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const ChildProcess = require('node:child_process');
22
const { iosDevice } = require('./ios-devices');
33

4-
const RNS_CI_AVD_NAME = 'e2e_emulator';
4+
const DEFAULT_CI_AVD_NAME = 'e2e_emulator';
55

66
const isRunningCI = process.env.CI != null;
77

@@ -12,12 +12,6 @@ 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-
// "RNS_DETOX_AVD_NAME" can be set for local developement
16-
const detoxAvdName = process.env.RNS_DETOX_AVD_NAME ?? null;
17-
if (detoxAvdName !== null) {
18-
return detoxAvdName
19-
}
20-
2115
// Fallback: try to use Android SDK
2216
try {
2317
let stdout = ChildProcess.execSync("emulator -list-avds")
@@ -33,18 +27,21 @@ function detectLocalAndroidEmulator() {
3327
throw new Error('No installed AVDs detected on the device');
3428
}
3529

36-
// Just select first one in the list.
30+
// Just select first one in the list.
3731
// TODO: consider giving user a choice here.
3832
return avdList[0];
3933
} catch (error) {
40-
const errorMessage = `Failed to find Android emulator. Set "DETOX_AVD_NAME" env variable pointing to one. Cause: ${error}`
34+
const errorMessage = `Failed to find Android emulator. Set "DETOX_AVD_NAME" env variable pointing to one. Cause: ${error}`;
4135
console.error(errorMessage);
4236
throw new Error(errorMessage);
4337
}
4438
}
4539

4640
function detectAndroidEmulatorName() {
47-
return isRunningCI ? RNS_CI_AVD_NAME : detectLocalAndroidEmulator();
41+
// "RNS_E2E_AVD_NAME" can be set for local developement
42+
return process.env.RNS_E2E_AVD_NAME || isRunningCI
43+
? DEFAULT_CI_AVD_NAME
44+
: detectLocalAndroidEmulator();
4845
}
4946

5047
/**
@@ -145,10 +142,10 @@ function commonDetoxConfigFactory(applicationName) {
145142
app: 'android.release',
146143
},
147144
},
148-
}
145+
};
149146
}
150147

151148
module.exports = {
152149
commonDetoxConfigFactory,
153150
isRunningCI,
154-
}
151+
};

0 commit comments

Comments
 (0)