Skip to content

Commit a13a151

Browse files
committed
test(e2e, android): download coverage even if multiple emulators
1 parent df6fb48 commit a13a151

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/e2e/init.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ beforeEach(async function beforeEach() {
5353
after(async function () {
5454
console.log(' ✨ Tests Complete ✨ ');
5555
const isAndroid = detox.device.getPlatform() === 'android';
56+
const deviceId = detox.device.id;
5657

5758
// emits 'cleanup' across socket, which goes native, terminates Detox test Looper
5859
// This returns control to the java code in our instrumented test, and then Instrumentation lifecycle finishes cleanly
@@ -69,12 +70,12 @@ after(async function () {
6970
const localDestDir = './android/app/build/output/coverage/';
7071

7172
try {
72-
execSync(`adb shell "run-as ${pkg} cat ${emuOrig} > ${emuDest}"`);
73+
execSync(`adb -s ${deviceId} shell "run-as ${pkg} cat ${emuOrig} > ${emuDest}"`);
7374
execSync(`mkdir -p ${localDestDir}`);
74-
execSync(`adb pull ${emuDest} ${localDestDir}/emulator_coverage.ec`);
75+
execSync(`adb -s ${deviceId} pull ${emuDest} ${localDestDir}/emulator_coverage.ec`);
7576
console.log(`Coverage data downloaded to: ${localDestDir}/emulator_coverage.ec`);
7677
} catch (e) {
77-
console.log('Unable to download coverage data from device: ', e);
78+
console.log('Unable to download coverage data from device: ', JSON.stringify(e));
7879
}
7980
}
8081

0 commit comments

Comments
 (0)