What are watchers?
Watchers are basically used for capturing the ANRs and other UI related issues. We will discuss in detail which issues are been captured using these watchers. It Provides auxiliary support for running your test cases.
There could be a situation when a UI Selector could not find a match for a particular action. At this point of time we can register watchers.
Register watchers
When a selector can not find a match, uiautomator will run all registered watchers.
Click target when conditions match
Let us understand what the above line means
d.watcher("WATCHER_NAME") : This will create a new watcher.
.when(condition) : condition for the watcher
.click() : The action to be perofomed once the target uiselector has been found
Next question arises that whatever watcher we have registered has been called or not.
watchers triggered
A watcher is triggered, which means the watcher was run and all its conditions matched.
Returns true if specified watcher triggered, else returns false
Remove watchers
Let us remove named watchers
List all watchers
Check all triggered watchers
Reset triggered watchers
Remove all watchers
Force run all registered watchers
No comments:
Post a Comment