Существует ли способ автоматизации многозадачности на iPad с помощью тестов XCUI для iOS 13?
Видимо, приведенный ниже код работал в 2017 году (https://forums.developer.apple.com/thread/38973). Однако он не будет работать на iOS 13 (не пробовал iOS 12). Я пытался играть с разными координатами, но ничего не получается.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
XCUIApplication *app = [[XCUIApplication alloc] init];
[app launch];
[XCUIDevice sharedDevice].orientation = UIDeviceOrientationLandscapeLeft;
if ([[app coordinateWithNormalizedOffset:CGVectorMake(1.0, 1.0)] screenPoint].x < [[app coordinateWithNormalizedOffset:CGVectorMake(1.0, 1.0)] screenPoint].y)
{ //if multitasking is not enabled yet
////make the app switcher menu appear
XCUICoordinate *coord1 = [app coordinateWithNormalizedOffset:CGVectorMake(0.5, 1.0)];
XCUICoordinate *coord2 = [coord1 coordinateWithOffset:CGVectorMake(0, -200)];
// Perform a drag from coord1 to coord2
[coord1 pressForDuration:0.5f thenDragToCoordinate:coord2];
////open an another app
XCUICoordinate *otherAppIconCoordinate = [app coordinateWithNormalizedOffset:CGVectorMake(1.2, 0.9)];
[otherAppIconCoordinate tap];
//switch from slide-over to split-view mode (drag the slide-over dragging thingy just a little bit to the left)
coord1 = [app coordinateWithNormalizedOffset:CGVectorMake(0.5, 0.73)];
coord2 = [coord1 coordinateWithOffset:CGVectorMake(0, -50)];
[coord1 pressForDuration:0.5f thenDragToCoordinate:coord2];
} else
{ //if multitasking is already enabled
////make the split-view disappear
XCUICoordinate *coord1 = [app coordinateWithNormalizedOffset:CGVectorMake(0.5, 1.0)];
XCUICoordinate *coord2 = [coord1 coordinateWithOffset:CGVectorMake(0, [[app coordinateWithNormalizedOffset:CGVectorMake(1.0, 1.0)] screenPoint].x)];
// Perform a drag from coord1 to coord2
[coord1 pressForDuration:0.5f thenDragToCoordinate:coord2];
}
//give us a bit time so we can enjoy the app in split-view mode (feel free to delete this line... :) )
sleep(10);
}