How to use the appium-adb function in appium-adb

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-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()
github appium / appium-android-driver / test / unit / webview-helper-specs.js View on Github external
describe('Webview Helpers', function () {
  let adb = new ADB();

  afterEach(function () {
    sandbox.restore();
  });

  describe('procFromWebview', function () {
    const webview = 'WEBVIEW_123';
    const pkg = 'io.appium.android.apis';

    it('should get package name when all fields are filled', async function () {
      sandbox.stub(adb, 'shell').callsFake(function () {
        return 'USER           PID  PPID     VSZ    RSS WCHAN            ADDR S NAME\n' +
               'root             1     0    9948   2344 SyS_epoll_wait      0 S init\n' +
               'root             2     0       0      0 kthreadd            0 S [kthreadd]\n' +
               'root             3     2       0      0 smpboot_thread_fn   0 S [ksoftirqd/0]\n' +
               'root             5     2       0      0 worker_thread       0 S [kworker/0:0H]\n' +
github appium / appium-android-driver / test / unit / commands / actions-specs.js View on Github external
beforeEach(function () {
    driver = new AndroidDriver();
    driver.adb = new ADB();
    driver.bootstrap = new Bootstrap();
    sandbox.stub(driver.bootstrap, 'sendAction');
  });
  afterEach(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 = {};

      sandbox.stub(driver, 'setupNewChromedriver').returns({
        on: _.noop,
        proxyReq: _.noop,
      });
      sandbox.stub(driver, 'dismissChromeWelcome');
    });
    afterEach(function () {
github appium / appium-uiautomator2-driver / test / unit / commands / network-specs.js View on Github external
beforeEach(async function () {
      driver = new AndroidUiautomator2Driver();
      driver.adb = new ADB();
      sandbox.stub(driver, 'getNetworkConnection');
      sandbox.stub(driver, 'wrapBootstrapDisconnect', async (fn) => {
        await fn();
      });
      sandbox.stub(driver.adb, 'setAirplaneMode');
      sandbox.stub(driver.adb, 'broadcastAirplaneMode');
      sandbox.stub(driver, 'setWifiState');
      sandbox.stub(driver.adb, 'setDataState');
    });
    afterEach(function () {

appium-adb

Android Debug Bridge interface

Apache-2.0
Latest version published 4 days ago

Package Health Score

83 / 100
Full package analysis