Skip to content

Run Tests on Android Real Device #284

Open
@coderaven

Description

@coderaven

Platform: Nativescript Angular

After the setup and initial test code generated, and editing the appium.capabilities.json to add my emulator properly, I was able to succesfully run my tests to the emulator.

However, I need to be able to run the tests to a real device connected via USB (Android).

  • Debugging is on

I added my test device details on the capabilities json as well, so the appium.capabilities.json looks like this now:

{
    "realme": {
        "platformName": "Android",
        "deviceName": "RMX1851",
        "udid": "a53b7a83",
        "noReset": false,
        "fullReset": false,
        "app": ""
    },
 "pixel": {
        "platformName": "Android",
        "platformVersion": "29",
        "deviceName": "Pixel_3a_API_29",
        "avd": "emulator-5554",
        "lt": 60000,
        "newCommandTimeout": 720,
        "noReset": false,
        "fullReset": false,
        "app": ""
    }

One for emulator and one for actual device. The emulator works just fine when running:
npm run e2e android

However, when I connect my actual device and run the same command. It will not be shown in the list of devices and the command defaults to the emulator as a fallback.

I managed to get it to try to run to my actual device by using this command instead:
npm run e2e -- --runType=realme --ignoreDeviceController --relaxedSecurity

I can confirm that it has now successfully installed the appium service on my device, but cannot move past running my app for testing. With these errors outputted:

Capabilities found at: ********
Automation name set to: UIAutomator1 
To change automation name, you need to set it in appium capabilities!
Available applications:  ["platforms/android/app/build/outputs/apk/debug/app-debug.apk"]
Pick first application:   "platforms/android/app/build/outputs/apk/debug/app-debug.apk"
Application full path: ****\platforms\android\app\build\outputs\apk\debug\app-debug.apk
Platform version is missing! It would be better to set it in order to use the correct device!     
Default device:  { name: 'RMX1851',
  platform: 'android',
  config: { density: undefined, offsetPixels: undefined } }
Server args:   ["-p","4723","--log-level","info","--relaxed-security"]
Started Server!
  sample scenario
before loging . . . .
Session info:  
undefined
Appium settings:  
Current version of appium doesn't support appium settings! 
{"message":"[execute(\"mobile: shell\",{\"command\":\"wm\",\"args\":[\"density\"]})] Not JSON response","data":"The URL '/wd/hub/session/execute' did not map to a valid resource"}
Retry launching appium driver!
Appium driver is NOT started! 
(node:10604) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated

Anyone has an idea how to run the tests properly on real devices? (Android / IOS).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions