-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[share] Fix bug on iPad where origin
is null and enable XCUITests
#3188
Conversation
origin
is null and enable XCUITests
@@ -1,87 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
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.
Did you mean to remove this?
elementMatchingPredicate:[NSPredicate | ||
predicateWithFormat:@"label == %@", @"Share With Empty Origin"]]; | ||
if (![shareWithEmptyOriginButton waitForExistenceWithTimeout:30]) { | ||
NSLog(@"%@", app.debugDescription); |
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.
Remove the NSLog
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.
This is beneficial so that when a failure happened and we can see what's in the a11y tree and why the particular item was not found in the a11y tree.
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.
Can you print it when it fails? Your test results will get clogged pretty fast with a bunch of debugging lines.
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.
Also NSLog is soft deprecated, should be using os_log.
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.
The log only happens if ![shareWithEmptyOriginButton waitForExistenceWithTimeout:kSecondsToWaitWhenFindingElements]
and we send a XCTFail
signal afterwards. So it doesn't print unless the test fails.
Thanks for the info of os_log, updated!
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.
Or did you mean to combine the "app.debugDescription" log within XCTFail?
XCUIElement* shareWithEmptyOriginButton = [app.buttons | ||
elementMatchingPredicate:[NSPredicate | ||
predicateWithFormat:@"label == %@", @"Share With Empty Origin"]]; | ||
if (![shareWithEmptyOriginButton waitForExistenceWithTimeout:30]) { |
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.
30 seconds seems really long.
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.
We used the same waiting length on scenario app tests https://github.com/flutter/engine/blob/master/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenPlatformViewTests.m#L11
I think the rational is that on ci, the animation might take some time to run and might cause false negative to happen.
This returns immediately after finding the item, so I think setting time-out to be longer should be fine?
predicateWithFormat:@"identifier == %@", @"ActivityListView"]]; | ||
if (![activityListView waitForExistenceWithTimeout:30]) { | ||
NSLog(@"%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find activityListView with %@ seconds", @(30)); |
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.
literals as @30
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.
Fixed. Moved all the "30" out to a static
elementMatchingPredicate:[NSPredicate | ||
predicateWithFormat:@"identifier == %@", @"ActivityListView"]]; | ||
if (![activityListView waitForExistenceWithTimeout:30]) { | ||
NSLog(@"%@", app.debugDescription); |
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.
Remove
XCUIElement* activityListView = [app.otherElements | ||
elementMatchingPredicate:[NSPredicate | ||
predicateWithFormat:@"identifier == %@", @"ActivityListView"]]; | ||
if (![activityListView waitForExistenceWithTimeout:30]) { |
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.
Ditto, 30 seconds seems too long.
@@ -0,0 +1,22 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
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.
Is this unused?
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.
Thanks for the good catch! Removed.
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.
LGTM!
…n the repo (flutter#3210) * enable xctest in .cirrus.yml (flutter#3189) * [share] Fix bug on iPad where `origin` is null and enable XCUITests (flutter#3188)
Creates a XCUITests target in the share plugin.
Also fixes flutter/flutter#66485