-
-
Notifications
You must be signed in to change notification settings - Fork 197
application.android.startActivity and foregroundActivity are undefined in unit tests #4922
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
Comments
After cloning your repository and executing Maybe you have some outdated git ignored files locally. Could you try cloning the provided repository in a new folder and running the test again? |
Thanks for the additional details. We were able to reproduce the issue. It's caused by a wrong version of The issue is already fixed in
|
Changing the version of |
Environment
Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project):Describe the bug
import * as application from 'tns-core-modules/application';
application.android.startActivity
andapplication.android.foregroundActivity
are undefined in unit tests, not even after a few seconds after the app starts.The problem is huge, because it affects all functionality that needs user permissions, as an activity is needed to request or check permissions on Android.
To Reproduce
Create an app from scratch:
tns create MyApp
tns test init
Write a test to check if application.android.startAcitivity or application.android.foregroundActivity exist.
Example: https://github.com/adrian-niculescu/NativeScriptUnitTestDemo/blob/master/app/tests/example.ts#L24
Expected behavior
application.android.startActivity
andapplication.android.foregroundActivity
to be defined.Sample project
Sample project
It was created with:
tns create MyApp
tns test init
then added this mocha test
The text was updated successfully, but these errors were encountered: