2023-09-08 16:51:59 +01:00
|
|
|
import { e2e } from '../utils';
|
2020-04-24 12:51:38 +02:00
|
|
|
|
2021-05-05 13:19:14 +02:00
|
|
|
const PANEL_UNDER_TEST = 'Lines 500 data points';
|
2020-04-24 12:51:38 +02:00
|
|
|
|
2023-09-13 13:24:20 +01:00
|
|
|
describe('Panel edit tests', () => {
|
|
|
|
|
beforeEach(() => {
|
2023-09-27 11:33:00 +01:00
|
|
|
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
|
2023-09-13 13:24:20 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('Tests various Panel edit scenarios', () => {
|
2023-09-11 11:20:54 +01:00
|
|
|
cy.intercept({
|
|
|
|
|
pathname: '/api/ds/query',
|
|
|
|
|
}).as('query');
|
2021-05-05 13:19:14 +02:00
|
|
|
e2e.flows.openDashboard({ uid: 'TkZXxlNG3' });
|
2023-09-11 11:20:54 +01:00
|
|
|
cy.wait('@query');
|
2020-04-24 12:51:38 +02:00
|
|
|
|
2023-04-14 09:11:15 +02:00
|
|
|
e2e.flows.openPanelMenuItem(e2e.flows.PanelMenuItems.Edit, PANEL_UNDER_TEST);
|
2020-04-24 12:51:38 +02:00
|
|
|
|
|
|
|
|
// New panel editor opens when navigating from Panel menu
|
|
|
|
|
e2e.components.PanelEditor.General.content().should('be.visible');
|
|
|
|
|
|
|
|
|
|
// Queries tab is rendered and open by default
|
|
|
|
|
e2e.components.PanelEditor.DataPane.content()
|
|
|
|
|
.should('be.visible')
|
|
|
|
|
.within(() => {
|
|
|
|
|
e2e.components.Tab.title('Query').should('be.visible');
|
|
|
|
|
// data should be the active tab
|
|
|
|
|
e2e.components.Tab.active().within((li: JQuery<HTMLLIElement>) => {
|
|
|
|
|
expect(li.text()).equals('Query1'); // there's already a query so therefore Query + 1
|
|
|
|
|
});
|
|
|
|
|
e2e.components.QueryTab.content().should('be.visible');
|
2020-12-01 04:22:37 -05:00
|
|
|
e2e.components.TransformTab.content().should('not.exist');
|
2021-01-29 15:01:50 +00:00
|
|
|
e2e.components.AlertTab.content().should('not.exist');
|
2021-09-29 17:16:40 +03:00
|
|
|
e2e.components.PanelAlertTabContent.content().should('not.exist');
|
2020-04-24 12:51:38 +02:00
|
|
|
|
|
|
|
|
// Bottom pane tabs
|
|
|
|
|
// Can change to Transform tab
|
2023-10-04 14:24:21 -05:00
|
|
|
e2e.components.Tab.title('Transform data').should('be.visible').click();
|
2020-04-24 12:51:38 +02:00
|
|
|
e2e.components.Tab.active().within((li: JQuery<HTMLLIElement>) => {
|
2023-10-04 14:24:21 -05:00
|
|
|
expect(li.text()).equals('Transform data0'); // there's no transform so therefore Transform + 0
|
2020-04-24 12:51:38 +02:00
|
|
|
});
|
2021-01-20 07:59:48 +01:00
|
|
|
e2e.components.Transforms.card('Merge').scrollIntoView().should('be.visible');
|
2021-01-29 15:01:50 +00:00
|
|
|
e2e.components.QueryTab.content().should('not.exist');
|
|
|
|
|
e2e.components.AlertTab.content().should('not.exist');
|
2021-09-29 17:16:40 +03:00
|
|
|
e2e.components.PanelAlertTabContent.content().should('not.exist');
|
2020-04-24 12:51:38 +02:00
|
|
|
|
|
|
|
|
// Can change to Alerts tab (graph panel is the default vis so the alerts tab should be rendered)
|
2021-01-20 07:59:48 +01:00
|
|
|
e2e.components.Tab.title('Alert').should('be.visible').click();
|
2021-11-24 20:56:07 +01:00
|
|
|
e2e.components.Tab.active().should('have.text', 'Alert0'); // there's no alert so therefore Alert + 0
|
2022-02-08 10:00:58 +01:00
|
|
|
|
|
|
|
|
// Needs to be disabled until Grafana EE turns unified alerting on by default
|
|
|
|
|
// e2e.components.AlertTab.content().should('not.exist');
|
|
|
|
|
|
2021-01-29 15:01:50 +00:00
|
|
|
e2e.components.QueryTab.content().should('not.exist');
|
2020-12-01 04:22:37 -05:00
|
|
|
e2e.components.TransformTab.content().should('not.exist');
|
2022-02-08 10:00:58 +01:00
|
|
|
|
|
|
|
|
// Needs to be disabled until Grafana EE turns unified alerting on by default
|
|
|
|
|
// e2e.components.PanelAlertTabContent.content().should('exist');
|
|
|
|
|
// e2e.components.PanelAlertTabContent.content().should('be.visible');
|
2020-04-24 12:51:38 +02:00
|
|
|
|
2021-01-20 07:59:48 +01:00
|
|
|
e2e.components.Tab.title('Query').should('be.visible').click();
|
2020-04-24 12:51:38 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Panel sidebar is rendered open by default
|
|
|
|
|
e2e.components.PanelEditor.OptionsPane.content().should('be.visible');
|
|
|
|
|
|
|
|
|
|
// close options pane
|
2021-03-25 08:33:13 +01:00
|
|
|
e2e.components.PanelEditor.toggleVizOptions().click();
|
2021-01-29 15:01:50 +00:00
|
|
|
e2e.components.PanelEditor.OptionsPane.content().should('not.exist');
|
2020-04-24 12:51:38 +02:00
|
|
|
|
|
|
|
|
// open options pane
|
2021-03-25 08:33:13 +01:00
|
|
|
e2e.components.PanelEditor.toggleVizOptions().should('be.visible').click();
|
2020-04-24 12:51:38 +02:00
|
|
|
e2e.components.PanelEditor.OptionsPane.content().should('be.visible');
|
|
|
|
|
|
2021-05-05 13:19:14 +02:00
|
|
|
// Check that Time series is chosen
|
2021-03-25 08:33:13 +01:00
|
|
|
e2e.components.PanelEditor.toggleVizPicker().click();
|
2021-05-05 13:19:14 +02:00
|
|
|
e2e.components.PluginVisualization.item('Time series').should('be.visible');
|
|
|
|
|
e2e.components.PluginVisualization.current().should((e) => expect(e).to.contain('Time series'));
|
2020-04-24 12:51:38 +02:00
|
|
|
|
2021-05-07 17:09:06 +02:00
|
|
|
// Check that table view works
|
2023-04-06 09:07:41 +02:00
|
|
|
e2e.components.Panels.Panel.loadingBar().should('not.exist');
|
2021-05-07 17:09:06 +02:00
|
|
|
e2e.components.PanelEditor.toggleTableView().click({ force: true });
|
|
|
|
|
e2e.components.Panels.Visualization.Table.header()
|
|
|
|
|
.should('be.visible')
|
|
|
|
|
.within(() => {
|
|
|
|
|
cy.contains('A-series').should('be.visible');
|
|
|
|
|
});
|
|
|
|
|
|
2020-04-24 12:51:38 +02:00
|
|
|
// Change to Text panel
|
2021-01-20 07:59:48 +01:00
|
|
|
e2e.components.PluginVisualization.item('Text').scrollIntoView().should('be.visible').click();
|
2021-05-03 16:49:09 +02:00
|
|
|
e2e.components.PanelEditor.toggleVizPicker().should((e) => expect(e).to.contain('Text'));
|
2020-04-24 12:51:38 +02:00
|
|
|
|
|
|
|
|
// Data pane should not be rendered
|
2021-01-29 15:01:50 +00:00
|
|
|
e2e.components.PanelEditor.DataPane.content().should('not.exist');
|
2020-04-24 12:51:38 +02:00
|
|
|
|
|
|
|
|
// Change to Table panel
|
2021-03-25 08:33:13 +01:00
|
|
|
e2e.components.PanelEditor.toggleVizPicker().click();
|
2021-05-03 16:49:09 +02:00
|
|
|
e2e.components.PluginVisualization.item('Table').scrollIntoView().should('be.visible').click();
|
|
|
|
|
e2e.components.PanelEditor.toggleVizPicker().should((e) => expect(e).to.contain('Table'));
|
2021-03-25 08:33:13 +01:00
|
|
|
|
2020-04-24 12:51:38 +02:00
|
|
|
// Data pane should be rendered
|
|
|
|
|
e2e.components.PanelEditor.DataPane.content().should('be.visible');
|
|
|
|
|
|
|
|
|
|
// Field & Overrides tabs (need to switch to React based vis, i.e. Table)
|
2022-06-01 13:11:19 +02:00
|
|
|
e2e.components.PanelEditor.OptionsPane.fieldLabel('Table Show table header').should('be.visible');
|
2021-03-25 08:33:13 +01:00
|
|
|
e2e.components.PanelEditor.OptionsPane.fieldLabel('Table Column width').should('be.visible');
|
2023-09-13 13:24:20 +01:00
|
|
|
});
|
2020-04-24 12:51:38 +02:00
|
|
|
});
|