Skip to content

Commit 0022982

Browse files
authored
Retry button tap in [FlutterUITests testFlutterViewWarm] (#143967)
Attempting to fix flutter/flutter#142125.
1 parent fcd154b commit 0022982

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dev/integration_tests/ios_host_app/FlutterUITests/FlutterUITests.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,17 @@ - (void)testFlutterViewWarm {
7373
XCTAssertTrue(newPageAppeared);
7474

7575
[self waitForAndTapElement:app.otherElements[@"Increment via Flutter"]];
76-
XCTAssertTrue([app.staticTexts[@"Button tapped 1 time."] waitForExistenceWithTimeout:kStandardTimeOut]);
76+
BOOL countIncremented = [app.staticTexts[@"Button tapped 1 time."] waitForExistenceWithTimeout:kStandardTimeOut];
77+
if (!countIncremented) {
78+
// Sometimes, the element doesn't respond to the tap, it seems to be an iOS 17 Simulator issue where the
79+
// simulator reboots. Try to tap the element again.
80+
[self waitForAndTapElement:app.otherElements[@"Increment via Flutter"]];
81+
countIncremented = [app.staticTexts[@"Button tapped 1 time."] waitForExistenceWithTimeout:kStandardTimeOut];
82+
if (!countIncremented) {
83+
os_log(OS_LOG_DEFAULT, "%@", app.debugDescription);
84+
}
85+
}
86+
XCTAssertTrue(countIncremented);
7787

7888
// Back navigation.
7989
[app.buttons[@"POP"] tap];

0 commit comments

Comments
 (0)