appium-boilerplate: I can't run local android test

Hello, I have done :

  • clone repo (master branch)
  • put Android-NativeDemoApp-0.4.0.apk on folder ./apps
  • run npm install
  • trial run “npm run android.app”

But : Screen Shot 2022-03-11 at 14 54 34

This is My wdio.android.app.conf.ts

import { join } from 'path';
import config from './wdio.shared.local.appium.conf';

// ============
// Specs
// ============
config.specs = [
    './tests/specs/**/app*.spec.ts',
];

// ============
// Capabilities
// ============
// For all capabilities please check
// http://appium.io/docs/en/writing-running-appium/caps/#general-capabilities
config.capabilities = [
    {
        // The defaults you need to have in your config
        platformName: 'Android',
        maxInstances: 1,
        // For W3C the appium capabilities need to have an extension prefix
        // http://appium.io/docs/en/writing-running-appium/caps/
        // This is `appium:` for all Appium Capabilities which can be found here
        'appium:deviceName': 'device',
        //'appium:udid' : 'emulator-5554',
        'appium:platformVersion': '11.0',
        'appium:orientation': 'PORTRAIT',
        'appium:automationName': 'UiAutomator2',
        // The path to the app
        'appium:app': join(process.cwd(), './apps/Android-NativeDemoApp-0.4.0.apk'),
        // @ts-ignore
        'appium:appWaitActivity': 'com.wdiodemoapp.MainActivity',
        // Read the reset strategies very well, they differ per platform, see
        // http://appium.io/docs/en/writing-running-appium/other/reset-strategies/
        'appium:noReset': true,
        'appium:newCommandTimeout': 240,
    },
];

exports.config = config;

Environment (please complete the following information):

  • Node.js version: [17.6.0]
  • NPM version: [8.5.1]
  • Platform: [Android]
  • Platform version: [11.0]
  • Appium Desktop version : [1.22.x]
  • Emulator/Simulator/Real Device: [Emulator]

Please help and give me best practice to run test

Thank You

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (11 by maintainers)

Most upvoted comments

Hi @samaysimantbarik

Thanks for your response, but what did you change to make it work now? Your code and my code look the same, except for the log-property.

The new Appium Inspector uses a different basePath then a normal Appium server (Appium 1.x versions) would spin up. By default Appium Server uses /wd/hub/, but it needs to be /. If you’ve installed Appium globally then you can then start a server with this

appium --base / --relaxed-security --log-timestamp

Where:

  • appium is the start-server command
  • --base / tells Appium to use / instead of the default /wd/hub basePath
  • --relaxed-security means to automatically download the ChromeDriver (amongst other things, see this)
  • --log-timestamp adds a nice timestamp to the logs

Running this will give this give the following logs

appium --base / --relaxed-security --log-timestamp
2022-05-23 05:17:02:697 - [Appium] Welcome to Appium v1.22.3
2022-05-23 05:17:02:699 - [Appium] Non-default server args:
2022-05-23 05:17:02:699 - [Appium]   basePath: /
2022-05-23 05:17:02:700 - [Appium]   logTimestamp: true
2022-05-23 05:17:02:700 - [Appium]   relaxedSecurityEnabled: true
2022-05-23 05:17:02:725 - [Appium] Appium REST http interface listener started on 0.0.0.0:4723

As you can see it will automatically start on port 4723, also the port that Appium Inspector uses.

I’m going to close this issue now because this is not related to this boilerplate anymore, but it’s still open for conversation