How to use chai-nightwatch - 10 common examples

To help you get started, we’ve selected a few chai-nightwatch 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 nightwatchjs / nightwatch / lib / api-loader / expect / url.js View on Github external
this.promise.catch(err => {
        if (!(this.instance instanceof chai.Assertion)) {
          this.emit('error', new Error('An error occurred while running .expect.url()'));
        }
      });
github nightwatchjs / nightwatch / lib / api-loader / expect / cookie.js View on Github external
this.promise.catch(err => {
        if (!(this.instance instanceof chai.Assertion)) {
          this.emit('error', new Error('An error occurred while running .expect.cookie()'));
        }
      });
github nightwatchjs / nightwatch / lib / api-loader / expect / _expect-loader.js View on Github external
this.promise.catch(err => {
        if (!(this.instance instanceof chai.Assertion)) {
          this.emit('error', new Error(promiseRejectedMsg));
        }
      });
github nightwatchjs / nightwatch / lib / api-loader / expect / title.js View on Github external
this.promise.catch(err => {
        if (!(this.instance instanceof chai.Assertion)) {
          this.emit('error', new Error('An error occurred while running .expect.title()'));
        }
      });
github nightwatchjs / nightwatch / lib / api / expect / assertions / _baseAssertion.js View on Github external
flag(key, value) {
    if (typeof value == 'undefined') {
      return flag(this.chaiExpect, key);
    }

    flag(this.chaiExpect, key, value);

    return this;
  }
github nightwatchjs / nightwatch / lib / api / expect / assertions / _baseAssertion.js View on Github external
flag(key, value) {
    if (typeof value == 'undefined') {
      return flag(this.chaiExpect, key);
    }

    flag(this.chaiExpect, key, value);

    return this;
  }
github nightwatchjs / nightwatch / lib / api / expect / _baseExpect.js View on Github external
flag(...args) {
    return chai.flag(this.instance, ...args);
  }
github nightwatchjs / nightwatch / lib / api-loader / expect-assertion.js View on Github external
const chai = require('chai-nightwatch');
const ChaiAssertion = chai.Assertion;
const BaseCommandLoader = require('./_base-loader.js');

const ChaiAssertionType = {
  PROPERTY: 'property',
  METHOD: 'method'
};

class ExpectAssertionLoader extends BaseCommandLoader {

  createAssertion(chaiAssert, args = []) {
    const nightwatchInstance = this.nightwatchInstance;

    class Assertion extends this.module {
      constructor() {
        super();
github nightwatchjs / nightwatch / lib / api-loader / api.js View on Github external
loadExpectAssertions(parent = null) {
    const chai = require('chai-nightwatch');
    const ChaiAssertion = chai.Assertion;
    const flag = chai.flag;

    ChaiAssertion.addMethod('before', function(ms) {
      flag(this, 'waitFor', ms);
      flag(this, 'before', true);
    });

    ChaiAssertion.addMethod('after', function(ms) {
      flag(this, 'after', true);
      flag(this, 'waitFor', ms);
    });

    this.loadStaticExpect(parent);

    let expectLoaders = fs.readdirSync(ApiLoader.ExpectLoadersPath);
    expectLoaders = expectLoaders.filter(fileName => {

chai-nightwatch

This is a trimmed down version of Chai to support Nightwatch.js related assertions.

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Similar packages