KasperskyLab / Kaspresso

Android UI test framework
https://kasperskylab.github.io/Kaspresso/
Apache License 2.0
1.81k stars 153 forks source link

Cannot setup interceptors :( #433

Closed michalorminski closed 1 year ago

michalorminski commented 2 years ago

Hi,

Apologies for the stupid question, but what and how should I use to implement a solution for a following type of problem: "If a dialog X appears in a random moment in a Kaspresso test, close it by click on a UiButton with and id 'dismiss'". If the dialog is not appearing, just quickly move on with the test.

I've read the docs and figured out the maybe interceptors (or Watchers as we are also using some regular UiAutomator in the code but thats a different story) could help.

I cannot figure out though how to setup an interceptor that looks over the tests and tries to click "dismiss" if an UiObjectNotFound will appear in some random moment and ofc if the "dismiss" button exist.

I am also not sure if I understand the idea of interceptors/watchers right probably not. :/

Thx in advance for the help.

michalorminski commented 2 years ago

any1? :(

Areyana commented 1 year ago

Thx for issue, we know about system dialog interceptor problem, i'll check it. As for interceptors they probably work without any code from your side in a "automatic" way (as for dialog/flaky/autoscroll interceptors for example).

Areyana commented 1 year ago

fixed in #460

michalorminski commented 1 year ago

Hi @Areyana , thx for fixing but that was not quite the issue I witnessed. I moved on a little bit though. Now I'm stuck at this example: image

When I use the interceptor inside the @Test method - it works perfectly. But when i try to use it in the @Before method - it completely does not work (no logs - it seems it does not intercept anything).

Areyana commented 1 year ago

@michalorminski Can you check this example. Cause i think, @Before usage on interceptors has no any effect.