When writing tests with JasmineJS I have many tests that have similar beforeEach/afterEach code.
Is there a way to implement an inheritance model using JasmineJS tes
If you want to do this for all your suites, you can register a beforeEach
or afterEach
function in the topSuite
:
jasmine.getEnv().topSuite().beforeEach({fn: function() {
//log in as admin
}});
If you only want to apply it on some suites, you can work with sub-suites:
describe("as_admin", function() {
beforeEach(function() {
//log in as admin
});
describe('Services Page',function() {...});
describe('Administrators Page',function() {...});
}