-
Notifications
You must be signed in to change notification settings - Fork 395
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
refactor: Get rid of the legacy quiescence control stuff #404
Conversation
BREAKING CHANGE: the minimum supported Xcode SDK version is bumped to 10.2
okay, will take a look. (It seems this should be after 1.19.0) |
This may help to fix the |
Thanks a lot @Dan-Maor , I've applied the patch |
@Dan-Maor I've tuned the logic a bit and swizzled lower level methods named |
I think swizzling this deep might be a bit risky. One thing I noticed was that the second argument of the callback is not an I'm afraid that the more we test we'll find more scenarios like the one outlined above. Therefore I really think we should stick to the internal |
8b32bed
to
fa65068
Compare
@@ -70,4 +75,9 @@ | |||
// Gone with iOS 10.3 | |||
- (void)waitForQuiescence; | |||
|
|||
// Since Xcode 10.2 | |||
- (void)_notifyWhenAnimationsAreIdle:(CDUnknownBlockType)arg1; |
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 apparently know what the signature of those blocks is: void (^)(id, NSError *)
. Casting the IMP
pointer would still be necessary in XCUIApplicationProcess+FBQuiescence.m
, but we would have the same things defined in both places.
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.
changed the signature
if (!isSignalSet) { | ||
onIdle(sender, error); | ||
} |
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's still a race condition because isSignalSet
can be changed on a different thread.
Could we just use dispatch_once
in both places where onIdle(...)
is called and get rid of isSignalSet
?
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.
added locks
if (!isSignalSet) { | ||
onIdle(sender, error); | ||
} |
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.
Same here as above in swizzledNotifyWhenMainRunLoopIsIdle
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.
added locks
isSignalSet = YES; | ||
[FBLogger logFmt:@"The application %@ is still waiting for being in idle state after %.3f seconds timeout. Making it to believe it is idling", [self bundleID], FBConfiguration.waitForIdleTimeout]; | ||
[FBLogger log:@"The timeout value could be customized via 'waitForIdleTimeout' setting"]; | ||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ |
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 the original callback also being executed on a background thread?
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.
yes, it should be always executed on a background thread
BREAKING CHANGE: the minimum supported Xcode SDK version is bumped to 10.2
BREAKING CHANGE: quiescence check is enabled by default (only breaking for WDA, because Appium does enable it by default)
This is a big change and it needs to be carefully tested on supported SDKs before being merged to master. Long story short, now the actual quiescence timeout is controlled by
waitForIdleTimeout
setting (same as in uia2, also measured is ms). Setting it to zero disables quiescence checks. The default value is 10 seconds (same as for Android).@Dan-Maor @KazuCocoa I hope you could assist with testing