Skip to content

Commit 82fa597

Browse files
BartlomiejWlodarczakcongt
authored andcommitted
Fix LandscapeTests and LandscapeTests_ViewTestActor failing on iPadOS
1 parent 1f31d7b commit 82fa597

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

Tests/LandscapeTests.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ - (void)beforeAll
1919
[tester waitForTimeInterval:0.5];
2020

2121
// only scroll if we are on iphone
22-
if(UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
22+
if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
2323
[tester scrollViewWithAccessibilityIdentifier:@"Test Suite TableView" byFractionOfSizeHorizontal:0 vertical:-0.2];
2424
}
2525
}
@@ -33,7 +33,14 @@ - (void)afterAll
3333
- (void)testThatAlertViewsCanBeTappedInLandscape
3434
{
3535
[tester tapViewWithAccessibilityLabel:@"UIAlertController"];
36-
[tester tapViewWithAccessibilityLabel:@"Cancel"];
36+
if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
37+
[tester tapViewWithAccessibilityLabel:@"Cancel"];
38+
} else {
39+
/* On iPadOS the UIAlertController is displayed as a popup over table view cell, there's no "Cancel" button.
40+
It can be dismissed by tapping anywhere on the screen.
41+
*/
42+
[tester tapScreenAtPoint:CGPointMake(1, 1)];
43+
}
3744
[tester tapViewWithAccessibilityLabel:@"Continue"];
3845
[tester waitForAbsenceOfViewWithAccessibilityLabel:@"Alert View"];
3946
}

Tests/LandscapeTests_ViewTestActor.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ - (void)beforeEach
3333
- (void)testThatAlertViewsCanBeTappedInLandscape
3434
{
3535
[viewTester tapRowInTableViewAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:1]];
36-
[[viewTester usingLabel:@"Cancel"] tap];
36+
37+
if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
38+
[[viewTester usingLabel:@"Cancel"] tap];
39+
} else {
40+
/* On iPadOS the UIAlertController is displayed as a popup over table view cell, there's no "Cancel" button.
41+
It can be dismissed by tapping anywhere on the screen.
42+
*/
43+
[viewTester tapRowInTableViewAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:1]];
44+
}
3745
[[viewTester usingLabel:@"Continue"] tap];
3846
[[viewTester usingLabel:@"Message"] waitForAbsenceOfView];
3947
}

0 commit comments

Comments
 (0)