scottschafer / cypressautomocker

cypress-based library for capturing APIs and replaying them as mocks
131 stars 17 forks source link

addEventListener is missing in XHRRequest mock #7

Open skiraikou opened 6 years ago

skiraikou commented 6 years ago

We were trying to use it in ng6 app test But got error regarding missing addEventListener method

i was able to fix it using

addEventListener: function(callback) {
        this.object.addEventListener(callback);
    }
chauey commented 5 years ago

This might be what I'm looking for to get past the error with Angular about "ERROR TypeError: xhr.addEventListener is not a function"

Will try it out, thx!

joenguyenalogent commented 5 years ago

something like this in installCypressHooks.js at line 329 inside FakeXMLHttpRequest.prototype?

addEventListener: function(type, callback) { this.object.addEventListener(type, callback); },

removeEventListener: function(type, callback) { this.object.removeEventListener(type, callback); }

ivanpadavan commented 4 years ago

installCypressHooks.js 330 add this['on' + type] = callback; to make it work in angular app

23