28 lines
889 B
TypeScript
28 lines
889 B
TypeScript
// ***********************************************************
|
|
// This support file is processed and loaded automatically
|
|
// before your test files.
|
|
//
|
|
// This is a great place to put global configuration and
|
|
// behavior that modifies Cypress.
|
|
// ***********************************************************
|
|
|
|
import './commands';
|
|
|
|
// Clear application state before each test
|
|
beforeEach(() => {
|
|
cy.window().then((win) => {
|
|
// Clear localStorage
|
|
win.localStorage.clear();
|
|
// Clear sessionStorage
|
|
win.sessionStorage.clear();
|
|
// Clear IndexedDB if available
|
|
if (win.indexedDB && typeof win.indexedDB.databases === 'function') {
|
|
win.indexedDB.databases().then((dbs: any[]) => {
|
|
dbs.forEach(db => {
|
|
win.indexedDB.deleteDatabase(db.name);
|
|
});
|
|
});
|
|
}
|
|
});
|
|
});
|