File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -292,9 +292,21 @@ const openiOSApp = async (
292
292
} > => {
293
293
console . info ( 'openiOSApp' ) ;
294
294
295
- // Calculate the actual capabilities index for the current worker
296
- const actualCapabilitiesIndex =
297
- capabilitiesIndex + getDevicesPerTestCount ( ) * parseInt ( process . env . TEST_PARALLEL_INDEX || '0' ) ;
295
+ const parallelIndex = parseInt ( process . env . TEST_PARALLEL_INDEX || '0' ) ;
296
+ const devicesPerWorker = getDevicesPerTestCount ( ) ;
297
+
298
+ // Calculate base offset for this worker
299
+ const workerBaseOffset = devicesPerWorker * parallelIndex ;
300
+
301
+ // Add retry offset, but wrap within the worker's device pool only
302
+ // This means when retrying, a alice/bob etc won't be the same device as before within a worker's pool
303
+ const retryOffset = testInfo . retry || 0 ;
304
+ const deviceIndexWithinWorker = ( capabilitiesIndex + retryOffset ) % devicesPerWorker ;
305
+ const actualCapabilitiesIndex = workerBaseOffset + deviceIndexWithinWorker ;
306
+
307
+ console . info (
308
+ `Worker ${ parallelIndex } , Base Device ${ capabilitiesIndex } , Retry ${ retryOffset } -> Device ${ actualCapabilitiesIndex } `
309
+ ) ;
298
310
299
311
const opts : XCUITestDriverOpts = {
300
312
address : `http://localhost:${ APPIUM_PORT } ` ,
You can’t perform that action at this time.
0 commit comments