2023-09-08 10:51:59 -05:00
|
|
|
import { e2e } from '../utils';
|
2020-04-24 05:51:38 -05:00
|
|
|
|
2021-05-05 06:19:14 -05:00
|
|
|
const PANEL_UNDER_TEST = 'Lines 500 data points';
|
2020-04-24 05:51:38 -05:00
|
|
|
|
2023-09-13 07:24:20 -05:00
|
|
|
describe('Panel edit tests', () => {
|
|
|
|
beforeEach(() => {
|
2023-09-27 05:33:00 -05:00
|
|
|
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
|
2023-09-13 07:24:20 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Tests various Panel edit scenarios', () => {
|
2023-09-11 05:20:54 -05:00
|
|
|
cy.intercept({
|
|
|
|
pathname: '/api/ds/query',
|
|
|
|
}).as('query');
|
2021-05-05 06:19:14 -05:00
|
|
|
e2e.flows.openDashboard({ uid: 'TkZXxlNG3' });
|
2023-09-11 05:20:54 -05:00
|
|
|
cy.wait('@query');
|
2020-04-24 05:51:38 -05:00
|
|
|
|
2023-04-14 02:11:15 -05:00
|
|
|
e2e.flows.openPanelMenuItem(e2e.flows.PanelMenuItems.Edit, PANEL_UNDER_TEST);
|
2020-04-24 05:51:38 -05: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 03:22:37 -06:00
|
|
|
e2e.components.TransformTab.content().should('not.exist');
|
2021-01-29 09:01:50 -06:00
|
|
|
e2e.components.AlertTab.content().should('not.exist');
|
2021-09-29 09:16:40 -05:00
|
|
|
e2e.components.PanelAlertTabContent.content().should('not.exist');
|
2020-04-24 05:51:38 -05: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 05:51:38 -05: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 05:51:38 -05:00
|
|
|
});
|
2023-12-01 14:08:54 -06:00
|
|
|
e2e.components.Transforms.addTransformationButton().scrollIntoView().should('be.visible');
|
2021-01-29 09:01:50 -06:00
|
|
|
e2e.components.QueryTab.content().should('not.exist');
|
|
|
|
e2e.components.AlertTab.content().should('not.exist');
|
2021-09-29 09:16:40 -05:00
|
|
|
e2e.components.PanelAlertTabContent.content().should('not.exist');
|
2020-04-24 05:51:38 -05:00
|
|
|
|
|
|
|
// Can change to Alerts tab (graph panel is the default vis so the alerts tab should be rendered)
|
2021-01-20 00:59:48 -06:00
|
|
|
e2e.components.Tab.title('Alert').should('be.visible').click();
|
2021-11-24 13:56:07 -06:00
|
|
|
e2e.components.Tab.active().should('have.text', 'Alert0'); // there's no alert so therefore Alert + 0
|
2022-02-08 03:00:58 -06:00
|
|
|
|
|
|
|
// Needs to be disabled until Grafana EE turns unified alerting on by default
|
|
|
|
// e2e.components.AlertTab.content().should('not.exist');
|
|
|
|
|
2021-01-29 09:01:50 -06:00
|
|
|
e2e.components.QueryTab.content().should('not.exist');
|
2020-12-01 03:22:37 -06:00
|
|
|
e2e.components.TransformTab.content().should('not.exist');
|
2022-02-08 03:00:58 -06: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 05:51:38 -05:00
|
|
|
|
2021-01-20 00:59:48 -06:00
|
|
|
e2e.components.Tab.title('Query').should('be.visible').click();
|
2020-04-24 05:51:38 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
// Panel sidebar is rendered open by default
|
|
|
|
e2e.components.PanelEditor.OptionsPane.content().should('be.visible');
|
|
|
|
|
|
|
|
// close options pane
|
2021-03-25 02:33:13 -05:00
|
|
|
e2e.components.PanelEditor.toggleVizOptions().click();
|
2021-01-29 09:01:50 -06:00
|
|
|
e2e.components.PanelEditor.OptionsPane.content().should('not.exist');
|
2020-04-24 05:51:38 -05:00
|
|
|
|
|
|
|
// open options pane
|
2021-03-25 02:33:13 -05:00
|
|
|
e2e.components.PanelEditor.toggleVizOptions().should('be.visible').click();
|
2020-04-24 05:51:38 -05:00
|
|
|
e2e.components.PanelEditor.OptionsPane.content().should('be.visible');
|
|
|
|
|
2021-05-05 06:19:14 -05:00
|
|
|
// Check that Time series is chosen
|
2021-03-25 02:33:13 -05:00
|
|
|
e2e.components.PanelEditor.toggleVizPicker().click();
|
2021-05-05 06:19:14 -05: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 05:51:38 -05:00
|
|
|
|
2021-05-07 10:09:06 -05:00
|
|
|
// Check that table view works
|
2023-04-06 02:07:41 -05:00
|
|
|
e2e.components.Panels.Panel.loadingBar().should('not.exist');
|
2021-05-07 10:09:06 -05: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 05:51:38 -05:00
|
|
|
// Change to Text panel
|
2021-01-20 00:59:48 -06:00
|
|
|
e2e.components.PluginVisualization.item('Text').scrollIntoView().should('be.visible').click();
|
2021-05-03 09:49:09 -05:00
|
|
|
e2e.components.PanelEditor.toggleVizPicker().should((e) => expect(e).to.contain('Text'));
|
2020-04-24 05:51:38 -05:00
|
|
|
|
|
|
|
// Data pane should not be rendered
|
2021-01-29 09:01:50 -06:00
|
|
|
e2e.components.PanelEditor.DataPane.content().should('not.exist');
|
2020-04-24 05:51:38 -05:00
|
|
|
|
|
|
|
// Change to Table panel
|
2021-03-25 02:33:13 -05:00
|
|
|
e2e.components.PanelEditor.toggleVizPicker().click();
|
2021-05-03 09:49:09 -05: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 02:33:13 -05:00
|
|
|
|
2020-04-24 05:51:38 -05: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 06:11:19 -05:00
|
|
|
e2e.components.PanelEditor.OptionsPane.fieldLabel('Table Show table header').should('be.visible');
|
2021-03-25 02:33:13 -05:00
|
|
|
e2e.components.PanelEditor.OptionsPane.fieldLabel('Table Column width').should('be.visible');
|
2023-09-13 07:24:20 -05:00
|
|
|
});
|
2020-04-24 05:51:38 -05:00
|
|
|
});
|