opitzconsulting / uitest.js

uitest.js is able to load a webpage into a frame, instrument that page and the javascript in that page (e.g. add additional scripts at the end of the document, ...) and execute actions on that page.
MIT License
67 stars 8 forks source link

Better error handling on general errors in the test window #4

Open tbosch opened 11 years ago

tbosch commented 11 years ago

Error event listener for general errors in iframes.

Something like this should do the trick (jasmine specific though...)

    var errors;
    uit.append(function (window, $) {
        window.onerror = function (event) {
            errors.push(event);
        };

    });
    beforeEach(function() {
        errors = [];
    });
    afterEach(function() {
        expect(errors).toEqual([]);
    });