How to use the wd.promiseChainRemote function in wd

To help you get started, we’ve selected a few wd 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 / test / helpers / driverblock.js View on Github external
_before(function(done) {
    if (onSauce && this.currentTest) {
      caps.name = this.currentTest.parent.title + " " + this.currentTest.title;
    }

    driverHolder.driver = wd.promiseChainRemote(host, port);

    if (process.env.VERBOSE) {
      driverHolder.driver.on('status', function(info) {
        console.log(info);
      });
      driverHolder.driver.on('command', function(meth, path, data) {
        console.log(' > ' + meth, path, data || '');
      });
    }

    driverHolder.driver
      .init(caps)
      .then(
        // ok
        function(sessionId) {
          driverHolder.sessionId = sessionId;
github wordpress-mobile / gutenberg-mobile / __device-tests__ / helpers / utils.js View on Github external
const setupDriver = async () => {
	const branch = process.env.CIRCLE_BRANCH || '';
	const safeBranchName = branch.replace( /\//g, '-' );
	if ( isLocalEnvironment() ) {
		try {
			appiumProcess = await AppiumLocal.start( localAppiumPort );
		} catch ( err ) {
			// Ignore error here, Appium is probably already running (Appium desktop has its own server for instance)
			// eslint-disable-next-line no-console
			console.log( 'Could not start Appium server', err.toString() );
		}
	}

	const serverConfig = isLocalEnvironment() ? serverConfigs.local : serverConfigs.sauce;
	const driver = wd.promiseChainRemote( serverConfig );

	let desiredCaps;
	if ( isAndroid() ) {
		desiredCaps = _.clone( android8 );
		if ( isLocalEnvironment() ) {
			desiredCaps.app = path.resolve( localAndroidAppPath );
			try {
				const androidVersion = childProcess
					.execSync( 'adb shell getprop ro.build.version.release' )
					.toString()
					.replace( /^\s+|\s+$/g, '' );
				delete desiredCaps.platformVersion;
				desiredCaps.deviceName = 'Android Emulator';
				// eslint-disable-next-line no-console
				console.log( 'Detected Android device running Android %s', androidVersion );
			} catch ( error ) {
github zs-zs / grunt-selenium-standalone / test / createClient.js View on Github external
var createClient = function createClient() {
	var res = wd.promiseChainRemote('localhost', process.env.LOCAL_SELENIUM_PORT || 4444)
		.init(automatedBrowsers.phantomjs.driver.config)
		.setWindowSize(1000, 1000) // do something
        .quit();
	return res;
};
github appium / appium / sample-code / examples / node / sauce-ios-mocha-raw.js View on Github external
before(function(done) {
    browser =  wd.promiseChainRemote(host, port, username, accessKey);
    // See whats going on
    browser.on('status', function(info) {
      console.log(info.cyan);
    });
    browser.on('command', function(meth, path, data) {
      console.log(' > ' + meth.yellow, path.grey, data || '');
    });

    browser
      .init(desired)
      .nodeify(done);
  });
github tsirlucas / PayIt / e2e / TabNavigation.e2e.js View on Github external
import wd from 'wd';
import config from '../e2e.config';

const port = 4723;
const driver = wd.promiseChainRemote('localhost', port);
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;

const tapElementByAccessibilityId = async (id) => {
  const button = await driver.elementByAccessibilityId(id);
  await button.tap();
};

describe('TabNavigation', () => {
  // timeout(200000)

  beforeAll(async () => {
    await driver.init(config);
    while (!await driver.hasElementByAccessibilityId('nav bar')) {
      await driver.sleep(1000); // wait for app to load
    }
  });
github rhiokim / haroopad / src / node_modules / pouchdb / bin / test-browser.js View on Github external
sauceConnectLauncher(options, function (err, process) {
    if (err) {
      console.error('Failed to connect to saucelabs');
      console.error(err);
      return process.exit(1);
    }
    sauceConnectProcess = process;
    sauceClient = wd.promiseChainRemote("localhost", 4445, username, accessKey);
    callback();
  });
}
github appium / appium / test / driver-e2e-specs.js View on Github external
it('should start and stop a session', async function () {
      let driver = wd.promiseChainRemote(TEST_HOST, TEST_PORT);
      let [sessionId] = await driver.init(caps);
      should.exist(sessionId);
      sessionId.should.be.a('string');
      await driver.quit();
      await driver.title().should.eventually.be.rejectedWith(/terminated/);
    });
github appium / appium / test / helpers / session.js View on Github external
module.exports.attachToSession = function (sessionId) {
  var browser = wd.promiseChainRemote(env.APPIUM_HOST, env.APPIUM_PORT, env.APPIUM_USERNAME, env.APPIUM_PASSWORD);
  browser.attach(sessionId);
  return browser;
};
github redgeoff / factoryng / bin / test-browser.js View on Github external
request(SELENIUM_HUB, function (err, resp) {
      if (resp && resp.statusCode === 200) {
        sauceClient = wd.promiseChainRemote();
        callback();
      } else {
        setTimeout(started, 1000);
      }
    });
  };