Closed osiris86 closed 3 years ago
I think you have a wrong vision on UI testing.
1) All test should be run independently or with random sequences with same expected results 2) Stateless running
A clear way how to solve this issue:
1) Use test runner which will be responsible for clear run every time
2) If you want to skip on-boarding screen you need to inject or pre setup some data before test will be executed. Look at TestRule
Hmm... I was sure UI tests need to work in the way you describe, what I don't get is why espresso isn't clearing the app state (i.e. the entire app data) between each test then. There is the clearPackageData argument for the testInstrumentationRunner, but that only clears the data after each test class and not after every test. imho that doesn't make sense if "All test should be run independently or with random sequences with same expected results", because not every test has the same starting point.
Anyway, to summarize: at the moment it isn't possible with Kakao.
In my test class I have multiple tests. For the first test I have to skip the onboarding of my app. So in the setup section of my test class I have a
Screen<OnboardingScreen>
with aKViewPager
that is selected via thewithResourceName
ViewMatcher.All tests in the test class except the first one now fail because the onboarding has already been skipped. So what I'd like to do in the setup section is to make the KViewPager optional so that I can check in the code whether or not it exists.
Is that possible with Kakao? Didn't find anything in the docs about that.