Can't open an app without logging out and deleting the cache

I’m testing an app that has a log in and then a tutorial only on the first time its used.
After that it should be logged in and no tutorial, but every time I open the app (even if i just open it and don’t install it) it deletes the cache and I have to log in and go through the tutorial all over again.
Is there a way to quit/ enter the app with all the cache?
I should mention that manually this works as I want it to.

Further investigation shows that it clears some of the app’s data
image

I entered the app, logged in and moved a few windows in the tutorial, then closed the app.
After this I entered the app manually and saw that I was logged in and that the app opened in the correct place where I left off. I went to the app’s info in the settings and saw that it holds 12kb in cache and 1.03mb in app data.
I then opened the app via appium and it return to the login form, I closed the app and saw the app data amount went down from 1.03mb to 632kb.

My desired capabilities look like this:
{
“platformName”: “Android”,
“platformVersion”: “6.0.1”,
“deviceName”: “Nexus 5”,
“appPackage”: “app”,
“appActivity”: “activity”,
"noReset ": “true”
}

1 Like

if i understood the issue correctly, you dont want the cache to be cleared every time you launched the app. In that case you have set noReset as false, true make to clear or reset app every time.

This didn’t make sense to me (if noReset is true its sounds appium should NOT reset),
but I tried it anyways and it didn’t work.
Any more ideas?

hmm ok alternatively you can use startactivity method. first check in your app is there any activities are present for starting the app. you can get this info by using aapt (this file is part of adb software)

aapt dump badging <yourapp_full_path>

then try to use in your test case

driver.startActivity(<app_Package>, <start_appActivity>);

basically here you have to use other activity than the one you are using for installing app

We have a loader type activity that shows up every time you start the app (whether its for the first time or not). I call this activity. When trying to call the activity that comes after that I get:

Encountered internal error running command: Error: Error occured while starting App. Original error: Permission to start activity denied.

by adding below line in manifest file after unzipping the apk file should resolve permission denied issue.

android:exported=“true”

Ok that didn’t work.
What did work was to hold the driver while closing and opening the app. like this:

driver.close_app()
driver.start_activity(app, activity)

Now I’ll have to make my code hold the driver between tests and not close and open it each test.

I still think that there is a bug in appium in the way that if I start a driver and just open the app it does not act the same way as it would if I was to open the app manually.