I’m trying to test a react native app with the following test suite and cases:
Test case files:
- login.ts
- doActionAfterLogin_A.ts
Test suite:
[login.ts, doActionAfterLogin_A.ts]
Problem:
For login.ts I want to set the desired capability appium:noReset = false because I want to test the flow of the fresh install. However, I want to test doActionAfterLogin_A.ts with appium:noReset = true because I don’t want to go through the whole fresh installation flow again.
The problem is that in between test cases in the suite, Appium will close the browser/driver and launch again with the same desired capabilities, which in this case appium:noReset will always be false. Is there a way to either:
- Stop the browser/driver from closing in between test cases
- Change the desired capabilites in between test cases
- Is the way I’m structuring my test cases wrong?
Further info: Using Appium, Webdriverio, Mocha, Typescript
Thank you!
2
Answers
From my understanding, there is no way to change DesiredCapabilities in between an AppiumDriver session. But in your situation, I think it’s best to decouple your Appium setup from your .ts test scripts.
I set the driver capability values via system/env variables. I have a range of default values to fallback on if no system/env variable is found. But if I need to change one of the capabilities for a certain test, I make sure to set the system/env variable first.
Logic for each test would then be: