mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 23:53:10 +08:00

* remove cy. wrapping as e2e(). * make trace-view-scrolling more stable and remove waits * improve stability more
22 lines
742 B
TypeScript
22 lines
742 B
TypeScript
import { e2e } from '../index';
|
|
|
|
// @todo this actually returns type `Cypress.Chainable`
|
|
const get = (key: string): any =>
|
|
cy.wrap({ getLocalStorage: () => localStorage.getItem(key) }, { log: false }).invoke('getLocalStorage');
|
|
|
|
// @todo this actually returns type `Cypress.Chainable`
|
|
export const getLocalStorage = (key: string): any =>
|
|
get(key).then((value: any) => {
|
|
if (value === null) {
|
|
return value;
|
|
} else {
|
|
return JSON.parse(value);
|
|
}
|
|
});
|
|
|
|
// @todo this actually returns type `Cypress.Chainable`
|
|
export const requireLocalStorage = (key: string): any =>
|
|
get(key) // `getLocalStorage()` would turn 'null' into `null`
|
|
.should('not.equal', null)
|
|
.then((value: any) => JSON.parse(value as string));
|