@@ -289,35 +289,11 @@ func runXUITestWithBundleIdsXcode15Ctx(
289
289
}
290
290
defer conn2 .Close ()
291
291
292
- installationProxy , err := installationproxy .New (config .Device )
293
- if err != nil {
294
- return make ([]TestSuite , 0 ), fmt .Errorf ("runXUITestWithBundleIdsXcode15Ctx: cannot connect to installation proxy: %w" , err )
295
- }
296
- defer installationProxy .Close ()
297
- apps , err := installationProxy .BrowseUserApps ()
298
- if err != nil {
299
- return make ([]TestSuite , 0 ), fmt .Errorf ("runXUITestWithBundleIdsXcode15Ctx: cannot browse user apps: %w" , err )
300
- }
301
-
302
- testAppInfo , err := getappInfo (config .TestRunnerBundleId , apps )
292
+ testSessionID := uuid .New ()
293
+ info , err := getTestInfo (config .Device , config .BundleId , config .TestRunnerBundleId )
303
294
if err != nil {
304
- return make ([]TestSuite , 0 ), fmt .Errorf ("runXUITestWithBundleIdsXcode15Ctx: cannot get test app information : %w" , err )
295
+ return make ([]TestSuite , 0 ), fmt .Errorf ("runXUITestWithBundleIdsXcode15Ctx: cannot build test info : %w" , err )
305
296
}
306
-
307
- info := testInfo {
308
- testApp : testAppInfo ,
309
- }
310
-
311
- if config .BundleId != "" {
312
- appInfo , err := getappInfo (config .BundleId , apps )
313
- if err != nil {
314
- return make ([]TestSuite , 0 ), fmt .Errorf ("runXUITestWithBundleIdsXcode15Ctx: cannot get app information: %w" , err )
315
- }
316
-
317
- info .targetApp = appInfo
318
- }
319
-
320
- testSessionID := uuid .New ()
321
297
testconfig := createTestConfig (info , testSessionID , config .XctestConfigName , config .TestsToRun , config .TestsToSkip , config .XcTest , version )
322
298
ideDaemonProxy1 := newDtxProxyWithConfig (conn1 , testconfig , config .Listener )
323
299
@@ -483,22 +459,21 @@ func startTestRunner17(appserviceConn *appservice.Connection, bundleID string, s
483
459
return appLaunch , nil
484
460
}
485
461
486
- func setupXcuiTest (device ios.DeviceEntry , bundleID string , testRunnerBundleID string , xctestConfigFileName string , testsToRun []string , testsToSkip []string , isXCTest bool , version * semver.Version ) (uuid.UUID , string , nskeyedarchiver.XCTestConfiguration , testInfo , error ) {
487
- testSessionID := uuid .New ()
462
+ func getTestInfo (device ios.DeviceEntry , bundleID string , testRunnerBundleID string ) (testInfo , error ) {
488
463
installationProxy , err := installationproxy .New (device )
489
464
if err != nil {
490
- return uuid. UUID {}, "" , nskeyedarchiver. XCTestConfiguration {}, testInfo {} , err
465
+ return testInfo {}, fmt . Errorf ( "cannot connect to installation proxy: %w" , err )
491
466
}
492
467
defer installationProxy .Close ()
493
468
494
469
apps , err := installationProxy .BrowseUserApps ()
495
470
if err != nil {
496
- return uuid. UUID {}, "" , nskeyedarchiver. XCTestConfiguration {}, testInfo {} , err
471
+ return testInfo {}, fmt . Errorf ( "cannot browse user apps: %w" , err )
497
472
}
498
473
499
474
testAppInfo , err := getappInfo (testRunnerBundleID , apps )
500
475
if err != nil {
501
- return uuid. UUID {}, "" , nskeyedarchiver. XCTestConfiguration {}, testInfo {} , err
476
+ return testInfo {}, fmt . Errorf ( "cannot get test app information: %w" , err )
502
477
}
503
478
504
479
info := testInfo {
@@ -508,19 +483,32 @@ func setupXcuiTest(device ios.DeviceEntry, bundleID string, testRunnerBundleID s
508
483
if bundleID != "" {
509
484
appInfo , err := getappInfo (bundleID , apps )
510
485
if err != nil {
511
- return uuid. UUID {}, "" , nskeyedarchiver. XCTestConfiguration {}, testInfo {} , err
486
+ return testInfo {}, fmt . Errorf ( "cannot get app information: %w" , err )
512
487
}
513
488
log .Debugf ("app info found: %+v" , appInfo )
514
489
515
490
info .targetApp = appInfo
516
491
}
517
492
493
+ return info , nil
494
+ }
495
+
496
+ func setupXcuiTest (device ios.DeviceEntry , bundleID string , testRunnerBundleID string , xctestConfigFileName string , testsToRun []string ,
497
+ testsToSkip []string , isXCTest bool , version * semver.Version ,
498
+ ) (uuid.UUID , string , nskeyedarchiver.XCTestConfiguration , testInfo , error ) {
499
+ info , err := getTestInfo (device , bundleID , testRunnerBundleID )
500
+ if err != nil {
501
+ return uuid.UUID {}, "" , nskeyedarchiver.XCTestConfiguration {}, testInfo {}, err
502
+ }
503
+
518
504
houseArrestService , err := house_arrest .New (device , testRunnerBundleID )
519
- defer houseArrestService .Close ()
520
505
if err != nil {
521
506
return uuid.UUID {}, "" , nskeyedarchiver.XCTestConfiguration {}, testInfo {}, err
522
507
}
508
+ defer houseArrestService .Close ()
509
+
523
510
log .Debugf ("creating test config" )
511
+ testSessionID := uuid .New ()
524
512
testConfigPath , testConfig , err := createTestConfigOnDevice (testSessionID , info , houseArrestService , xctestConfigFileName , testsToRun , testsToSkip , isXCTest , version )
525
513
if err != nil {
526
514
return uuid.UUID {}, "" , nskeyedarchiver.XCTestConfiguration {}, testInfo {}, err
@@ -529,6 +517,44 @@ func setupXcuiTest(device ios.DeviceEntry, bundleID string, testRunnerBundleID s
529
517
return testSessionID , testConfigPath , testConfig , info , nil
530
518
}
531
519
520
+ func setupXcuiTest12 (device ios.DeviceEntry , bundleID string , testRunnerBundleID string , xctestConfigFileName string , testsToRun []string , testsToSkip []string , isXCTest bool , version * semver.Version ) (uuid.UUID , nskeyedarchiver.XCTestConfiguration , testInfo , error ) {
521
+ testSessionID := uuid .New ()
522
+ installationProxy , err := installationproxy .New (device )
523
+ if err != nil {
524
+ return uuid.UUID {}, nskeyedarchiver.XCTestConfiguration {}, testInfo {}, err
525
+ }
526
+ defer installationProxy .Close ()
527
+
528
+ apps , err := installationProxy .BrowseUserApps ()
529
+ if err != nil {
530
+ return uuid.UUID {}, nskeyedarchiver.XCTestConfiguration {}, testInfo {}, err
531
+ }
532
+
533
+ testAppInfo , err := getappInfo (testRunnerBundleID , apps )
534
+ if err != nil {
535
+ return uuid.UUID {}, nskeyedarchiver.XCTestConfiguration {}, testInfo {}, err
536
+ }
537
+
538
+ info := testInfo {
539
+ testApp : testAppInfo ,
540
+ }
541
+
542
+ if bundleID != "" {
543
+ appInfo , err := getappInfo (bundleID , apps )
544
+ if err != nil {
545
+ return uuid.UUID {}, nskeyedarchiver.XCTestConfiguration {}, testInfo {}, err
546
+ }
547
+ log .Debugf ("app info found: %+v" , appInfo )
548
+
549
+ info .targetApp = appInfo
550
+ }
551
+
552
+ log .Debugf ("creating test config" )
553
+ testConfig := createTestConfig (info , testSessionID , xctestConfigFileName , testsToRun , testsToSkip , isXCTest , version )
554
+
555
+ return testSessionID , testConfig , info , nil
556
+ }
557
+
532
558
func createTestConfigOnDevice (testSessionID uuid.UUID , info testInfo , houseArrestService * house_arrest.Connection , xctestConfigFileName string , testsToRun []string , testsToSkip []string , isXCTest bool , version * semver.Version ) (string , nskeyedarchiver.XCTestConfiguration , error ) {
533
559
relativeXcTestConfigPath := path .Join ("tmp" , testSessionID .String ()+ ".xctestconfiguration" )
534
560
xctestConfigPath := path .Join (info .testApp .homePath , relativeXcTestConfigPath )
0 commit comments