Is there a way to NOT execute beforeEach function only for certain tests ('it' blocks).
I have a protractor clean up file with an aftereach function that is supposed to run after each and every test cases. Is there a way to not execute them for certain test cases('it' blocks).
afterEach(() => {
common.performance.captureMemory();
replay.cleanReplay();
dialog.cleanupDialog(); // Will also close search page source selector dialog if open
pinboards.closeVizContextIfOpen();
common.util.dismissNotificationIfPresent();
formula.closeFormulaEditorIfOpen();
common.util.ensureLoggedInAsDefaultUser();
common.util.clearStickerSelection();
common.util._uniqueNameSeed = -1;
});
I tried this:
global.defaultJasmineAfterEach = () => {
common.performance.captureMemory();
replay.cleanReplay();
dialog.cleanupDialog(); // Will also close search page source selector dialog if open
pinboards.closeVizContextIfOpen();
common.util.dismissNotificationIfPresent();
formula.closeFormulaEditorIfOpen();
common.util.ensureLoggedInAsDefaultUser();
common.util.clearStickerSelection();
common.util._uniqueNameSeed = -1;
};
global.overrideAfterEachOnce = (fn) => {
global.jasmineAfterEach = fn;
};
global.jasmineAfterEach = defaultJasmineAfterEach;
// This beforeEach block will run after every test, we use this to perform some cleanup that might
// be necessary before next test can run.
afterEach(() => {
global.jasmineAfterEach();
if (global.jasmineAfterEach !== global.defaultJasmineAfterEach) {
global.jasmineAfterEach = global.defaultJasmineAfterEach();
}
});```
Thanks in advance. :)