Created
January 23, 2014 09:56
-
-
Save abruzzi/8575889 to your computer and use it in GitHub Desktop.
Jasmine-jsonpath
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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