How to use appium-adb - 10 common examples

To help you get started, we’ve selected a few appium-adb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium-uiautomator2-driver / test / functional / commands / keyboard / keyboard-e2e-specs.js View on Github external
describe('unicode', function () {
    let adb;
    if (!process.env.TESTOBJECT_E2E_TESTS) {
      adb = new ADB();
    }
    let initialIME;
    let driver;
    before(async function () {
      // save the initial ime so we can make sure it is restored
      if (adb) {
        initialIME = await adb.defaultIME();
        initialIME.should.not.eql('io.appium.settings/.UnicodeIME');
      }

      driver = await initSession(defaultUnicodeCaps);
    });
    after(async function () {
      await deleteSession();

      // make sure the IME has been restored
github appium / appium-uiautomator2-driver / test / functional / commands / strings-e2e-specs.js View on Github external
before(async function () {
      // Don't test ADB on test object
      if (process.env.TESTOBJECT_E2E_TESTS) {
        this.skip();
      }
      // restarting doesn't work on Android 7+
      adb = new ADB();
      initialLocale = await getLocale(adb);
    });
    afterEach(async function () {
github appium / appium-android-driver / test / unit / driver-specs.js View on Github external
beforeEach(function () {
      driver = new AndroidDriver();
      driver.adb = new ADB();
      driver.bootstrap = new helpers.bootstrap(driver.adb);
      driver.settings = { update () {} };
      driver.caps = {};

      // create a fake bootstrap because we can't mock
      // driver.bootstrap. in advance
      let fakeBootstrap = {
        start () {},
        onUnexpectedShutdown: {catch () {}}
      };

      sandbox.stub(helpers, 'initDevice');
      sandbox.stub(helpers, 'unlock');
      sandbox.stub(helpers, 'bootstrap').returns(fakeBootstrap);
      sandbox.stub(driver, 'initAUT');
      sandbox.stub(driver, 'startAUT');
github appium / appium-android-driver / test / functional / commands / url-e2e-specs.js View on Github external
before(async function () {
    if (process.env.TRAVIS) return this.skip(); // eslint-disable-line curly

    let adb = new ADB();
    if (!await adb.isAppInstalled('com.android.browser')) {
      if (!await adb.isAppInstalled('com.android.chrome')) {
        throw new Error('Neither default browser nor chrome available');
      }
      // `browser` is not available, so use `Chrome`
      caps.browserName = 'Chrome';
      urlId = 'com.android.chrome:id/url_bar';
    }

    driver = new AndroidDriver();
    await driver.createSession(caps);
  });
  after(async function () {
github appium / appium-uiautomator2-driver / test / functional / driver-e2e-specs.js View on Github external
async function killServer (adbPort) {
  if (!process.env.TESTOBJECT_E2E_TESTS) {
    let adb = await ADB.createADB({adbPort});
    await adb.killServer();
    if (process.env.CI) {
      // on Travis this takes a while to get into a good state
      await B.delay(10000);
    }
  }
}
github appium / appium-uiautomator2-driver / test / functional / helpers / session.js View on Github external
async function initSession (caps, adbPort) {
  if (TRAVIS && !CLOUD) {
    let adb = await ADB.createADB({adbPort});
    try {
      // on Travis, sometimes we get the keyboard dying and the screen stuck
      await adb.forceStop('com.android.inputmethod.latin');
      await adb.shell(['pm', 'clear', 'com.android.inputmethod.latin']);
    } catch (ign) {}
  }

  if (CLOUD) {
    // on cloud tests, we want to set the `name` capability
    if (!caps.name) {
      caps.name = process.env.SAUCE_JOB_NAME || process.env.TRAVIS_JOB_NUMBER || 'unnamed';
    }
  }

  // Create a WD driver
  const host = getHost();
github appium / appium / lib / devices / android / adb.js View on Github external
// Gets adb from npm package and setup logger
"use strict";

var ADB = require('appium-adb');

ADB.logger.init(require('../../server/logger').get('appium'));

module.exports = ADB;
github appium / appium-android-driver / lib / android-helpers.js View on Github external
// this list should be updated as ADB takes more arguments
  const {
    adbPort,
    suppressKillServer,
    remoteAdbHost,
    clearDeviceLogsOnStart,
    adbExecTimeout,
    useKeystore,
    keystorePath,
    keystorePassword,
    keyAlias,
    keyPassword,
    remoteAppsCacheLimit,
    buildToolsVersion,
  } = opts;
  return await ADB.createADB({
    adbPort,
    suppressKillServer,
    remoteAdbHost,
    clearDeviceLogsOnStart,
    adbExecTimeout,
    useKeystore,
    keystorePath,
    keystorePassword,
    keyAlias,
    keyPassword,
    remoteAppsCacheLimit,
    buildToolsVersion,
  });
};
github appium / appium-android-driver / test / unit / driver-specs.js View on Github external
describe('sharedPreferences', function () {
    driver = new AndroidDriver();
    let adb = new ADB();
    driver.adb = adb;
    let builder = new SharedPrefsBuilder();
    describe('should skip setting sharedPreferences', withMocks({driver}, (mocks) => {
      it('on undefined name', async function () {
        driver.opts.sharedPreferences = {};
        (await driver.setSharedPreferences()).should.be.false;
        mocks.driver.verify();
      });
    }));
    describe('should set sharedPreferences', withMocks({driver, adb, builder, fs}, (mocks) => {
      it('on defined sharedPreferences object', async function () {
        driver.opts.appPackage = 'io.appium.test';
        driver.opts.sharedPreferences = {
          name: 'com.appium.prefs',
          prefs: [{type: 'string', name: 'mystr', value: 'appium rocks!'}]
        };
github appium / appium-uiautomator2-driver / test / unit / uiautomator2-helper-specs.js View on Github external
describe('UiAutomator2 Driver Helpers', function () {
  const adb = new ADB();

  describe('ensureInternetPermissionForApp', withMocks({adb}, (mocks) => {
    const app = '/path/to/app.apk';
    afterEach(function () {
      mocks.verify();
    });
    it('should do nothing if app has internet perms', async function () {
      mocks.adb.expects('hasInternetPermissionFromManifest')
        .once()
        .withExactArgs(app)
        .returns(true);
      await helpers.ensureInternetPermissionForApp(adb, app);
    });
    it('should throw an error if app does not have internet perms', async function () {
      mocks.adb.expects('hasInternetPermissionFromManifest')
        .once()

appium-adb

Android Debug Bridge interface

Apache-2.0
Latest version published 5 days ago

Package Health Score

83 / 100
Full package analysis

Similar packages