Skip to content

Add Unit Test for logging into app #410

@Sheeri

Description

@Sheeri

Is your feature request related to a problem? Please describe.
We would like to start adding unit tests for components in our app.

Describe the solution you'd like:
Add gradle or fastlane tests to test logging into the app.

How to test the tests:
Build with a nonexistent realm-app-id (e.g. realm-app-id=abcd). It will build with no problems, but when attempting to login, the user sees "Invalid username and password" and the output shows:

D/Login: Cannot log in. Error cannot find app using Client App ID 'abcd'

Build with the sandbox realm-app-id and login. When attempting to login, it works,

D/REALM_JAVA: HTTP Request = 
    POST https://realm.mongodb.com/api/client/v2.0/app/REALM-APP-ID/auth/providers/local-userpass/login
    Accept: application/json
    Content-Type: application/json;charset=utf-8
    {"password":"***","provider":"local-userpass","username":"***","options":{"device":{"appVersion":"1","appId":"REALM-APP-ID","platform":"android","platformVersion":"9","sdkVersion":"10.0.0-BETA.6"}}}

Additional Context:
Our app/build.gradle includes testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions