-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[platform_view]add timeout for alert buttons and a few other changes to fix a test flake #110516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[platform_view]add timeout for alert buttons and a few other changes to fix a test flake #110516
Conversation
41b3674
to
002c4cf
Compare
@@ -36,17 +36,31 @@ - (void)setUp { | |||
if ([appIcon waitForExistenceWithTimeout:kStandardTimeOut]) { | |||
NSLog(@"Deleting previously installed app."); | |||
|
|||
// Make icons wiggle | |||
[appIcon pressForDuration:3]; | |||
if (!appIcon.isHittable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of sleeping, use the wait
APIs
flutter/dev/integration_tests/ios_host_app/FlutterUITests/FlutterUITests.m
Lines 120 to 122 in 7428ab6
NSPredicate *hittable = [NSPredicate predicateWithFormat:@"exists == YES AND hittable == YES"]; | |
[self expectationForPredicate:hittable evaluatedWithObject:element handler:nil]; | |
[self waitForExpectationsWithTimeout:30.0 handler:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
// Pressing for 2 seconds will bring up context menu. | ||
// Pressing for 3 seconds will dismiss the context menu and make icons wiggle. | ||
[appIcon pressForDuration:2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this isn't flaky... You could consider taking XCAttachment
screenshots when these fail to see what's going on.
I hate these kinds of Xcode test harness bugs. As do you too now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was thinking the same. In that stackoverflow I linked, there are 2 versions: 1.3 seconds and 2 seconds.
I picked 2 seconds in case of slow hardware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm actually sorry to thrash on this, but never mind this isn't necessary, the next thing that happens is the screenshotAttachment
XCTAssert
that will automatically take a screenshot if the assert fails.
… when assert fails
…changes to fix a test flake (flutter/flutter#110516)
…changes to fix a test flake (flutter/flutter#110516)
…changes to fix a test flake (flutter/flutter#110516)
…changes to fix a test flake (flutter/flutter#110516)
This is to add timeout for alert buttons, to address a new test flake.
here's led
Analysis
1.
kAXErrorServerNotFound
:tearDown
. However, this is what we are doing already.kAXErrorServerNotFound
is just a warning and not an error, because the test continues to run even after this error, and then we got another error about alert not found.2. "No matches found for Descendants matching type Alert"
Changes
1. Add the timeout for the alert
As discussed in above. Also added timeout for the initial delete button just to be extra safe.
2. Use context menu's delete button instead of the "X" button
@"DeleteButton"
name, and others use a hardcoded coordinate offset. Both aren't ideal. Very interestingly, I tried the@"DeleteButton"
approach again on my machine today, and some times it does not work (but most of the time it works)3. Add a hittable check for appIcon
Debug info
Full logs
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8804511299285366417/+/u/run_native_platform_view_ui_tests_ios/test_stdout
Logs
List which issues are fixed by this PR. You must list at least one issue.
#109697
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.