Skip to content

Instantly share code, notes, and snippets.

@abruzzi
Created January 23, 2014 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abruzzi/8575889 to your computer and use it in GitHub Desktop.
Save abruzzi/8575889 to your computer and use it in GitHub Desktop.
Jasmine-jsonpath
(function (jasmine, jsonPath) {
'use strict';
jasmine.getNodeByPath = function(obj, path, arg) {
return jsonPath(obj, path, arg);
};
beforeEach(function() {
this.addMatchers({
toHasJsonPath: function(path) {
var actual = this.actual;
var result = jsonPath(actual, path);
this.message = function() {
return 'Expected '+ JSON.stringify(actual, null, 2) +' to has path ' + path;
};
return result || result === null;
}
});
});
}(jasmine, jsonPath));
https://www.exratione.com/2013/12/angularjs-headless-end-to-end-testing-with-protractor-and-selenium/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment