有没有一种方法可以通过iOS 13的XCUI测试在iPad上自动执行多任务
有没有办法通过iOS 13的XCUI测试在iPad上自动执行多任务 显然,下面的代码在2017年起作用()。但是,它在iOS 13上不起作用(没有尝试iOS 12)。我尝试过使用不同的滑动坐标,但没有任何效果有没有一种方法可以通过iOS 13的XCUI测试在iPad上自动执行多任务,ios,xcode,ios-simulator,xcuitest,split-screen-multitasking,Ios,Xcode,Ios Simulator,Xcuitest,Split Screen Multitasking,有没有办法通过iOS 13的XCUI测试在iPad上自动执行多任务 显然,下面的代码在2017年起作用()。但是,它在iOS 13上不起作用(没有尝试iOS 12)。我尝试过使用不同的滑动坐标,但没有任何效果 if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { XCUIApplication *app = [[XCUIApplication alloc] init];
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);
}
如果([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdiomPad){
XCUIApplication*app=[[XCUIApplication alloc]init];
[应用程序启动];
[XUIDevice sharedDevice].orientation=UIDeviceOrientation和scapeLeft;
如果([[app coordinateWithNormalizedOffset:CGVectorMake(1.0,1.0)]屏幕点].x<[app coordinateWithNormalizedOffset:CGVectorMake(1.0,1.0)]屏幕点].y)
{//如果尚未启用多任务处理
////使应用程序切换程序菜单出现
XCUICoordinate*coord1=[app coordinateWithNormalizedOffset:CGVectorMake(0.5,1.0)];
XCUICoordinate*coord2=[coord1 coordinateWithOffset:CGVectorMake(0,-200)];
//执行从coord1到coord2的拖动
[coord1按持续时间:0.5f,然后拖动坐标:coord2];
////打开另一个应用程序
xUICoordinate*otherAppIconCoordinate=[AppCoordinateWithNormalizedOffset:CGVectorMake(1.2,0.9)];
[其他应用程序协调抽头];
//从“幻灯片切换”切换到“分割视图”模式(将幻灯片拖动到左侧一点)
coord1=[app coordinateWithNormalizedOffset:CGVectorMake(0.5,0.73)];
coord2=[coord1 coordinateWithOffset:CGVectorMake(0,-50)];
[coord1按持续时间:0.5f,然后拖动坐标:coord2];
}否则
{//如果已启用多任务处理
////使分割视图消失
XCUICoordinate*coord1=[app coordinateWithNormalizedOffset:CGVectorMake(0.5,1.0)];
xUICoordinate*coord2=[coord1 coordinateWithOffset:CGVectorMake(0,[[app coordinateWithNormalizedOffset:CGVectorMake(1.0,1.0)]屏幕点].x];
//执行从coord1到coord2的拖动
[coord1按持续时间:0.5f,然后拖动坐标:coord2];
}
//给我们一点时间,让我们可以在分割视图模式下享受应用程序(请随意删除此行…:)
睡眠(10);
}