How to stay logged in between multiple tests in Appium?

I’m testing a website in Chrome using Python, Appium, Android Emulator and trying to figure out how to stay logged in between multiple tests. The most common answer to similar questions I found is to add --user-data-dir option so I wrote the following:

options.add_argument(‘–user-data-dir=/data/data/com.android.chrome/app_chrome/Profile’)

According to chrome://version it changed profile path to /data/data/com.android.chrome/app_chrome/Profile/Default but still each time a driver instance is created that directory is restored to its default state.

Answering Appium - running browser tests without clearing browser data one person states that “Chromedriver always starts totally fresh, nothing is keeping” while another person from Using selenium: How to keep logged in after closing Driver in Python confirms that in case of OSX “it worked perfectly fine, I don’t need to login again”.

I also encountered Appium Reset Strategies and tried to add the following to desired capabilities with no luck:

desired_caps[‘noReset’] = ‘true’
desired_caps[‘fullReset’] = ‘false’

Why you need this?
Imagine your test fails and you stay on any random fail screen. Your next action with next test is?

I do understand your point. It’s valid 100%. But the reason I ask for help is not because I suck at design.

I think - You should looks how to fix this from selenium side.

Something like:

Please look at Using selenium: How to keep logged in after closing Driver in Python. In that thread two guys confirm that similar setup works for them with Selenium on OSX and Windows. That’s the reason I think it’s either Appium or Android issue.

Works on desktop as documented so it’s definitely not Selenium or Chromedriver.

I’ve found a way to achieve required functionality. In case anyone is interested check out this reply on SO.