From 766be59ef31753f4029c57c7a13cc01b1312cb9e Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 17 Dec 2023 07:59:54 -0800 Subject: [PATCH] ci: tune testCameraRollAlert for CI env (#828) --- WebDriverAgentTests/IntegrationTests/FBAlertTests.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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]; } }