Created
March 19, 2015 22:35
-
-
Save eojthebrave/5e733250bbcd3fdf0c69 to your computer and use it in GitHub Desktop.
Skip external resources requested when running casperjs tests
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
casper.options.onResourceRequested = function(casper, requestData, request) { | |
// If any of these strings are found in the requested resource's URL, skip | |
// this request. These are not required for running tests. | |
var skip = [ | |
'.kissmetrics.com', | |
'googleads.g.doubleclick.net', | |
'www.googleadservices.com' | |
]; | |
skip.forEach(function(needle) { | |
if (requestData.url.indexOf(needle) > 0) { | |
request.abort(); | |
} | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment