-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When appium starts it prevents the initialisation of a RealmDB #793
Comments
The initialization should be proper place. Probably your app under test does not work with Espresso framework (by Google) with current implementation. |
@KazuCocoa Thanks a lot for your quick response. I sincerely hope I did not misunderstand you. |
hm, thank you. The app start itself as same as vanilla espresso does since Appium espresso driver itself does not launch the app under test. Espresso framework does.
Do your code do something in the Espresso test code side? |
thank you. Our code does not do anything to the Espresso test code side. |
This espresso driver starts with appium-espresso-driver/lib/espresso-runner.js Lines 231 to 243 in 2d78337
I haven't used Realm, but when is https://github.com/realm/realm-kotlin/blob/4fb30d70e0a7ef671d98c47249079bbaf8a9b764/packages/library-base/src/androidMain/kotlin/io/realm/kotlin/internal/platform/RealmInitializer.kt#L35 called? |
The RealmInitializer is called in the AndroidManifest.xml
|
Should the Manifest in the espresso's apk one? So, should the android test package also have it? |
Sorry for the long delay. Thank you for the suggestion KazuCocoa. We try to include as much of the dependencies as we could and also tried to bring the Manifest into the Automation Suite. |
mm, then, potentially should https://github.com/appium/appium-espresso-driver/blob/master/espresso-server/app/src/androidTest/java/io/appium/espressoserver/EspressoServerRunnerTest.kt#L64 have something for RealmDB usage...? |
By adding the realm dependency to the espresso build config the generated espresso apk's Manifest will contain the Initializer, but it still won't get called. It also needs to be mentioned that this issue is not limited to the RealmDB. With Appium-Espresso none of the androidx.startup.Initializers from the Manifest will get called. I was able to recreate this on multiple apps that use other App Startup Initializers. To name two:
All these apps are fine when started normally.
AppInitializer.getInstance(applicationContext).initializeComponent(RealmInitializer::class.java) but I think it would be much more feasible if Initializers would also work in the documented way with Appium Espresso.
I'm not deep enough into the matter to help, but sure, support for App Startup in general would be nice. |
I checked the code that starts the app in ActivityHelpers and I do not see anything that could cause this. Could this be an issue of Androidx Startup itself? This ticket seems related: https://issuetracker.google.com/issues/230844558 |
hm, thank for the informatin |
The Problem
When starting the Andoird App via Appium, the driver terminates with the message: "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: A new session could not be created."
logcat shows following issue: "Caused by: kotlin.UninitializedPropertyAccessException: lateinit property filesDir has not been initialized"
From our point of view it seems like the Android app gets started in a way, the prevents or fails the initialisation of the realmDB.
Environment
Android App
Test automation
### Details
logcat output:
The text was updated successfully, but these errors were encountered: