Is it possible to mock an jQuery.ajax request (which gets called because of Kendo UI's Datasource) in an AngularJs app via Protractor?
Used Script/Framework etc
- Protractor
- jQuery
- jsdom
- Mockjax
I tried with following script (without the ajax request get mocked)
var jsdom = require("jsdom");
var jQuery;
var mockjax;
jsdom.env("", function(err, window) {
if (err) { console.error(err); return; }
jQuery = require("../jquery-2.2.4.js")(window);
mockjax = require('../jquery.mockjax.js')(jQuery, window);
});
describe('Websuite: TemplateTest', function() {
beforeEach(function(){
jQuery.mockjax({ url: "/XYZ/GetMails" });
});
it('some mocking test', function() {
browser.get('https://localhost:44300/#/dat/templateTest');
browser.pause();
});
});
I am not even sure if it is even possible to mock an jQuery.ajax call in Protractor (like we did with $http & $httpBackend)