diff --git a/WebDriverAgentTests/IntegrationTests/FBAlertTests.m b/WebDriverAgentTests/IntegrationTests/FBAlertTests.m index 3729c4d54..a7cf04418 100644 --- a/WebDriverAgentTests/IntegrationTests/FBAlertTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBAlertTests.m @@ -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]; } }