GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Run Tests on Android Real Device · Issue #284 · NativeScript/nativescript-dev-appium

Run Tests on Android Real Device #284

New issue
Copy link
New issue
Copy link
Open
Open
Run Tests on Android Real Device#284
Copy link

Description

@coderaven
coderaven
opened on Mar 16, 2020
Issue body actions

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).

Activity

  1. setrar commented on Dec 6, 2020

    @setrar
    setrar
    on Dec 6, 2020
    More actions

    📱 On Android

    📍 Real Device: Set deviceToken property to the appium.capabilities to Device Identifier

    $ ns devices
    Connected devices & emulators
    Searching for devices...
    ┌───┬──────────────┬──────────┬───────────────────┬────────┬───────────┬─────────────────┐
    │ # │ Device Name  │ Platform │ Device Identifier │ Type   │ Status    │ Connection Type │
    │ 1 │ nyc4xlwifiyy │ Android  │ R52N94D54BK       │ Device │ Connected │ USB             │
    └───┴──────────────┴──────────┴───────────────────┴────────┴───────────┴─────────────────┘
    
    • Edit appium.capabilities.json file
       "android29": {
            "platformName": "Android",
            "platformVersion": "29",
            "deviceToken": "R52N94D54BK",
            "lt": 60000,
            "newCommandTimeout": 720,
            "noReset": true,
            "fullReset": false,
            "app": ""
        },
    
    • Run the test
    $ npm run e2e -- --runType android29
    

    📱 On iPhone

    It's more complicated since you have to Sign and Install the WebDriverAgent first and then run the test.

    I am trying to do the same but I am having an issue with #287 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.