@@ -24,14 +24,19 @@ const APPIUM_PORT = 4728;
2424
2525export type SupportedPlatformsType = 'android' | 'ios' ;
2626
27+ export type IOSTestContext = {
28+ customInstallTime ?: string ;
29+ } ;
30+
2731export const openAppMultipleDevices = async (
2832 platform : SupportedPlatformsType ,
2933 numberOfDevices : number ,
30- testInfo : TestInfo
34+ testInfo : TestInfo ,
35+ iOSContext ?: IOSTestContext
3136) : Promise < DeviceWrapper [ ] > => {
3237 // Create an array of promises for each device
3338 const devicePromises = Array . from ( { length : numberOfDevices } , ( _ , index ) =>
34- openAppOnPlatform ( platform , index as CapabilitiesIndexType , testInfo )
39+ openAppOnPlatform ( platform , index as CapabilitiesIndexType , testInfo , iOSContext )
3540 ) ;
3641
3742 // Use Promise.all to wait for all device apps to open
@@ -48,23 +53,25 @@ export const openAppMultipleDevices = async (
4853const openAppOnPlatform = async (
4954 platform : SupportedPlatformsType ,
5055 capabilitiesIndex : CapabilitiesIndexType ,
51- testInfo : TestInfo
56+ testInfo : TestInfo ,
57+ iOSContext ?: IOSTestContext
5258) : Promise < {
5359 device : DeviceWrapper ;
5460} > => {
5561 console . info ( 'starting capabilitiesIndex' , capabilitiesIndex , platform ) ;
5662 return platform === 'ios'
57- ? openiOSApp ( capabilitiesIndex , testInfo )
63+ ? openiOSApp ( capabilitiesIndex , testInfo , iOSContext )
5864 : openAndroidApp ( capabilitiesIndex , testInfo ) ;
5965} ;
6066
6167export const openAppOnPlatformSingleDevice = async (
6268 platform : SupportedPlatformsType ,
63- testInfo : TestInfo
69+ testInfo : TestInfo ,
70+ iOSContext ?: IOSTestContext
6471) : Promise < {
6572 device : DeviceWrapper ;
6673} > => {
67- const result = await openAppOnPlatform ( platform , 0 , testInfo ) ;
74+ const result = await openAppOnPlatform ( platform , 0 , testInfo , iOSContext ) ;
6875
6976 registerDevicesForTest ( testInfo , [ result . device ] , platform ) ;
7077
@@ -73,14 +80,15 @@ export const openAppOnPlatformSingleDevice = async (
7380
7481export const openAppTwoDevices = async (
7582 platform : SupportedPlatformsType ,
76- testInfo : TestInfo
83+ testInfo : TestInfo ,
84+ iOSContext ?: IOSTestContext
7785) : Promise < {
7886 device1 : DeviceWrapper ;
7987 device2 : DeviceWrapper ;
8088} > => {
8189 const [ app1 , app2 ] = await Promise . all ( [
82- openAppOnPlatform ( platform , 0 , testInfo ) ,
83- openAppOnPlatform ( platform , 1 , testInfo ) ,
90+ openAppOnPlatform ( platform , 0 , testInfo , iOSContext ) ,
91+ openAppOnPlatform ( platform , 1 , testInfo , iOSContext ) ,
8492 ] ) ;
8593
8694 const result = { device1 : app1 . device , device2 : app2 . device } ;
@@ -92,16 +100,17 @@ export const openAppTwoDevices = async (
92100
93101export const openAppThreeDevices = async (
94102 platform : SupportedPlatformsType ,
95- testInfo : TestInfo
103+ testInfo : TestInfo ,
104+ iOSContext ?: IOSTestContext
96105) : Promise < {
97106 device1 : DeviceWrapper ;
98107 device2 : DeviceWrapper ;
99108 device3 : DeviceWrapper ;
100109} > => {
101110 const [ app1 , app2 , app3 ] = await Promise . all ( [
102- openAppOnPlatform ( platform , 0 , testInfo ) ,
103- openAppOnPlatform ( platform , 1 , testInfo ) ,
104- openAppOnPlatform ( platform , 2 , testInfo ) ,
111+ openAppOnPlatform ( platform , 0 , testInfo , iOSContext ) ,
112+ openAppOnPlatform ( platform , 1 , testInfo , iOSContext ) ,
113+ openAppOnPlatform ( platform , 2 , testInfo , iOSContext ) ,
105114 ] ) ;
106115
107116 const result = {
@@ -117,18 +126,19 @@ export const openAppThreeDevices = async (
117126
118127export const openAppFourDevices = async (
119128 platform : SupportedPlatformsType ,
120- testInfo : TestInfo
129+ testInfo : TestInfo ,
130+ iOSContext ?: IOSTestContext
121131) : Promise < {
122132 device1 : DeviceWrapper ;
123133 device2 : DeviceWrapper ;
124134 device3 : DeviceWrapper ;
125135 device4 : DeviceWrapper ;
126136} > => {
127137 const [ app1 , app2 , app3 , app4 ] = await Promise . all ( [
128- openAppOnPlatform ( platform , 0 , testInfo ) ,
129- openAppOnPlatform ( platform , 1 , testInfo ) ,
130- openAppOnPlatform ( platform , 2 , testInfo ) ,
131- openAppOnPlatform ( platform , 3 , testInfo ) ,
138+ openAppOnPlatform ( platform , 0 , testInfo , iOSContext ) ,
139+ openAppOnPlatform ( platform , 1 , testInfo , iOSContext ) ,
140+ openAppOnPlatform ( platform , 2 , testInfo , iOSContext ) ,
141+ openAppOnPlatform ( platform , 3 , testInfo , iOSContext ) ,
132142 ] ) ;
133143
134144 const result = {
@@ -286,7 +296,8 @@ const openAndroidApp = async (
286296
287297const openiOSApp = async (
288298 capabilitiesIndex : CapabilitiesIndexType ,
289- testInfo : TestInfo
299+ testInfo : TestInfo ,
300+ iOSContext ?: IOSTestContext
290301) : Promise < {
291302 device : DeviceWrapper ;
292303} > => {
@@ -321,7 +332,10 @@ const openiOSApp = async (
321332 address : `http://localhost:${ APPIUM_PORT } ` ,
322333 } as XCUITestDriverOpts ;
323334
324- const capabilities = getIosCapabilities ( actualCapabilitiesIndex as CapabilitiesIndexType ) ;
335+ const capabilities = getIosCapabilities (
336+ actualCapabilitiesIndex as CapabilitiesIndexType ,
337+ iOSContext ?. customInstallTime
338+ ) ;
325339 const udid = capabilities . alwaysMatch [ 'appium:udid' ] as string ;
326340
327341 const { device : wrappedDevice } = await cleanPermissions ( opts , udid , capabilities , testInfo ) ;
0 commit comments