Espresso test is not finishing and it keeps on finding element when there is an issue in the application

576 Views Asked by At

I have the espresso test. When there is any issue in the app the test is not finishing and it keeps on staying on the same screen. Is there anyway we can give timeout for the espresso test. I cant find solution for the global timeout. Junit Android Espresso Test

@Before
public static void beforeClass() {
    IdlingPolicies.setMasterPolicyTimeout(10, TimeUnit.SECONDS);
    IdlingPolicies.setIdlingResourceTimeout(10, TimeUnit.SECONDS);
}
1

There are 1 best solutions below

1
Nehemias G Miranda On

You could add a timeout rule. E.g. Rule to timeout after 2 minutes

@get:Rule val globalTimeout: Timeout = Timeout.seconds(120)