From 00229827ab7c4f46a6d0e92cb7eb4d5e33a3a666 Mon Sep 17 00:00:00 2001 From: Victoria Ashworth <15619084+vashworth@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:13:21 -0600 Subject: [PATCH] Retry button tap in [FlutterUITests testFlutterViewWarm] (#143967) Attempting to fix https://github.com/flutter/flutter/issues/142125. --- .../ios_host_app/FlutterUITests/FlutterUITests.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dev/integration_tests/ios_host_app/FlutterUITests/FlutterUITests.m b/dev/integration_tests/ios_host_app/FlutterUITests/FlutterUITests.m index ef27427a59..91f9cc890c 100644 --- a/dev/integration_tests/ios_host_app/FlutterUITests/FlutterUITests.m +++ b/dev/integration_tests/ios_host_app/FlutterUITests/FlutterUITests.m @@ -73,7 +73,17 @@ static const CGFloat kStandardTimeOut = 60.0; XCTAssertTrue(newPageAppeared); [self waitForAndTapElement:app.otherElements[@"Increment via Flutter"]]; - XCTAssertTrue([app.staticTexts[@"Button tapped 1 time."] waitForExistenceWithTimeout:kStandardTimeOut]); + BOOL countIncremented = [app.staticTexts[@"Button tapped 1 time."] waitForExistenceWithTimeout:kStandardTimeOut]; + if (!countIncremented) { + // Sometimes, the element doesn't respond to the tap, it seems to be an iOS 17 Simulator issue where the + // simulator reboots. Try to tap the element again. + [self waitForAndTapElement:app.otherElements[@"Increment via Flutter"]]; + countIncremented = [app.staticTexts[@"Button tapped 1 time."] waitForExistenceWithTimeout:kStandardTimeOut]; + if (!countIncremented) { + os_log(OS_LOG_DEFAULT, "%@", app.debugDescription); + } + } + XCTAssertTrue(countIncremented); // Back navigation. [app.buttons[@"POP"] tap];