Files
grafana/e2e/old-arch/utils/support/localStorage.ts
Ivan Ortega Alba 7bca69849f Dashboards: Enable scenes by default (#93818)
* Mark Scenes feature toggles as GA

* Move old arch e2e to a new folder

* Run E2E on scenes by default

* Upgrade e2e-selectors to ensure the tests in Playwright works
2024-09-30 10:49:02 +01:00

18 lines
562 B
TypeScript

// @todo this actually returns type `Cypress.Chainable`
const get = (key: string) =>
cy.wrap({ getLocalStorage: () => localStorage.getItem(key) }, { log: false }).invoke('getLocalStorage');
export const getLocalStorage = (key: string) =>
get(key).then((value) => {
if (value === null) {
return value;
} else {
return JSON.parse(value);
}
});
export const requireLocalStorage = (key: string) =>
get(key) // `getLocalStorage()` would turn 'null' into `null`
.should('not.equal', null)
.then((value) => JSON.parse(value));