Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.promise.catch(err => {
if (!(this.instance instanceof chai.Assertion)) {
this.emit('error', new Error('An error occurred while running .expect.url()'));
}
});
this.promise.catch(err => {
if (!(this.instance instanceof chai.Assertion)) {
this.emit('error', new Error('An error occurred while running .expect.cookie()'));
}
});
this.promise.catch(err => {
if (!(this.instance instanceof chai.Assertion)) {
this.emit('error', new Error(promiseRejectedMsg));
}
});
this.promise.catch(err => {
if (!(this.instance instanceof chai.Assertion)) {
this.emit('error', new Error('An error occurred while running .expect.title()'));
}
});
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();
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 => {
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 = {};