Hello guys.
I want my application to be uninstalled and installed fresh when starting a new Appium session at the start of my test,and in between I want to restart my application (without deleting it) by calling driver.closeApp() followed by Driver.LaunchApp().(I want all these things to be happen in single Appium session)
Now I tried this using desiredcapabilities:FullReset=false and NoReset=true
but due to this,my application is getting restarted in between after calling driver.closeApp() followed by Driver.LaunchApp(),and it is not deleting my application too which is as per my expectations,but while starting Appium session at the start of the test,application will not get reinstalled because I have kept FullReset to False
If I want to achieve both i.e. Uninstalling/Installing while creating new Appium session at start of the test and in between test when I will close and relaunch app it should not delete/uninstall my application,which desiredcapabilities should I set?
Using a java client, the thing i will try is to:
1- Use NoReset=true
2- In the @After method i’ll use driver.closeApp() and driver.launchApp() (or driver.resetApp() that does both )
3- In the @AfterClass i’ll use driver.removeApp(“bundle”).
When Appium will start over again, it will detect that the application is not installed and will do this job for you.
Exception in thread "main" org.openqa.selenium.WebDriverException: undefined status object (WARNING: The server did not provide any stacktrace information)
and the appium log :
info: --> POST /wd/hub/session/71a4c5ca-92b5-4e94-99f5-f8a795671d82/appium/device/remove_app {"bundleId":"com.my.app"}
info: [debug] Responding to client with error: {"status":1,"value":{"message":"undefined status object"},"sessionId":"71a4c5ca-92b5-4e94-99f5-f8a795671d82"}
info: <-- POST /wd/hub/session/71a4c5ca-92b5-4e94-99f5-f8a795671d82/appium/device/remove_app 500 1.802 ms - 109
correct , but it seems that appium’s stuff has never confirmed it … moreover , the documentation doesnt mention it as well…
The exception which is thrown is meaningless
So if I understand correctly , there is no way to achieve the requested scenario which is being described above ?
I want to restart the app several times without full reset during the tests execution and at the end of the execution to remove it from the device , just as @sam_viz has described
In your solution you are initializing the driver at the beginning of the execution and you cannot change the driver’s setting while it’s already running , am I right ?
We do almost same as you described except remove.
Just inside test when you started driver without FullReset do again driver.quit and open driver again without FullReset. This will restart application.
To remove application at the end do driver.quit then open driver with FullReset and do driver.quit. This will remove application from device.
@Aleksei I’ve tried your solution , and it works , (I even can uses driver.resetApp instead of driver.quit and creation new session) but one thing which was required on my side to be added is the “noReset” capability to be set to false , otherwise it didn’t work for me…
driver.resetApp - does not help with our application cause we store some data that not deleted in this case. that is why i gave 100% working solution with client reinstall via opening driver in fullReset mode.
actually it doesn’t matter rather you use resetApp or just driver.quit …
The thing is that I was needed to add “noReset” in order to make it work …
Hi @Aleksei
Implemented your solution.And it is satisfying my requirement.It requires creation of two sessions though.
Whatever solution we apply.We can not do it in single session.
Hi @Aleksei, @Pranodayd
Above solution - is it feasible while running in grid. I don’t star the appium server in code since we are running against grid nodes. How can I achieve while running against grid ?
Note: Grid nodes would always run with --full-reset flag since these nodes are common across different teams in our organisation. So, I dont want to disturb that flag in grid.
At the same time, when It is starting for the first time - I would like to start with full reset. However in between tests I would like to restart the app to ensure clean state.
–full-reset false [DEPRECATED] - (iOS) Delete the entire simulator folder. (Android) Reset app state by uninstalling app instead of clearing app data. On Android, this will also remove the app after the session is complete.