Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 0d44865

Browse files
fix(deviceLogs): iOS device logs are not shown when deployOnDevices is used
When the public method `devicesService.deployOnDevices` is used, the device logs for iOS are not shown. The problem is that the method calls `canStartApplication`, which returns false on Windows. Remove the check and also ensure the set of projectName for the deviceLogProvider will be called no matter of the way we start iOS Applications (through the mounted image or through Safari on device).
1 parent c222ae0 commit 0d44865

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

mobile/application-manager-base.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,9 @@ export abstract class ApplicationManagerBase extends EventEmitter implements Mob
7070

7171
public async tryStartApplication(appData: Mobile.IApplicationData): Promise<void> {
7272
try {
73-
if (this.canStartApplication()) {
74-
await this.startApplication(appData);
75-
}
73+
await this.startApplication(appData);
7674
} catch (err) {
77-
this.$logger.trace(`Unable to start application ${appData.appId}. Error is: ${err.message}`);
75+
this.$logger.trace(`Unable to start application ${appData.appId} with name ${appData.projectName}. Error is: ${err.message}`);
7876
}
7977
}
8078

mobile/ios/device/ios-application-manager.ts

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export class IOSApplicationManager extends ApplicationManagerBase {
102102

103103
public async restartApplication(appData: Mobile.IApplicationData): Promise<void> {
104104
try {
105+
this.$deviceLogProvider.setProjectNameForDevice(this.device.deviceInfo.identifier, appData.projectName);
105106
await this.stopApplication(appData);
106107
await this.runApplicationCore(appData);
107108
} catch (err) {

test/unit-tests/mobile/application-manager-base.ts

+1-23
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,9 @@ describe("ApplicationManagerBase", () => {
640640
});
641641

642642
describe("tryStartApplication", () => {
643-
it("calls startApplication, when canStartApplication returns true", async () => {
643+
it("calls startApplication", async () => {
644644
let passedApplicationData: Mobile.IApplicationData = null;
645645

646-
applicationManager.canStartApplication = () => true;
647646
applicationManager.startApplication = (appData: Mobile.IApplicationData) => {
648647
passedApplicationData = appData;
649648
return Promise.resolve();
@@ -658,18 +657,6 @@ describe("ApplicationManagerBase", () => {
658657

659658
});
660659

661-
it("does not call startApplication, when canStartApplication returns false", async () => {
662-
let isStartApplicationCalled = false;
663-
applicationManager.canStartApplication = () => false;
664-
applicationManager.startApplication = (appData: Mobile.IApplicationData) => {
665-
isStartApplicationCalled = true;
666-
return Promise.resolve();
667-
};
668-
669-
await applicationManager.tryStartApplication(applicationData);
670-
assert.isFalse(isStartApplicationCalled, "startApplication must not be called when canStartApplication returns false.");
671-
});
672-
673660
describe("does not throw Error", () => {
674661
const error = new Error("Throw!");
675662
let isStartApplicationCalled = false;
@@ -696,16 +683,7 @@ describe("ApplicationManagerBase", () => {
696683
assert.isTrue(logger.traceOutput.indexOf("Unable to start application") !== -1, "'Unable to start application' must be shown in trace output.");
697684
};
698685

699-
it("when canStartApplication throws error", async () => {
700-
applicationManager.canStartApplication = (): boolean => {
701-
throw error;
702-
};
703-
applicationManager.isApplicationInstalled = (appId: string) => Promise.resolve(true);
704-
await assertDoesNotThrow();
705-
});
706-
707686
it("when startApplications throws", async () => {
708-
applicationManager.canStartApplication = () => true;
709687
applicationManager.isApplicationInstalled = (appId: string) => Promise.resolve(true);
710688
await assertDoesNotThrow({ shouldStartApplicatinThrow: true });
711689
});

0 commit comments

Comments
 (0)