How to use the chai-nightwatch.Assertion function in chai-nightwatch

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-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 => {
github nightwatchjs / nightwatch / lib / api / expect.js View on Github external
var util = require('util');
var events = require('events');
var chai = require('chai-nightwatch');
var expect = chai.expect;
var ChaiAssertion = chai.Assertion;
var Q = require('q');
var flag = chai.flag;

module.exports = function(client) {
  var Protocol = require('./protocol.js')(client);
  var PresentAssertion = require('./expect/present.js');
  var AttributeAssertion = require('./expect/attribute.js');
  var CssAssertion = require('./expect/css.js');
  var TextAssertion = require('./expect/text.js');
  var EnabledAssertion = require('./expect/enabled.js');
  var VisibleAssertion = require('./expect/visible.js');
  var SelectedAssertion = require('./expect/selected.js');
  var TypeAssertion = require('./expect/type.js');
  var ValueAssertion = require('./expect/value.js');
  var Expect = {};

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