How to use the wd.addPromiseChainMethod 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 Strider-CD / strider / test / runner.js View on Github external
describe('Strider', function () {
  this.timeout(20000);

  // TESTS
  var tests = (
    process.env.TEST_SUITE ?
    [ './integration/'+process.env.TEST_SUITE+'.js' ] :
    [ './integration/build_page_test.js'
    , './integration/login_test.js'
    , './integration/global_admin_test.js'
    //, './integration/github_test.js'
    , './integration/branch_management_test.js'
  ]);

  wd.addPromiseChainMethod('rel', function (url, cb) {
    return this.get('http://localhost:4000' + url, cb);
  });

  var runTests = function (conn, doneBrowser) {
    var commands = [];

    async.each(tests, function (suite, cb) {
      var browser = wd.promiseChainRemote(remote);
      browser.on('status', function (info) {
        console.log(info);
      });
      browser.on('command', function (meth, path, data) {
        if (meth && path && data) commands.push([' command > ' + meth, path, JSON.stringify(data || '')].join(' '));
      });
      browser.on('error', function (info) {
        console.log(info);
github ustwo / ustwo.com-frontend / test / integration / sanity.js View on Github external
const jobOpenings = 'WE\'RE HIRING';
const joinSlug = 'join';
const joinURL = baseURL + '/join-us';
const workURL = baseURL + '/work';
const workItem = '.page-work .work-item';
const workReadmore = 'Read more';
const workSlug = 'work';
const sandboxURL = baseURL + '/sandbox';
const sandboxComponentList = 'body > ol';
const sandboxComponentName = 'blog';
const sandboxSlug = 'sandbox';
const badURL = baseURL + '/blog/press/asdf';
const page404 = '.page-404';

// helpers
wd.addPromiseChainMethod('openPageByMenuLink', (linkText) => {
  return browser
    .elementByCss(navigationToggle)
    .isDisplayed()
    .then((isDisplayed) => {
      if (isDisplayed) {
        console.log('We have a mobile menu so need to open it first...');
        return browser
          .elementByCss(navigationToggle)
          .click()
          .waitForElementByPartialLinkText(linkText.toUpperCase(), 5000)
          .click();
      } else {
        console.log('We are on desktop resolution now, no need to open mobile menu!');
        return browser
          .elementByPartialLinkText(linkText)
          .click();
github cliqz-oss / browser-android / spec / helpers / setup.js View on Github external
var wd = require("wd")
  utils = require('./utils');

require('colors');
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
var actions = require("./actions");
chai.use(chaiAsPromised);
var should = chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;

wd.addPromiseChainMethod('dismissGoogleServicesDialog', utils.dismissGoogleServicesDialog);
wd.addPromiseChainMethod('findWindowWithTitle', utils.findWindowWithTitle);
wd.addPromiseChainMethod('swipe', actions.swipe);
wd.addPromiseChainMethod('clearSearchBar', utils.clearSearchBar);
exports.should = should;
github cliqz-oss / browser-android / spec / helpers / setup.js View on Github external
var wd = require("wd")
  utils = require('./utils');

require('colors');
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
var actions = require("./actions");
chai.use(chaiAsPromised);
var should = chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;

wd.addPromiseChainMethod('dismissGoogleServicesDialog', utils.dismissGoogleServicesDialog);
wd.addPromiseChainMethod('findWindowWithTitle', utils.findWindowWithTitle);
wd.addPromiseChainMethod('swipe', actions.swipe);
wd.addPromiseChainMethod('clearSearchBar', utils.clearSearchBar);
exports.should = should;
github cliqz-oss / browser-android / spec / helpers / setup.js View on Github external
var wd = require("wd")
  utils = require('./utils');

require('colors');
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
var actions = require("./actions");
chai.use(chaiAsPromised);
var should = chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;

wd.addPromiseChainMethod('dismissGoogleServicesDialog', utils.dismissGoogleServicesDialog);
wd.addPromiseChainMethod('findWindowWithTitle', utils.findWindowWithTitle);
wd.addPromiseChainMethod('swipe', actions.swipe);
wd.addPromiseChainMethod('clearSearchBar', utils.clearSearchBar);
exports.should = should;
github appium / appium / sample-code / examples / node / ios-actions.js View on Github external
"use strict";

require("./helpers/setup");

var wd = require("wd"),
    _ = require('underscore'),
    actions = require("./helpers/actions"),
    serverConfigs = require('./helpers/appium-servers');

wd.addPromiseChainMethod('swipe', actions.swipe);
wd.addPromiseChainMethod('pinch', actions.pinch);
wd.addElementPromiseChainMethod('pinch',
  function () { return this.browser.pinch(this); });
wd.addPromiseChainMethod('zoom', actions.zoom);
wd.addElementPromiseChainMethod('zoom',
  function () { return this.browser.zoom(this); });

describe("ios actions", function () {
  this.timeout(300000);
  var driver;
  var allPassed = true;

  before(function () {
    var serverConfig = process.env.SAUCE ?
      serverConfigs.sauce : serverConfigs.local;
    driver = wd.promiseChainRemote(serverConfig);
    require("./helpers/logging").configure(driver);
github jlipps / yiewd / lib / yiewd.js View on Github external
if (this._yiewd_sauce === null) {
    throw new Error("Status reporting is for Sauce Labs tests");
  }
  return Q.nfcall( this._yiewd_sauce.updateJob.bind(this._yiewd_sauce),
    this.sessionID , {passed: passed});
});

wd.addPromiseChainMethod('reportPass', function() {
  return this.reportStatus(true);
});

wd.addPromiseChainMethod('reportFail', function() {
  return this.reportStatus(false);
});

wd.addPromiseChainMethod('sauceInfo', function() {
  if (this._yiewd_sauce === null) {
    throw new Error("Showing job info is for Sauce Labs tests");
  }
  return Q.nfcall(
    this._yiewd_sauce.showJob.bind(this._yiewd_sauce), this.sessionID);
});

yiewd.remote = function() {
  var args = apsc(arguments);
  var d = wd.promiseChainRemote.apply(wd, args);
  d.defaultChainingScope = 'element';
  d.run = function(gen) { return monocle.run(gen, d); };
  return d;
};

var _setSauceCreds = function(driver, userName, accessKey, host) {
github jlipps / yiewd / lib / yiewd.js View on Github external
var yiewd = module.exports = {};

wd.addPromiseChainMethod('reportStatus', function(passed) {
  if (this._yiewd_sauce === null) {
    throw new Error("Status reporting is for Sauce Labs tests");
  }
  return Q.nfcall( this._yiewd_sauce.updateJob.bind(this._yiewd_sauce),
    this.sessionID , {passed: passed});
});

wd.addPromiseChainMethod('reportPass', function() {
  return this.reportStatus(true);
});

wd.addPromiseChainMethod('reportFail', function() {
  return this.reportStatus(false);
});

wd.addPromiseChainMethod('sauceInfo', function() {
  if (this._yiewd_sauce === null) {
    throw new Error("Showing job info is for Sauce Labs tests");
  }
  return Q.nfcall(
    this._yiewd_sauce.showJob.bind(this._yiewd_sauce), this.sessionID);
});

yiewd.remote = function() {
  var args = apsc(arguments);
  var d = wd.promiseChainRemote.apply(wd, args);
  d.defaultChainingScope = 'element';
  d.run = function(gen) { return monocle.run(gen, d); };
github appium / appium / sample-code / examples / node / android-complex.js View on Github external
"use strict";

require("./helpers/setup");

var wd = require("wd"),
    _ = require('underscore'),
    actions = require("./helpers/actions"),
    serverConfigs = require('./helpers/appium-servers'),
    _p = require('./helpers/promise-utils'),
    Q = require('q');

wd.addPromiseChainMethod('swipe', actions.swipe);

describe("android complex", function () {
  this.timeout(300000);
  var driver;
  var allPassed = true;

  before(function () {
    var serverConfig = process.env.SAUCE ?
      serverConfigs.sauce : serverConfigs.local;
    driver = wd.promiseChainRemote(serverConfig);
    require("./helpers/logging").configure(driver);

    var desired = process.env.SAUCE ?
      _.clone(require("./helpers/caps").android18) :
      _.clone(require("./helpers/caps").android19);
    desired.app = require("./helpers/apps").androidApiDemos;
github appium / appium / sample-code / examples / node / ios-actions.js View on Github external
"use strict";

require("./helpers/setup");

var wd = require("wd"),
    _ = require('underscore'),
    actions = require("./helpers/actions"),
    serverConfigs = require('./helpers/appium-servers');

wd.addPromiseChainMethod('swipe', actions.swipe);
wd.addPromiseChainMethod('pinch', actions.pinch);
wd.addElementPromiseChainMethod('pinch',
  function () { return this.browser.pinch(this); });
wd.addPromiseChainMethod('zoom', actions.zoom);
wd.addElementPromiseChainMethod('zoom',
  function () { return this.browser.zoom(this); });

describe("ios actions", function () {
  this.timeout(300000);
  var driver;
  var allPassed = true;

  before(function () {
    var serverConfig = process.env.SAUCE ?
      serverConfigs.sauce : serverConfigs.local;
    driver = wd.promiseChainRemote(serverConfig);
    require("./helpers/logging").configure(driver);

    var desired = _.clone(require("./helpers/caps").ios71);
    desired.app = require("./helpers/apps").iosTestApp;