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()'));
}
});
flag(key, value) {
if (typeof value == 'undefined') {
return flag(this.chaiExpect, key);
}
flag(this.chaiExpect, key, value);
return this;
}
getFlags() {
return flag(this.chaiExpect);
}
flag(key, value) {
if (typeof value == 'undefined') {
return flag(this.chaiExpect, key);
}
flag(this.chaiExpect, key, value);
return this;
}
flag(...args) {
return chai.flag(this.instance, ...args);
}
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 => {