Skip to content

Commit

Permalink
ci: tune testCameraRollAlert for CI env (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa authored Dec 17, 2023
1 parent 3480bd4 commit 766be59
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions WebDriverAgentTests/IntegrationTests/FBAlertTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,22 @@ - (void)testNotificationAlert
XCTAssertTrue([alert.text containsString:@"Notifications may include"]);
}

// It worked locally but CI did not.
// This test case depends on the local app permission state.
- (void)testCameraRollAlert
{
XCTSkip(@"The alert depends on the permission condition. Azure CI env might have an issue to handle permission.");

FBAlert *alert = [FBAlert alertWithApplication:self.testedApplication];
XCTAssertNil(alert.text);

[self.testedApplication.buttons[@"Create Camera Roll Alert"] tap];
FBAssertWaitTillBecomesTrue(alert.isPresent);

XCTAssertTrue([alert.text containsString:@"Would Like to Access Your Photos"]);
// "Would Like to Access Your Photos" or "Would Like to Access Your Photo Library" displayes on the alert button.
XCTAssertTrue([alert.text containsString:@"Would Like to Access Your Photo"]);
// iOS 15 has different UI flow
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"15.0")) {
[[FBAlert alertWithApplication:self.testedApplication] dismissWithError:nil];
// CI env could take longer time to show up the button, thus it needs to wait a bit.
XCTAssertTrue([self.testedApplication.buttons[@"Cancel"] waitForExistenceWithTimeout:30.0]);
[self.testedApplication.buttons[@"Cancel"] tap];
}
}
Expand Down

0 comments on commit 766be59

Please sign in to comment.