Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 157faa1

Browse files
Fix uninstalling app from emulator for tests (#1767)
1 parent 3555ec2 commit 157faa1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

code-push-plugin-testing-framework/script/platform.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,16 @@ var AndroidEmulatorManager = (function () {
249249
* Uninstalls the app from the emulator.
250250
*/
251251
AndroidEmulatorManager.prototype.uninstallApplication = function (appId) {
252-
return testUtil_1.TestUtil.getProcessOutput("adb uninstall " + appId).then(function () { return null; });
252+
return testUtil_1.TestUtil.getProcessOutput("adb shell pm list packages")
253+
.then(function (output) {
254+
return output.includes(appId);
255+
}).then(function (isAppExist) {
256+
if (isAppExist) {
257+
return testUtil_1.TestUtil.getProcessOutput("adb uninstall " + appId).then(function () { return null; });
258+
}
259+
260+
return null;
261+
});
253262
};
254263
AndroidEmulatorManager.ANDROID_EMULATOR_OPTION_NAME = "--androidemu";
255264
AndroidEmulatorManager.DEFAULT_ANDROID_EMULATOR = "emulator";

0 commit comments

Comments
 (0)