2023-04-26 15:21:41 -05:00
|
|
|
import { GrafanaBootConfig } from '@grafana/runtime';
|
|
|
|
|
2023-09-08 10:51:59 -05:00
|
|
|
import { e2e } from '../utils';
|
|
|
|
|
2023-09-13 07:24:20 -05:00
|
|
|
describe('Panels smokescreen', () => {
|
|
|
|
beforeEach(() => {
|
2023-09-27 05:33:00 -05:00
|
|
|
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'), false);
|
2023-09-13 07:24:20 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
|
|
|
e2e.flows.revertAllChanges();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Tests each panel type in the panel edit view to ensure no crash', () => {
|
2023-04-26 15:21:41 -05:00
|
|
|
e2e.flows.addDashboard();
|
|
|
|
|
|
|
|
// TODO: Try and use e2e.flows.addPanel() instead of block below
|
|
|
|
try {
|
2023-06-08 05:16:08 -05:00
|
|
|
e2e.components.PageToolbar.itemButton('Add button').should('be.visible');
|
|
|
|
e2e.components.PageToolbar.itemButton('Add button').click();
|
2023-04-26 15:21:41 -05:00
|
|
|
} catch (e) {
|
|
|
|
// Depending on the screen size, the "Add panel" button might be hidden
|
|
|
|
e2e.components.PageToolbar.item('Show more items').click();
|
2023-06-08 05:16:08 -05:00
|
|
|
e2e.components.PageToolbar.item('Add button').last().click();
|
2023-04-26 15:21:41 -05:00
|
|
|
}
|
|
|
|
e2e.pages.AddDashboard.itemButton('Add new visualization menu item').should('be.visible');
|
|
|
|
e2e.pages.AddDashboard.itemButton('Add new visualization menu item').click();
|
|
|
|
|
2023-09-11 05:20:54 -05:00
|
|
|
cy.window().then((win: Cypress.AUTWindow & { grafanaBootData: GrafanaBootConfig['bootData'] }) => {
|
|
|
|
// Loop through every panel type and ensure no crash
|
|
|
|
Object.entries(win.grafanaBootData.settings.panels).forEach(([_, panel]) => {
|
|
|
|
// TODO: Remove Flame Graph check as part of addressing #66803
|
|
|
|
if (!panel.hideFromList && panel.state !== 'deprecated') {
|
|
|
|
e2e.components.PanelEditor.toggleVizPicker().click();
|
|
|
|
e2e.components.PluginVisualization.item(panel.name).scrollIntoView().should('be.visible').click();
|
2023-04-26 15:21:41 -05:00
|
|
|
|
2023-09-11 05:20:54 -05:00
|
|
|
e2e.components.PanelEditor.toggleVizPicker().should((e) => expect(e).to.contain(panel.name));
|
|
|
|
// TODO: Come up with better check / better failure messaging to clearly indicate which panel failed
|
|
|
|
cy.contains('An unexpected error happened').should('not.exist');
|
|
|
|
}
|
2023-04-26 15:21:41 -05:00
|
|
|
});
|
2023-09-11 05:20:54 -05:00
|
|
|
});
|
2023-09-13 07:24:20 -05:00
|
|
|
});
|
2023-04-26 15:21:41 -05:00
|
|
|
});
|