refactor: change opening hours handling

fix: opening hours not updating
feat: lazy-load opening hours module
feat: add e2e tests for opening hours
refactor: migrate opening hours to on-push change detection
feat: show exact minutes in opening hours starting one hour before next change
This commit is contained in:
2023-09-14 16:17:39 +02:00
parent a5c9d22016
commit a99e08cd68
24 changed files with 475 additions and 274 deletions

View File

@@ -31,36 +31,24 @@
// When a command from ./commands is ready to use, import with `import './commands'` syntax
// import './commands';
beforeEach(async function () {
let databases: string[];
if (window.indexedDB.databases) {
databases = (await window.indexedDB.databases()).map(it => it.name);
console.log('Trying to clear all databases');
} else {
console.log("Browser doesn't support database enumeration, deleting just ionic storage");
databases = ['_ionicstorage'];
}
for (const database of databases) {
if (database) {
console.log(`Deleting database ${database}`);
await new Promise(resolve => (window.indexedDB.deleteDatabase(database).onsuccess = resolve));
console.log(`Deleted database ${database}`);
}
}
beforeEach(function () {
cy.wrap(
new Promise(resolve => {
window.indexedDB.deleteDatabase('_ionicstorage').onsuccess = resolve;
}),
);
});
Cypress.on('window:before:load', window => {
// Fake that user is using its browser in german language
// Fake that user is using its browser in German
Object.defineProperty(window.navigator, 'language', {value: 'de-DE'});
Object.defineProperty(window.navigator, 'languages', [{value: 'de-DE'}]);
// Fail tests on console error
cy.stub(window.console, 'error').callsFake(message => {
// log out to the terminal
cy.now('task', 'error', message);
// log to Command Log and fail the test
throw new Error(message);
});
cy.spy(window.console, 'error').as('consoleError');
});
afterEach(function () {
cy.get('@consoleError').should('not.have.been.called');
});
Cypress.on('uncaught:exception', error => {