mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* fix some e2e flows types * some type fixes * must... fix... more... * MOAR * MOREMOREMORE * 1 more
18 lines
562 B
TypeScript
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));
|