How to use the wd.Asserter 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 / functional / android / gpsdemos / location-specs.js View on Github external
it('should set geo location @skip-ci', function (done) {

    var getText = function () {
      return driver
        .elementsByClassName("android.widget.TextView")
        .then(function (els) {
          return els[1].text();
        });
    };

    var textPopulated = new Asserter(
      function () {
        return getText().then(function (text) {
          if (text === 'GPS Tutorial') {
            var err = new Error('retry');
            err.retriable = true; // if an asserter throws an error with the `retriable` property set to true, it gets retried
            throw err;
          } else {
            return true;
          }
        });
      }
    );

    var newLat = "27.17";
    var newLong = "78.04";
github appium / appium / test / functional / common / webview-base.js View on Github external
it('should not display a phishing warning with safariIgnoreFraudWarning', function (done) {
      if (isChrome) return _skip(
        "Chrome doesn't test safariIgnoreFraudWarning", done);
      var titleToBecomeRight = new wd.Asserter(function (driver) {
        return driver
          .title()
          .should.eventually.contain("I am another page title");
      });
      driver
        .get(env.TEST_END_POINT + 'guinea-pig2.html')
        .waitFor(titleToBecomeRight, 10000, 500)
        .nodeify(done);
    });
    it('should be able to get performance logs', function (done) {
github appium / appium / test / functional / android / apidemos / lock-specs.js View on Github external
var isLockedAsserter = function (opts) {
    return new Asserter(
      function (driver) {
        return driver
          .isLocked()
          .then(function (isLocked) {
            isLocked.should.equal(opts.expected);
            return isLocked;
          })
          .catch(function (err) {
            err.retriable = err instanceof chai.AssertionError;
            throw err;
          });
      }
    );
  };
github appium / appium-ios-driver / test / e2e / helpers / asserter.js View on Github external
function ChaiAsserter (assertFunc) {
  return new Asserter((driver) => assertFunc(driver).catch(tagChaiAssertionError));
}