New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chai-webdriver

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-webdriver - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

63

lib/index.js

@@ -29,4 +29,17 @@ // Generated by CoffeeScript 1.7.1

});
chai.Assertion.addProperty('match', function() {
return utils.flag(this, 'match', true);
chai.Assertion.overwriteMethod('match', function(_super) {
return function(matcher, done) {
if (utils.flag(this, 'dom')) {
return assertElementExists(this._obj, (function(_this) {
return function() {
return $(_this._obj).getText().then(function(text) {
_this.assert(matcher.test(text), 'Expected element <#{this}> to match regular expression "#{exp}", but it contains "#{act}".', 'Expected element <#{this}> not to match regular expression "#{exp}"; it contains "#{act}".', matcher, text);
return typeof done === "function" ? done() : void 0;
});
};
})(this));
} else {
return _super.call(this, matcher);
}
};
});

@@ -41,5 +54,3 @@ chai.Assertion.addMethod('visible', function(done) {

_this.assert(condition, 'Expected #{this} to be visible but it is not', 'Expected #{this} to not be visible but it is');
if (typeof done === 'function') {
return done();
}
return typeof done === "function" ? done() : void 0;
};

@@ -73,5 +84,3 @@ })(this);

_this.assert(els.length === length, 'Expected #{this} to appear in the DOM #{exp} times, but it shows up #{act} times instead.', 'Expected #{this} not to appear in the DOM #{exp} times, but it does.', length, els.length);
if (typeof done === 'function') {
return done();
}
return typeof done === "function" ? done() : void 0;
};

@@ -87,12 +96,10 @@ })(this));

return $(_this._obj).getText().then(function(text) {
if (utils.flag(_this, 'contains')) {
if (matcher instanceof RegExp) {
_this.assert(matcher.test(text), 'Expected element <#{this}> to match regular expression "#{exp}", but it contains "#{act}".', 'Expected element <#{this}> not to match regular expression "#{exp}"; it contains "#{act}".', matcher, text);
} else if (utils.flag(_this, 'contains')) {
_this.assert(~text.indexOf(matcher), 'Expected element <#{this}> to contain text "#{exp}", but it contains "#{act}" instead.', 'Expected element <#{this}> not to contain text "#{exp}", but it contains "#{act}".', matcher, text);
} else if (utils.flag(_this, 'match')) {
_this.assert(matcher.test(text), 'Expected element <#{this}> to match regular expression "#{exp}", but it contains "#{act}".', 'Expected element <#{this}> not to match regular expression "#{exp}"; it contains "#{act}".', matcher, text);
} else {
_this.assert(text === matcher, 'Expected text of element <#{this}> to be "#{exp}", but it was "#{act}" instead.', 'Expected text of element <#{this}> not to be "#{exp}", but it was.', matcher, text);
}
if (typeof done === 'function') {
return done();
}
return typeof done === "function" ? done() : void 0;
});

@@ -110,5 +117,3 @@ };

_this.assert(style === value, "Expected " + property + " of element <" + _this._obj + "> to be '" + value + "', but it is '" + style + "'.", "Expected " + property + " of element <" + _this._obj + "> to not be '" + value + "', but it is.");
if (typeof done === 'function') {
return done();
}
return typeof done === "function" ? done() : void 0;
});

@@ -126,5 +131,3 @@ };

_this.assert(value === actualValue, "Expected value of element <" + _this._obj + "> to be '" + value + "', but it is '" + actualValue + "'.", "Expected value of element <" + _this._obj + "> to not be '" + value + "', but it is.");
if (typeof done === 'function') {
return done();
}
return typeof done === "function" ? done() : void 0;
});

@@ -142,5 +145,3 @@ };

_this.assert(disabled, 'Expected #{this} to be disabled but it is not', 'Expected #{this} to not be disabled but it is');
if (typeof done === 'function') {
return done();
}
return typeof done === "function" ? done() : void 0;
});

@@ -158,5 +159,3 @@ };

_this.assert(~classList.indexOf(value), "Expected " + classList + " to contain " + value + ", but it does not.");
if (typeof done === 'function') {
return done();
}
return typeof done === "function" ? done() : void 0;
});

@@ -176,11 +175,7 @@ };

_this.assert(typeof actual === 'string', "Expected attribute " + attribute + " of element <" + _this._obj + "> to exist", "Expected attribute " + attribute + " of element <" + _this._obj + "> to not exist");
if (typeof done === 'function') {
done();
}
return;
return typeof done === "function" ? done() : void 0;
} else {
_this.assert(actual === value, "Expected attribute " + attribute + " of element <" + _this._obj + "> to be '" + value + "', but it is '" + actual + "'.", "Expected attribute " + attribute + " of element <" + _this._obj + "> to not be '" + value + "', but it is.");
return typeof done === "function" ? done() : void 0;
}
_this.assert(actual === value, "Expected attribute " + attribute + " of element <" + _this._obj + "> to be '" + value + "', but it is '" + actual + "'.", "Expected attribute " + attribute + " of element <" + _this._obj + "> to not be '" + value + "', but it is.");
if (typeof done === 'function') {
return done();
}
});

@@ -187,0 +182,0 @@ };

{
"name": "chai-webdriver",
"version": "0.8.0",
"version": "0.9.0",
"description": "Build more expressive integration tests with some webdriver sugar for chai.js",

@@ -36,3 +36,4 @@ "main": "lib/index.js",

"mocha": "~1.17.0",
"phantomjs": "^1.9.7-1"
"phantomjs": "^1.9.7-1",
"coffee-errors": "^0.8.6"
},

@@ -43,2 +44,1 @@ "engines": {

}

@@ -25,4 +25,5 @@ # chai-webdriver [![Build Status](https://travis-ci.org/goodeggs/chai-webdriver.png)](https://travis-ci.org/goodeggs/chai-webdriver) [![Dependency Status](https://david-dm.org/goodeggs/chai-webdriver.png)](https://david-dm.org/goodeggs/chai-webdriver) [![NPM version](https://badge.fury.io/js/chai-webdriver.png)](http://badge.fury.io/js/chai-webdriver)

- `expect(selector).dom.to.have.text('string')` - Test the text value of the dom against supplied string. Exact matches only.
- `expect(selector).dom.to.contains.text('string')` - Test the text value of the dom against supplied string. Partial matches allowed.
- `expect(selector).dom.to.match.text(RegExp)` - Test the text value of the dom on the regular expression.
- `expect(selector).dom.to.contain.text('string')` - Test the text value of the dom against supplied string. Partial matches allowed.
- `expect(selector).dom.to.match(/regex/)` - Test the text value of the dom against the regular expression.
- `expect(selector).dom.to.have.text(/regex/)` - Test the text value of the dom against the regular expression. (Same as `match` above).
- `expect(selector).dom.to.be.visible()` - Check whether or not the element is being rendered

@@ -29,0 +30,0 @@ - `expect(selector).dom.to.be.disabled()` - Check whether or not the form element is disabled

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc