File tree Expand file tree Collapse file tree 5 files changed +27
-0
lines changed Expand file tree Collapse file tree 5 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ export class AppiumServer {
6262 const device = await this . _deviceManager . startDevice ( this . _args ) ;
6363 this . _args . device = device ;
6464 }
65+ if ( this . _args . isIOS ) {
66+ this . _deviceManager . installApp ( this . _args ) ;
67+ }
6568 log ( "Starting server..." , this . _args . verbose ) ;
6669 const logLevel = this . _args . verbose === true ? "debug" : "info" ;
6770 this . port = port || this . _args . port ;
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ export declare class DeviceManger implements IDeviceManager {
88 constructor ( port : any , _serveiceContext ?: ServiceContext ) ;
99 startDevice ( args : INsCapabilities ) : Promise < IDevice > ;
1010 stopDevice ( args : INsCapabilities ) : Promise < any > ;
11+ installApp ( args : INsCapabilities ) : Promise < any > ;
12+ unInstallApp ( args : INsCapabilities ) : Promise < any > ;
1113 static kill ( device : IDevice ) : Promise < void > ;
1214 private static getDefaultDevice ( args ) ;
1315}
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ import {
2020 Status ,
2121 DeviceType
2222} from "mobile-devices-controller" ;
23+ import { IOSController } from "../../mobile-devices-controller/lib/ios-controller" ;
24+ import { AndroidController } from "../../mobile-devices-controller/lib/android-controller" ;
2325
2426
2527export class DeviceManger implements IDeviceManager {
@@ -136,6 +138,22 @@ export class DeviceManger implements IDeviceManager {
136138 }
137139 }
138140
141+ public async installApp ( args : INsCapabilities ) : Promise < any > {
142+ if ( args . isIOS ) {
143+ IOSController . installApp ( args . device , args . appiumCaps . app ) ;
144+ } else {
145+ AndroidController . installApp ( args . device , args . appiumCaps . app )
146+ }
147+ }
148+
149+ public async unInstallApp ( args : INsCapabilities ) : Promise < any > {
150+ if ( args . isIOS ) {
151+ IOSController . uninstallApp ( args . device , args . appiumCaps . app ) ;
152+ } else {
153+ AndroidController . uninstallApp ( args . device , args . appiumCaps . app )
154+ }
155+ }
156+
139157 public static async kill ( device : IDevice ) {
140158 await DeviceController . kill ( device ) ;
141159 }
Original file line number Diff line number Diff line change @@ -3,4 +3,6 @@ import { IDevice } from "mobile-devices-controller";
33export interface IDeviceManager {
44 startDevice ( args : INsCapabilities ) : Promise < IDevice > ;
55 stopDevice ( args : INsCapabilities ) : Promise < IDevice > ;
6+ installApp ( args : INsCapabilities ) : Promise < void > ;
7+ unInstallApp ( args : INsCapabilities ) : Promise < void > ;
68}
Original file line number Diff line number Diff line change @@ -4,4 +4,6 @@ import { IDevice } from "mobile-devices-controller";
44export interface IDeviceManager {
55 startDevice ( args : INsCapabilities ) : Promise < IDevice >
66 stopDevice ( args : INsCapabilities ) : Promise < IDevice >
7+ installApp ( args : INsCapabilities ) : Promise < void > ;
8+ unInstallApp ( args : INsCapabilities ) : Promise < void > ;
79}
You can’t perform that action at this time.
0 commit comments