mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 10:20:29 -06:00
28b336ac80
* remove toggle * remove code not behind toggle * remove old MegaMenu * rename DockedMegaMenu -> MegaMenu and clean up go code * fix backend test * run yarn i18n:extract * fix some unit tests * fix remaining unit tests * fix remaining e2e/unit tests
72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
import { e2e } from '../utils';
|
|
|
|
const APP_ID = 'sandbox-app-test';
|
|
|
|
describe('Datasource sandbox', () => {
|
|
before(() => {
|
|
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'), true);
|
|
cy.request({
|
|
url: `${Cypress.env('BASE_URL')}/api/plugins/${APP_ID}/settings`,
|
|
method: 'POST',
|
|
body: {
|
|
enabled: true,
|
|
},
|
|
});
|
|
});
|
|
beforeEach(() => {
|
|
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'), true);
|
|
});
|
|
|
|
describe('App Page', () => {
|
|
describe('Sandbox disabled', () => {
|
|
beforeEach(() => {
|
|
cy.window().then((win) => {
|
|
win.localStorage.setItem('grafana.featureToggles', 'pluginsFrontendSandbox=0');
|
|
});
|
|
});
|
|
|
|
it('Loads the app page without the sandbox div wrapper', () => {
|
|
cy.visit(`/a/${APP_ID}`);
|
|
cy.wait(200); // wait to prevent false positives because cypress checks too fast
|
|
cy.get('div[data-plugin-sandbox="sandbox-app-test"]').should('not.exist');
|
|
cy.get('div[data-testid="sandbox-app-test-page-one"]').should('exist');
|
|
});
|
|
|
|
it('Loads the app configuration without the sandbox div wrapper', () => {
|
|
cy.visit(`/plugins/${APP_ID}`);
|
|
cy.wait(200); // wait to prevent false positives because cypress checks too fast
|
|
cy.get('div[data-plugin-sandbox="sandbox-app-test"]').should('not.exist');
|
|
cy.get('div[data-testid="sandbox-app-test-config-page"]').should('exist');
|
|
});
|
|
});
|
|
|
|
describe('Sandbox enabled', () => {
|
|
beforeEach(() => {
|
|
cy.window().then((win) => {
|
|
win.localStorage.setItem('grafana.featureToggles', 'pluginsFrontendSandbox=1');
|
|
});
|
|
});
|
|
|
|
it('Loads the app page with the sandbox div wrapper', () => {
|
|
cy.visit(`/a/${APP_ID}`);
|
|
cy.get('div[data-plugin-sandbox="sandbox-app-test"]').should('exist');
|
|
cy.get('div[data-testid="sandbox-app-test-page-one"]').should('exist');
|
|
});
|
|
|
|
it('Loads the app configuration with the sandbox div wrapper', () => {
|
|
cy.visit(`/plugins/${APP_ID}`);
|
|
cy.get('div[data-plugin-sandbox="sandbox-app-test"]').should('exist');
|
|
cy.get('div[data-testid="sandbox-app-test-config-page"]').should('exist');
|
|
});
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
e2e.flows.revertAllChanges();
|
|
});
|
|
|
|
after(() => {
|
|
cy.clearCookies();
|
|
});
|
|
});
|