I have an Android app composed of 2 activities. In the second activity, I have a viewpager with 3 tabs. In one of this tabs, when I click a button, a dialog box is open and I can click on some elements of this dialog. This piece of code is runing fine I also have Espresso tests in a test class. If I run the tests at the test class level, all tests pass OK.
I have now migrated the viewpager to viewpager2.
The app runs fine
If I play each test separately, the test passes OK
If I run the tests at the test class level, the first test passes OK, but all the next ones fail.
Any idea of what is happening and how to fix it?