Chore: Remove panels-suite from cypress tests (#108709)

remove panels-suite from cypress tests
This commit is contained in:
Ashley Harrison
2025-07-30 09:15:01 +01:00
committed by GitHub
parent af066d2312
commit 664188b7e0
14 changed files with 251 additions and 876 deletions
+12
View File
@@ -408,6 +408,18 @@
/e2e/cloud-plugins-suite/ @grafana/partner-datasources
/e2e-playwright/ @grafana/grafana-frontend-platform
/e2e-playwright/dashboard-new-layouts @grafana/dashboards-squad
/e2e-playwright/panels-suite/dashlist.spec.ts @grafana/grafana-search-navigate-organise
/e2e-playwright/panels-suite/datagrid-data-change.spec.ts @grafana/dataviz-squad
/e2e-playwright/panels-suite/datagrid-editing-features.spec.ts @grafana/dataviz-squad
/e2e-playwright/panels-suite/frontend-sandbox-panel.spec.ts @grafana/plugins-platform-frontend
/e2e-playwright/panels-suite/geomap-layer-types.spec.ts @grafana/dataviz-squad
/e2e-playwright/panels-suite/geomap-map-controls.spec.ts @grafana/dataviz-squad
/e2e-playwright/panels-suite/geomap-spatial-operations-transform.spec.ts @grafana/dataviz-squad
/e2e-playwright/panels-suite/panelEdit_base.spec.ts @grafana/dashboards-squad
/e2e-playwright/panels-suite/panelEdit_queries.spec.ts @grafana/dashboards-squad
/e2e-playwright/panels-suite/panelEdit_transforms.spec.ts @grafana/datapro
/e2e-playwright/panels-suite/table-kitchenSink.spec.ts @grafana/dataviz-squad
/e2e-playwright/panels-suite/table-sparkline.spec.ts @grafana/dataviz-squad
/e2e-playwright/plugin-e2e/ @grafana/oss-big-tent @grafana/partner-datasources
/e2e-playwright/plugin-e2e/plugin-e2e-api-tests/ @grafana/plugins-platform-frontend
/e2e-playwright/test-plugins/grafana-extensionstest-app/ @grafana/plugins-platform-frontend
-2
View File
@@ -143,8 +143,6 @@ jobs:
path: e2e/various-suite
- suite: dashboards-suite
path: e2e/dashboards-suite
- suite: panels-suite
path: e2e/panels-suite
- suite: various-suite (old arch)
path: e2e/old-arch/various-suite
flags: --flags="--env dashboardScene=false"
@@ -0,0 +1,56 @@
import { test, expect } from '@grafana/plugin-e2e';
const DASHBOARD_ID = 'c01bf42b-b783-4447-a304-8554cee1843b';
const DATAGRID_SELECT_SERIES = 'Datagrid Select series';
test.use({
featureToggles: {
enableDatagridEditing: true,
},
});
// TODO enable this test when panel goes live
test.describe.skip(
'Datagrid data changes',
{
tag: ['@panels'],
},
() => {
test('Tests changing data in the grid', async ({ gotoDashboardPage, selectors, page }) => {
const dashboardPage = await gotoDashboardPage({
uid: DASHBOARD_ID,
queryParams: new URLSearchParams({ editPanel: '1' }),
});
// Check that the data is series A
await expect(
dashboardPage.getByGrafanaSelector(
selectors.components.PanelEditor.OptionsPane.fieldLabel(DATAGRID_SELECT_SERIES)
)
).toBeVisible();
await expect(page.getByTestId('glide-cell-2-0')).toHaveText('1');
await expect(page.getByTestId('glide-cell-2-1')).toHaveText('20');
await expect(page.getByTestId('glide-cell-2-2')).toHaveText('90');
// Change the series to B
const seriesInput = dashboardPage
.getByGrafanaSelector(selectors.components.PanelEditor.OptionsPane.fieldLabel(DATAGRID_SELECT_SERIES))
.locator('input');
await seriesInput.fill('B');
await seriesInput.press('Enter');
await expect(page.getByTestId('glide-cell-2-3')).toHaveText('30');
await expect(page.getByTestId('glide-cell-2-4')).toHaveText('40');
await expect(page.getByTestId('glide-cell-2-5')).toHaveText('50');
// Edit datagrid which triggers a snapshot query
await page.locator('.dvn-scroller').click({ position: { x: 200, y: 100 } });
await expect(page.getByTestId('glide-cell-2-1')).toHaveAttribute('aria-selected', 'true');
await page.keyboard.type('12');
await page.keyboard.press('Enter');
await page.getByTestId('data-testid Confirm Modal Danger Button').click();
await expect(page.getByTestId('query-editor-row')).toContainText('Snapshot');
});
}
);
@@ -0,0 +1,183 @@
import { test, expect } from '@grafana/plugin-e2e';
const DASHBOARD_ID = 'c01bf42b-b783-4447-a304-8554cee1843b';
const DATAGRID_CANVAS = 'data-grid-canvas';
test.use({
featureToggles: {
enableDatagridEditing: true,
},
});
// TODO enable this test when panel goes live
test.describe.skip(
'Datagrid data changes',
{
tag: ['@panels'],
},
() => {
test('Tests changing data in the grid', async ({ gotoDashboardPage, selectors, page }) => {
await gotoDashboardPage({
uid: DASHBOARD_ID,
queryParams: new URLSearchParams({ editPanel: '1' }),
});
// Edit datagrid which triggers a snapshot query
await page.locator('.dvn-scroller').click({ position: { x: 200, y: 100 } });
await expect(page.getByTestId('glide-cell-2-1')).toHaveAttribute('aria-selected', 'true');
await page.keyboard.type('123');
await page.keyboard.press('Enter');
await page.getByTestId('data-testid Confirm Modal Danger Button').click();
// Delete a cell
await page.locator('.dvn-scroller').click({ position: { x: 200, y: 200 } });
await page.keyboard.press('Delete');
await expect(page.getByTestId('glide-cell-2-4')).toHaveText('0');
// Delete a selection
await page.locator('.dvn-scroller').click({ position: { x: 50, y: 100 }, modifiers: ['Shift'] });
await page.keyboard.press('Delete');
await expect(page.getByTestId('glide-cell-2-3')).toHaveText('0');
await expect(page.getByTestId('glide-cell-2-2')).toHaveText('0');
await expect(page.getByTestId('glide-cell-2-1')).toHaveText('0');
await expect(page.getByTestId('glide-cell-2-0')).toHaveText('1');
await expect(page.getByTestId('glide-cell-1-3')).toHaveText('');
await expect(page.getByTestId('glide-cell-1-2')).toHaveText('');
await expect(page.getByTestId('glide-cell-1-1')).toHaveText('');
await expect(page.getByTestId('glide-cell-1-0')).not.toHaveText('');
// Clear column through context menu
await page.locator('.dvn-scroller').click({ button: 'right', position: { x: 200, y: 100 } });
await page.locator('[aria-label="Context menu"]').click({ position: { x: 100, y: 120 } }); // click clear column
await expect(page.getByTestId('glide-cell-2-0')).toHaveText('0');
await expect(page.getByTestId('glide-cell-2-4')).toHaveText('0');
// Clear row through context menu
await page.locator('.dvn-scroller').click({ position: { x: 200, y: 220 } });
await page.keyboard.type('1123');
await page.keyboard.press('Enter');
await page.locator('.dvn-scroller').click({ button: 'right', position: { x: 200, y: 220 } });
await page.locator('[aria-label="Context menu"]').click({ position: { x: 100, y: 100 } }); // click clear row
await expect(page.getByTestId('glide-cell-1-4')).toHaveText('');
await expect(page.getByTestId('glide-cell-2-4')).toHaveText('0');
// get the data back
await page.reload();
// Clear row through row selector
await page.locator('.dvn-scroller').click({ position: { x: 20, y: 190 } });
await page.locator('.dvn-scroller').click({ position: { x: 20, y: 90 }, modifiers: ['Shift'] }); // with shift to select all rows between clicks
await page.keyboard.press('Delete');
await page.getByTestId('data-testid Confirm Modal Danger Button').click();
await expect(page.getByTestId('glide-cell-1-4')).toHaveText('');
await expect(page.getByTestId('glide-cell-1-3')).toHaveText('');
await expect(page.getByTestId('glide-cell-1-2')).toHaveText('');
await expect(page.getByTestId('glide-cell-1-1')).toHaveText('');
await expect(page.getByTestId('glide-cell-2-4')).toHaveText('0');
await expect(page.getByTestId('glide-cell-2-3')).toHaveText('0');
await expect(page.getByTestId('glide-cell-2-2')).toHaveText('0');
await expect(page.getByTestId('glide-cell-2-1')).toHaveText('0');
await page.reload();
await page.locator('.dvn-scroller').click({ position: { x: 20, y: 190 } });
await page.locator('.dvn-scroller').click({ position: { x: 20, y: 90 }, modifiers: ['Meta'] }); // with cmd to select only clicked rows
await page.keyboard.press('Delete');
await page.getByTestId('data-testid Confirm Modal Danger Button').click();
await expect(page.getByTestId('glide-cell-1-1')).toHaveText('');
await expect(page.getByTestId('glide-cell-2-1')).toHaveText('0');
await expect(page.getByTestId('glide-cell-2-4')).toHaveText('0');
await expect(page.getByTestId('glide-cell-1-4')).toHaveText('');
// Remove all data
await page.locator('.dvn-scroller').click({ button: 'right', position: { x: 100, y: 100 } });
await page.locator('body').click({ position: { x: 150, y: 420 } });
await expect(page.getByTestId(DATAGRID_CANVAS).locator('th')).toHaveCount(0);
await page.reload();
// Delete column through header dropdown menu
await page.locator('.dvn-scroller').click({ position: { x: 250, y: 15 } }); // click header dropdown
await page.locator('body').click({ position: { x: 450, y: 420 } }); // click delete column
await page.getByTestId('data-testid Confirm Modal Danger Button').click();
await expect(page.getByTestId(DATAGRID_CANVAS).locator('th')).toHaveCount(1);
// Delete row through context menu
await page.locator('.dvn-scroller').click({ button: 'right', position: { x: 100, y: 100 } });
await page.locator('[aria-label="Context menu"]').click({ position: { x: 10, y: 10 } });
await expect(page.getByTestId(DATAGRID_CANVAS).locator('tbody tr')).toHaveCount(6); // there are 5 data rows + 1 for the add new row btns
// Delete rows through row selector
await page.locator('.dvn-scroller').click({ position: { x: 20, y: 190 } });
await page.locator('.dvn-scroller').click({ position: { x: 20, y: 90 }, modifiers: ['Shift'] }); // with shift to select all rows between clicks
await page.locator('.dvn-scroller').click({ button: 'right', position: { x: 100, y: 100 } });
await page.locator('[aria-label="Context menu"]').click({ position: { x: 10, y: 10 } });
await expect(page.getByTestId(DATAGRID_CANVAS).locator('tbody tr')).toHaveCount(2); // there are 1 data rows + 1 for the add new row btns
await page.reload();
await page.locator('.dvn-scroller').click({ position: { x: 20, y: 190 } });
await page.locator('.dvn-scroller').click({ position: { x: 20, y: 90 }, modifiers: ['Meta'] }); // with cmd to select only clicked rows
await page.locator('.dvn-scroller').click({ button: 'right', position: { x: 40, y: 90 } });
await page.locator('[aria-label="Context menu"]').click({ position: { x: 10, y: 10 } });
await page.getByTestId('data-testid Confirm Modal Danger Button').click();
await expect(page.getByTestId(DATAGRID_CANVAS).locator('tbody tr')).toHaveCount(5); // there are 5 data rows + 1 for the add new row btns
// Delete column through context menu
await page.locator('.dvn-scroller').click({ button: 'right', position: { x: 100, y: 100 } });
await page.locator('[aria-label="Context menu"]').click({ position: { x: 10, y: 50 } });
await expect(page.getByTestId(DATAGRID_CANVAS).locator('th')).toHaveCount(1);
await page.reload();
// Add a new column
await page.locator('body').click({ position: { x: 350, y: 200 } });
await page.keyboard.type('New Column');
await page.keyboard.press('Enter');
await page.getByTestId('data-testid Confirm Modal Danger Button').click();
await page.locator('body').click({ position: { x: 350, y: 230 } });
await page.keyboard.type('Value 1');
await page.keyboard.press('Enter');
await page.keyboard.type('Value 2');
await page.keyboard.press('Enter');
await page.keyboard.type('Value 3');
await page.keyboard.press('Enter');
await page.keyboard.type('Value 4');
await page.keyboard.press('Enter');
await page.keyboard.type('Value 5');
await page.keyboard.press('Enter');
await page.keyboard.type('Value 6');
await page.keyboard.press('Enter');
await expect(page.getByTestId(DATAGRID_CANVAS).locator('th')).toHaveCount(3);
// Rename a column
await page.locator('.dvn-scroller').click({ position: { x: 250, y: 15 } }); // click header dropdown
await page.locator('body').click({ position: { x: 450, y: 380 } });
await page.keyboard.press('Control+a'); // select all
await page.keyboard.press('Backspace');
await page.keyboard.type('Renamed column');
await page.keyboard.press('Enter');
await expect(page.getByTestId(DATAGRID_CANVAS).locator('th')).toContainText('Renamed column');
// Change column field type
await page.locator('.dvn-scroller').click({ position: { x: 310, y: 15 } });
await page.locator('[aria-label="Context menu"]').click({ position: { x: 50, y: 50 } });
await page.locator('.dvn-scroller').click({ position: { x: 200, y: 100 } });
await page.keyboard.type('Str Value');
await page.keyboard.press('Enter');
await expect(page.getByTestId(DATAGRID_CANVAS).locator('tr')).toContainText('Str Value');
// Select all rows through row selection
await page.locator('.dvn-scroller').click({ position: { x: 10, y: 10 } });
await expect(page.getByTestId(DATAGRID_CANVAS).locator('[aria-selected="true"]')).toHaveCount(6);
// Add a new row
await page.locator('.dvn-scroller').click({ position: { x: 200, y: 250 } });
await page.keyboard.type('123');
await page.locator('.dvn-scroller').click({ position: { x: 50, y: 250 } });
await page.keyboard.type('Val');
await page.keyboard.press('Enter');
await expect(page.getByTestId(DATAGRID_CANVAS).locator('tbody tr')).toContainText('Val');
await expect(page.getByTestId(DATAGRID_CANVAS).locator('tbody tr')).toHaveCount(8);
});
}
);
-41
View File
@@ -1,41 +0,0 @@
import { e2e } from '../utils';
const PAGE_UNDER_TEST = 'a6801696-cc53-4196-b1f9-2403e3909185/panel-tests-dashlist-variables';
describe('DashList panel', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
// this is to prevent the fix for https://github.com/grafana/grafana/issues/76800 from regressing
it('should pass current variable values correctly when `Include current template variable values` is set', () => {
e2e.flows.openDashboard({ uid: PAGE_UNDER_TEST });
// check the initial value of the urls contain the variable value correctly
e2e.components.Panels.Panel.title('Include time range and variables enabled')
.should('be.visible')
.within(() => {
cy.get('a').each(($el) => {
cy.wrap($el).should('have.attr', 'href').and('contain', 'var-server=A');
});
});
// update variable to b
e2e.pages.Dashboard.SubMenu.submenuItemLabels('server')
.parent()
.within(() => {
cy.get('input').click();
});
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('B').click();
// blur the dropdown
cy.get('body').click();
// check the urls are updated with the new variable value
e2e.components.Panels.Panel.title('Include time range and variables enabled')
.should('be.visible')
.within(() => {
cy.get('a').each(($el) => {
cy.wrap($el).should('have.attr', 'href').and('contain', 'var-server=B');
});
});
});
});
@@ -1,36 +0,0 @@
import { e2e } from '../utils';
const DASHBOARD_ID = 'c01bf42b-b783-4447-a304-8554cee1843b';
const DATAGRID_SELECT_SERIES = 'Datagrid Select series';
//TODO enable this test when panel goes live
describe.skip('Datagrid data changes', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Tests changing data in the grid', () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { editPanel: 1 } });
// Check that the data is series A
e2e.components.PanelEditor.OptionsPane.fieldLabel(DATAGRID_SELECT_SERIES).should('be.visible');
cy.get('[data-testid="glide-cell-2-0"]').should('have.text', '1');
cy.get('[data-testid="glide-cell-2-1"]').should('have.text', '20');
cy.get('[data-testid="glide-cell-2-2"]').should('have.text', '90');
// Change the series to B
e2e.components.PanelEditor.OptionsPane.fieldLabel(DATAGRID_SELECT_SERIES).find('input').type('B {enter}');
cy.get('[data-testid="glide-cell-2-3"]').should('have.text', '30');
cy.get('[data-testid="glide-cell-2-4"]').should('have.text', '40');
cy.get('[data-testid="glide-cell-2-5"]').should('have.text', '50');
// Edit datagrid which triggers a snapshot query
cy.get('.dvn-scroller').click(200, 100);
cy.get('[data-testid="glide-cell-2-1"]').should('have.attr', 'aria-selected', 'true');
cy.get('body').type('12{enter}', { delay: 500 });
cy.get('[data-testid="data-testid Confirm Modal Danger Button"]').click();
cy.get('[data-testid="query-editor-row"]').contains('Snapshot');
});
});
@@ -1,159 +0,0 @@
import { e2e } from '../utils';
const DASHBOARD_ID = 'c01bf42b-b783-4447-a304-8554cee1843b';
const DATAGRID_CANVAS = 'data-grid-canvas';
//TODO enable this test when panel goes live
describe.skip('Datagrid data changes', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Tests changing data in the grid', () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { editPanel: 1 } });
// Edit datagrid which triggers a snapshot query
cy.get('.dvn-scroller').click(200, 100);
cy.get('[data-testid="glide-cell-2-1"]').should('have.attr', 'aria-selected', 'true');
cy.get('body').type('123{enter}', { delay: 500 });
cy.get('[data-testid="data-testid Confirm Modal Danger Button"]').click();
// Delete a cell
cy.get('.dvn-scroller').click(200, 200);
cy.get('body').type('{del}');
cy.get('[data-testid="glide-cell-2-4"]').should('have.text', 0);
// Delete a selection
cy.get('.dvn-scroller').click(50, 100, { shiftKey: true });
cy.get('body').type('{del}');
cy.get('[data-testid="glide-cell-2-3"]').should('have.text', 0);
cy.get('[data-testid="glide-cell-2-2"]').should('have.text', 0);
cy.get('[data-testid="glide-cell-2-1"]').should('have.text', 0);
cy.get('[data-testid="glide-cell-2-0"]').should('have.text', 1);
cy.get('[data-testid="glide-cell-1-3"]').should('have.text', '');
cy.get('[data-testid="glide-cell-1-2"]').should('have.text', '');
cy.get('[data-testid="glide-cell-1-1"]').should('have.text', '');
cy.get('[data-testid="glide-cell-1-0"]').should('not.have.text', '');
// Clear column through context menu
cy.get('.dvn-scroller').rightclick(200, 100);
cy.get('[aria-label="Context menu"]').click(100, 120); // click clear column
cy.get('[data-testid="glide-cell-2-0"]').should('have.text', 0);
cy.get('[data-testid="glide-cell-2-4"]').should('have.text', 0);
// Clear row through context menu
cy.get('.dvn-scroller').click(200, 220);
cy.get('body').type('1123{enter}', { delay: 500 });
cy.get('.dvn-scroller').rightclick(200, 220);
cy.get('[aria-label="Context menu"]').click(100, 100); // click clear row
cy.get('[data-testid="glide-cell-1-4"]').should('have.text', '');
cy.get('[data-testid="glide-cell-2-4"]').should('have.text', 0);
// get the data back
cy.reload();
// Clear row through row selector
cy.get('.dvn-scroller').click(20, 190, { waitForAnimations: true });
cy.get('.dvn-scroller').click(20, 90, { shiftKey: true, waitForAnimations: true }); // with shift to select all rows between clicks
cy.get('body').type('{del}');
cy.get('[data-testid="data-testid Confirm Modal Danger Button"]').click();
cy.get('[data-testid="glide-cell-1-4"]').should('have.text', '');
cy.get('[data-testid="glide-cell-1-3"]').should('have.text', '');
cy.get('[data-testid="glide-cell-1-2"]').should('have.text', '');
cy.get('[data-testid="glide-cell-1-1"]').should('have.text', '');
cy.get('[data-testid="glide-cell-2-4"]').should('have.text', 0);
cy.get('[data-testid="glide-cell-2-3"]').should('have.text', 0);
cy.get('[data-testid="glide-cell-2-2"]').should('have.text', 0);
cy.get('[data-testid="glide-cell-2-1"]').should('have.text', 0);
cy.wait(1000);
cy.reload();
cy.get('.dvn-scroller').click(20, 190, { waitForAnimations: true });
cy.get('.dvn-scroller').click(20, 90, { commandKey: true, waitForAnimations: true }); // with cmd to select only clicked rows
cy.get('body').type('{del}');
cy.get('[data-testid="data-testid Confirm Modal Danger Button"]').click();
cy.get('[data-testid="glide-cell-1-1"]').should('have.text', '');
cy.get('[data-testid="glide-cell-2-1"]').should('have.text', 0);
cy.get('[data-testid="glide-cell-2-4"]').should('have.text', 0);
cy.get('[data-testid="glide-cell-1-4"]').should('have.text', '');
// Remove all data
cy.get('.dvn-scroller').rightclick(100, 100);
cy.get('body').click(150, 420);
cy.get(`[data-testid="${DATAGRID_CANVAS}"] th`).should('have.length', 0);
cy.reload();
// Delete column through header dropdown menu
cy.get('.dvn-scroller').click(250, 15); // click header dropdown
cy.get('body').click(450, 420); // click delete column
cy.get('[data-testid="data-testid Confirm Modal Danger Button"]').click();
cy.get(`[data-testid="${DATAGRID_CANVAS}"] th`).should('have.length', 1);
// Delete row through context menu
cy.get('.dvn-scroller').rightclick(100, 100);
cy.get('[aria-label="Context menu"]').click(10, 10);
cy.get(`[data-testid="${DATAGRID_CANVAS}"] tbody tr`).should('have.length', 6); // there are 5 data rows + 1 for the add new row btns
// Delete rows through row selector
cy.get('.dvn-scroller').click(20, 190, { waitForAnimations: true });
cy.get('.dvn-scroller').click(20, 90, { shiftKey: true, waitForAnimations: true }); // with shift to select all rows between clicks
cy.get('.dvn-scroller').rightclick(100, 100);
cy.get('[aria-label="Context menu"]').click(10, 10);
cy.get(`[data-testid="${DATAGRID_CANVAS}"] tbody tr`).should('have.length', 2); // there are 1 data rows + 1 for the add new row btns
cy.reload();
cy.get('.dvn-scroller').click(20, 190, { waitForAnimations: true });
cy.get('.dvn-scroller').click(20, 90, { commandKey: true, waitForAnimations: true }); // with shift to select all rows between clicks
cy.get('.dvn-scroller').rightclick(40, 90);
cy.get('[aria-label="Context menu"]').click(10, 10);
cy.get('[data-testid="data-testid Confirm Modal Danger Button"]').click();
cy.get(`[data-testid="${DATAGRID_CANVAS}"] tbody tr`).should('have.length', 5); // there are 5 data rows + 1 for the add new row btns
// Delete column through context menu
cy.get('.dvn-scroller').rightclick(100, 100);
cy.get('[aria-label="Context menu"]').click(10, 50);
cy.get(`[data-testid="${DATAGRID_CANVAS}"] th`).should('have.length', 1);
cy.reload();
cy.wait(3000);
// Add a new column
cy.get('body').click(350, 200).type('New Column{enter}');
cy.get('[data-testid="data-testid Confirm Modal Danger Button"]').click();
cy.get('body')
.click(350, 230)
.type('Value 1{enter}')
.type('Value 2{enter}')
.type('Value 3{enter}')
.type('Value 4{enter}')
.type('Value 5{enter}')
.type('Value 6{enter}');
cy.get(`[data-testid="${DATAGRID_CANVAS}"] th`).should('have.length', 3);
// Rename a column
cy.get('.dvn-scroller').click(250, 15); // click header dropdown
cy.get('body').click(450, 380).type('{selectall}{backspace}Renamed column{enter}');
cy.get(`[data-testid="${DATAGRID_CANVAS}"] th`).contains('Renamed column');
// Change column field type
cy.get('.dvn-scroller').click(310, 15);
cy.get('[aria-label="Context menu"]').click(50, 50);
cy.get('.dvn-scroller').click(200, 100);
cy.get('body').type('Str Value{enter}');
cy.get(`[data-testid="${DATAGRID_CANVAS}"] tr`).contains('Str Value');
// Select all rows through row selection
cy.get('.dvn-scroller').click(10, 10, { waitForAnimations: true });
cy.get(`[data-testid="${DATAGRID_CANVAS}"] [aria-selected="true"]`).should('have.length', 6);
// Add a new row
cy.get('.dvn-scroller').click(200, 250);
cy.get('body').type('123');
cy.get('.dvn-scroller').click(50, 250);
cy.get('body').type('Val{enter}');
cy.get(`[data-testid="${DATAGRID_CANVAS}"] tbody tr`).contains('Val');
cy.get(`[data-testid="${DATAGRID_CANVAS}"] tbody tr`).should('have.length', 8);
});
});
@@ -1,135 +0,0 @@
import panelSandboxDashboard from '../dashboards/PanelSandboxDashboard.json';
import { e2e } from '../utils';
const DASHBOARD_ID = 'c46b2460-16b7-42a5-82d1-b07fbf431950';
// Skipping due to race conditions with same old arch test e2e/panels-suite/frontend-sandbox-panel.spec.ts
describe('Panel sandbox', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'), true);
return e2e.flows.importDashboard(panelSandboxDashboard, 1000, true);
});
describe('Sandbox disabled', () => {
beforeEach(() => {
cy.window().then((win) => {
win.localStorage.setItem('grafana.featureToggles', 'pluginsFrontendSandbox=0');
});
cy.reload();
});
it('Add iframes to body', () => {
// this button adds iframes to the body
cy.get('[data-testid="button-create-iframes"]').click();
const iframeIds = [
'createElementIframe',
'innerHTMLIframe',
'appendIframe',
'prependIframe',
'afterIframe',
'beforeIframe',
'outerHTMLIframe',
'parseFromStringIframe',
'insertBeforeIframe',
'replaceChildIframe',
];
iframeIds.forEach((id) => {
cy.get(`#${id}`).should('exist');
});
});
it('Reaches out of panel div', () => {
// this button reaches out of the panel div and modifies the element dataset
cy.get('[data-testid="button-reach-out"]').click();
cy.get('[data-sandbox-test="true"]').should('exist');
});
it('Reaches out of the panel editor', () => {
e2e.flows.openDashboard({
uid: DASHBOARD_ID,
queryParams: {
editPanel: 1,
},
});
cy.get('[data-testid="panel-editor-custom-editor-input"]').should('not.be.disabled');
cy.get('[data-testid="panel-editor-custom-editor-input"]').should('have.value', '');
// wait because sometimes cypress is faster than react and the value doesn't change
cy.wait(1000);
cy.get('[data-testid="panel-editor-custom-editor-input"]').type('x', { force: true, delay: 500 });
cy.wait(100); // small delay to prevent false positives from too fast tests
cy.get('[data-testid="panel-editor-custom-editor-input"]').should('have.value', 'x');
cy.get('[data-sandbox-test="panel-editor"]').should('exist');
});
});
describe('Sandbox enabled', () => {
beforeEach(() => {
cy.window().then((win) => {
win.localStorage.setItem('grafana.featureToggles', 'pluginsFrontendSandbox=1');
});
cy.reload();
});
it('Does not add iframes to body', () => {
// this button adds 3 iframes to the body
cy.get('[data-testid="button-create-iframes"]').click();
cy.wait(100); // small delay to prevent false positives from too fast tests
const iframeIds = [
'createElementIframe',
'innerHTMLIframe',
'appendIframe',
'prependIframe',
'afterIframe',
'beforeIframe',
'outerHTMLIframe',
'parseFromStringIframe',
'insertBeforeIframe',
'replaceChildIframe',
];
iframeIds.forEach((id) => {
cy.get(`#${id}`).should('not.exist');
});
});
it('Does not reaches out of panel div', () => {
// this button reaches out of the panel div and modifies the element dataset
cy.get('[data-testid="button-reach-out"]').click();
cy.wait(100); // small delay to prevent false positives from too fast tests
cy.get('[data-sandbox-test="true"]').should('not.exist');
});
it('Does not Reaches out of the panel editor', () => {
e2e.flows.openDashboard({
uid: DASHBOARD_ID,
queryParams: {
editPanel: 1,
},
});
cy.get('[data-testid="panel-editor-custom-editor-input"]').should('not.be.disabled');
// wait because sometimes cypress is faster than react and the value doesn't change
cy.wait(1000);
cy.get('[data-testid="panel-editor-custom-editor-input"]').type('x', { force: true });
cy.wait(100); // small delay to prevent false positives from too fast tests
cy.get('[data-sandbox-test="panel-editor"]').should('not.exist');
});
it('Can access specific window global variables', () => {
cy.get('[data-testid="button-test-globals"]').click();
cy.get('[data-sandbox-global="Prism"]').should('be.visible');
cy.get('[data-sandbox-global="jQuery"]').should('be.visible');
cy.get('[data-sandbox-global="location"]').should('be.visible');
});
});
afterEach(() => {
e2e.flows.revertAllChanges();
});
after(() => {
return cy.clearCookies();
});
});
@@ -1,99 +0,0 @@
import { e2e } from '../utils';
const DASHBOARD_ID = 'P2jR04WVk';
const MAP_LAYERS_TYPE = 'Map layers Layer type';
const MAP_LAYERS_DATA = 'Map layers Data';
const MAP_LAYERS_GEOJSON = 'Map layers GeoJSON URL';
describe('Geomap layer types', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Tests changing the layer type', () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { editPanel: 1 } });
cy.get('[data-testid="layer-drag-drop-list"]').should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).should('be.visible');
cy.get('[data-testid="layer-drag-drop-list"]').contains('markers');
// Heatmap
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('Heatmap{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('heatmap');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_DATA).should('be.visible');
// e2e.components.PanelEditor.General.content().should('be.visible');
// GeoJSON
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('GeoJSON{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('geojson');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_DATA).should('not.exist');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_GEOJSON).should('be.visible');
// e2e.components.PanelEditor.General.content().should('be.visible');
// Open Street Map
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('Open Street Map{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('osm-standard');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_DATA).should('not.exist');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_GEOJSON).should('not.exist');
// e2e.components.PanelEditor.General.content().should('be.visible');
// CARTO basemap
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('CARTO basemap{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('carto');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Show labels').should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Theme').should('be.visible');
// e2e.components.PanelEditor.General.content().should('be.visible');
// ArcGIS MapServer
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('ArcGIS MapServer{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('esri-xyz');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Server instance').should('be.visible');
// e2e.components.PanelEditor.General.content().should('be.visible');
// XYZ Tile layer
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('XYZ Tile layer{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('xyz');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers URL template').should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Attribution').should('be.visible');
// e2e.components.PanelEditor.General.content().should('be.visible');
});
it.skip('Tests changing the layer type (alpha)', () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { editPanel: 1 } });
cy.get('[data-testid="layer-drag-drop-list"]').should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).should('be.visible');
cy.get('[data-testid="layer-drag-drop-list"]').contains('markers');
// Icon at last point (Alpha)
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('Icon at last point{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('last-point-tracker');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_DATA).should('be.visible');
e2e.components.PanelEditor.General.content().should('be.visible');
// Dynamic GeoJSON (Alpha)
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('Dynamic GeoJSON{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('dynamic-geojson');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_DATA).should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_GEOJSON).should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers ID Field').should('be.visible');
e2e.components.PanelEditor.General.content().should('be.visible');
// Night / Day (Alpha)
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('Night / Day{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('dayNight');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_DATA).should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Show').should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Night region color').should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Display sun').should('be.visible');
e2e.components.PanelEditor.General.content().should('be.visible');
// Route (Alpha)
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_TYPE).type('Route{enter}');
cy.get('[data-testid="layer-drag-drop-list"]').contains('route');
e2e.components.PanelEditor.OptionsPane.fieldLabel(MAP_LAYERS_DATA).should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Location').should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Style').should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Map layers Line width').should('be.visible');
e2e.components.PanelEditor.General.content().should('be.visible');
});
});
@@ -1,70 +0,0 @@
import { e2e } from '../utils';
const DASHBOARD_ID = 'P2jR04WVk';
const TIMEOUT = 45000;
describe('Geomap layer controls options', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Tests map controls options', () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { editPanel: 1 } });
// Wait until the query editor has been loaded by ensuring that the QueryEditor select contains the text 'flight_info_by_state.csv'
e2e.components.Select.singleValue().contains('flight_info_by_state.csv').should('be.visible');
e2e.components.OptionsGroup.group('Map controls').scrollIntoView().should('be.visible');
// Show zoom field
e2e.components.PanelEditor.showZoomField()
.should('be.visible')
.within(() => {
cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked');
});
// Show attribution
e2e.components.PanelEditor.showAttributionField()
.should('be.visible')
.within(() => {
cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked');
});
// Show scale
e2e.components.PanelEditor.showScaleField()
.should('be.visible')
.within(() => {
cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked');
});
// Show measure tool
e2e.components.PanelEditor.showMeasureField()
.should('be.visible')
.within(() => {
cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked');
});
// Show debug
e2e.components.PanelEditor.showDebugField()
.should('be.visible')
.within(() => {
cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked');
});
e2e.components.Panels.Panel.content({ timeout: TIMEOUT })
.should('be.visible')
.within(() => {
// Verify zoom
cy.get('.ol-zoom', { timeout: TIMEOUT }).should('be.visible');
// Verify attribution
cy.get('.ol-attribution', { timeout: TIMEOUT }).should('be.visible');
// Verify scale
cy.get('.ol-scale-line', { timeout: TIMEOUT }).should('be.visible');
// Verify measure tool
e2e.components.PanelEditor.measureButton({ timeout: TIMEOUT }).should('be.visible');
// Verify debug tool
e2e.components.DebugOverlay.wrapper({ timeout: TIMEOUT }).should('be.visible');
});
});
});
@@ -1,98 +0,0 @@
import { e2e } from '../utils';
const DASHBOARD_ID = 'P2jR04WVk';
describe.skip('Geomap spatial operations', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Tests location auto option', () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { '__feature.tableNextGen': false, editPanel: 1 } });
e2e.components.Tab.title('Transformations').should('be.visible').click();
e2e.components.Transforms.addTransformationButton().scrollIntoView().should('be.visible').click();
e2e.components.TransformTab.newTransform('Spatial operations').scrollIntoView().should('be.visible').click();
e2e.components.Transforms.SpatialOperations.actionLabel().type('Prepare spatial field{enter}');
e2e.components.Transforms.SpatialOperations.locationLabel().should('be.visible');
e2e.components.Transforms.SpatialOperations.locationLabel().type('Auto{enter}');
e2e.components.PanelEditor.toggleTableView().click({ force: true });
e2e.components.Panels.Visualization.Table.header()
.should('be.visible')
.within(() => {
cy.contains('Point').should('be.visible');
});
});
it('Tests location coords option', () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { '__feature.tableNextGen': false, editPanel: 1 } });
e2e.components.Tab.title('Transformations').should('be.visible').click();
e2e.components.Transforms.addTransformationButton().scrollIntoView().should('be.visible').click();
e2e.components.TransformTab.newTransform('Spatial operations').scrollIntoView().should('be.visible').click();
e2e.components.Transforms.SpatialOperations.actionLabel().type('Prepare spatial field{enter}');
e2e.components.Transforms.SpatialOperations.locationLabel().should('be.visible');
e2e.components.Transforms.SpatialOperations.locationLabel().type('Coords{enter}');
e2e.components.Transforms.SpatialOperations.location.coords.latitudeFieldLabel().should('be.visible');
e2e.components.Transforms.SpatialOperations.location.coords.latitudeFieldLabel().type('Lat{enter}');
e2e.components.Transforms.SpatialOperations.location.coords.longitudeFieldLabel().should('be.visible');
e2e.components.Transforms.SpatialOperations.location.coords.longitudeFieldLabel().type('Lng{enter}');
e2e.components.PanelEditor.toggleTableView().click({ force: true });
e2e.components.Panels.Visualization.Table.header()
.should('be.visible')
.within(() => {
cy.contains('Point').should('be.visible');
});
});
it('Tests geoshash field column appears in table view', () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { '__feature.tableNextGen': false, editPanel: 1 } });
e2e.components.Tab.title('Transformations').should('be.visible').click();
e2e.components.Transforms.addTransformationButton().scrollIntoView().should('be.visible').click();
e2e.components.TransformTab.newTransform('Spatial operations').scrollIntoView().should('be.visible').click();
e2e.components.Transforms.SpatialOperations.actionLabel().type('Prepare spatial field{enter}');
e2e.components.Transforms.SpatialOperations.locationLabel().should('be.visible');
e2e.components.Transforms.SpatialOperations.locationLabel().type('Geohash{enter}');
e2e.components.Transforms.SpatialOperations.location.geohash
.geohashFieldLabel()
.should('be.visible')
.type('State{enter}');
e2e.components.PanelEditor.toggleTableView().click({ force: true });
e2e.components.Panels.Visualization.Table.header()
.should('be.visible')
.within(() => {
cy.contains('State 1').should('be.visible');
});
});
it('Tests location lookup option', () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { '__feature.tableNextGen': false, editPanel: 1 } });
e2e.components.Tab.title('Transformations').should('be.visible').click();
e2e.components.Transforms.addTransformationButton().scrollIntoView().should('be.visible').click();
e2e.components.TransformTab.newTransform('Spatial operations').scrollIntoView().should('be.visible').click();
e2e.components.Transforms.SpatialOperations.actionLabel().type('Prepare spatial field{enter}');
e2e.components.Transforms.SpatialOperations.locationLabel().should('be.visible');
e2e.components.Transforms.SpatialOperations.locationLabel().type('Lookup{enter}');
e2e.components.Transforms.SpatialOperations.location.lookup.lookupFieldLabel().should('be.visible');
e2e.components.Transforms.SpatialOperations.location.lookup.lookupFieldLabel().type('State{enter}');
e2e.components.Transforms.SpatialOperations.location.lookup.gazetteerFieldLabel().should('be.visible');
e2e.components.Transforms.SpatialOperations.location.lookup.gazetteerFieldLabel().type('USA States{enter}');
e2e.components.PanelEditor.toggleTableView().click({ force: true });
e2e.components.Panels.Visualization.Table.header()
.should('be.visible')
.within(() => {
cy.contains('Geometry').should('be.visible');
});
});
});
-109
View File
@@ -1,109 +0,0 @@
import { selectors } from '@grafana/e2e-selectors';
import { e2e } from '../utils';
const PANEL_UNDER_TEST = 'Lines 500 data points';
describe('Panel edit tests', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Tests various Panel edit scenarios', () => {
cy.intercept({
pathname: '/api/ds/query',
}).as('query');
e2e.flows.openDashboard({ uid: 'TkZXxlNG3', queryParams: { '__feature.tableNextGen': false } });
cy.wait('@query');
e2e.components.Panels.Panel.title('Lines 500 data points')
.should('be.visible')
.within(() => {
e2e.components.Panels.Panel.loadingBar().should('not.exist');
cy.get('[data-testid="uplot-main-div"]').first().should('be.visible');
});
e2e.flows.openPanelMenuItem(e2e.flows.PanelMenuItems.Edit, PANEL_UNDER_TEST);
// 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()
.scrollIntoView()
.should('be.visible')
.within(() => {
e2e.components.Tab.title('Queries').should('be.visible');
// data should be the active tab
e2e.components.Tab.active().within((li: JQuery<HTMLLIElement>) => {
expect(li.text()).equals('Queries1'); // there's already a query so therefore Query + 1
});
cy.get(`[data-testid="${selectors.components.QueryTab.content}"]`).should('be.visible');
e2e.components.TransformTab.content().should('not.exist');
e2e.components.AlertTab.content().should('not.exist');
e2e.components.PanelAlertTabContent.content().should('not.exist');
// Bottom pane tabs
// Can change to Transform tab
e2e.components.Tab.title('Transformations').should('be.visible').click();
e2e.components.Tab.active().within((li: JQuery<HTMLLIElement>) => {
expect(li.text()).equals('Transformations0'); // there's no transform so therefore Transform + 0
});
e2e.components.Transforms.addTransformationButton().scrollIntoView().should('be.visible');
cy.get(`[data-testid="${selectors.components.QueryTab.content}"]`).should('not.exist');
e2e.components.AlertTab.content().should('not.exist');
e2e.components.PanelAlertTabContent.content().should('not.exist');
// Can change to Alerts tab (graph panel is the default vis so the alerts tab should be rendered)
e2e.components.Tab.title('Alert').scrollIntoView().should('be.visible').click();
e2e.components.Tab.active().should('have.text', 'Alert0'); // there's no alert so therefore Alert + 0
// Needs to be disabled until Grafana EE turns unified alerting on by default
// e2e.components.AlertTab.content().should('not.exist');
cy.get(`[data-testid="${selectors.components.QueryTab.content}"]`).should('not.exist');
e2e.components.TransformTab.content().should('not.exist');
// 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');
e2e.components.Tab.title('Queries').should('be.visible').click();
});
// Check that Time series is chosen
e2e.components.PanelEditor.toggleVizPicker().click();
e2e.components.PluginVisualization.item('Time series').should('be.visible');
e2e.components.PluginVisualization.current().should((e) => expect(e).to.contain('Time series'));
// Check that table view works
e2e.components.Panels.Panel.loadingBar().should('not.exist');
e2e.components.PanelEditor.toggleTableView().click({ force: true });
e2e.components.Panels.Visualization.Table.header()
.should('be.visible')
.within(() => {
cy.contains('A-series').should('be.visible');
});
// Change to Text panel
e2e.components.PluginVisualization.item('Text').scrollIntoView().should('be.visible').click();
e2e.components.PanelEditor.toggleVizPicker().should((e) => expect(e).to.contain('Text'));
// Data pane should not be rendered
e2e.components.PanelEditor.DataPane.content().should('not.exist');
// Change to Table panel
e2e.components.PanelEditor.toggleVizPicker().click();
e2e.components.PluginVisualization.item('Table').scrollIntoView().should('be.visible').click();
e2e.components.PanelEditor.toggleVizPicker().should((e) => expect(e).to.contain('Table'));
// 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)
e2e.components.PanelEditor.toggleTableView().click({ force: true }).click({ force: true });
e2e.components.PanelEditor.OptionsPane.fieldLabel('Table Show table header').should('be.visible');
e2e.components.PanelEditor.OptionsPane.fieldLabel('Table Column width').should('be.visible');
});
});
@@ -1,99 +0,0 @@
import { e2e } from '../utils';
const flakyTimeout = 10000;
describe('Panel edit tests - queries', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Tests various Panel edit queries scenarios', () => {
e2e.flows.openDashboard({ uid: '5SdHCadmz', queryParams: { editPanel: 3 } });
// 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');
// We expect row with refId A to exist and be visible
e2e.components.QueryEditorRows.rows().within((rows) => {
expect(rows.length).equals(1);
});
// Add query button should be visible and clicking on it should create a new row
e2e.components.QueryTab.addQuery().scrollIntoView().should('be.visible').click();
// We expect row with refId A and B to exist and be visible
e2e.components.QueryEditorRows.rows({ timeout: flakyTimeout }).should('have.length', 2);
// Remove refId A
e2e.components.QueryEditorRow.actionButton('Remove query').eq(0).scrollIntoView();
e2e.components.QueryEditorRow.actionButton('Remove query').eq(0).should('be.visible').click();
// We expect row with refId B to exist and be visible
e2e.components.QueryEditorRows.rows({ timeout: flakyTimeout }).should('have.length', 1);
// Duplicate refId B
e2e.components.QueryEditorRow.actionButton('Duplicate query').eq(0).should('be.visible').click();
// We expect row with refId Band and A to exist and be visible
e2e.components.QueryEditorRows.rows().should('have.length', 2);
// Change to CSV Metric Values scenario for A
e2e.components.DataSource.TestData.QueryTab.scenarioSelectContainer()
.first()
.should('be.visible')
.within(() => {
cy.get('input[id*="test-data-scenario-select-"]').eq(0).should('be.visible').click();
});
cy.contains('CSV Metric Values').scrollIntoView().should('be.visible').eq(0).click();
// Disable / enable row
expectInspectorResultAndClose((keys) => {
const length = keys.length;
const resultIds = new Set<string>([
keys[length - 2].innerText, // last 2
keys[length - 1].innerText, // last 2
]);
expect(resultIds.has('A:')).equals(true);
expect(resultIds.has('B:')).equals(true);
});
// Hide response for row with refId A
e2e.components.QueryEditorRow.actionButton('Hide response').eq(1).should('be.visible').click();
expectInspectorResultAndClose((keys) => {
const length = keys.length;
expect(keys[length - 1].innerText).equals('B:');
});
// Show response for row with refId A
e2e.components.QueryEditorRow.actionButton('Hide response').eq(1).should('be.visible').click();
expectInspectorResultAndClose((keys) => {
const length = keys.length;
const resultIds = new Set<string>([
keys[length - 2].innerText, // last 2
keys[length - 1].innerText, // last 2
]);
expect(resultIds.has('A:')).equals(true);
expect(resultIds.has('B:')).equals(true);
});
});
});
const expectInspectorResultAndClose = (expectCallBack: (keys: JQuery<HTMLElement>) => void) => {
e2e.components.QueryTab.queryInspectorButton().should('be.visible').click();
e2e.components.PanelInspector.Query.refreshButton().should('be.visible').click();
e2e.components.PanelInspector.Query.jsonObjectKeys({ timeout: flakyTimeout })
.should('be.visible')
.should((keys) => expectCallBack(keys));
e2e.components.Drawer.General.close().should('be.visible').click();
};
@@ -1,28 +0,0 @@
import { e2e } from '../utils';
describe('Panel edit tests - transformations', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Tests transformations editor', () => {
e2e.flows.openDashboard({ uid: 'TkZXxlNG3', queryParams: { editPanel: 47 } });
e2e.components.Tab.title('Transformations').should('be.visible').click();
e2e.components.Transforms.addTransformationButton().scrollIntoView().should('be.visible').click();
e2e.components.TransformTab.newTransform('Reduce').scrollIntoView().should('be.visible').click();
e2e.components.Transforms.Reduce.calculationsLabel().scrollIntoView().should('be.visible');
e2e.components.Transforms.Reduce.modeLabel().should('be.visible');
});
it('Tests case where transformations can be disabled and not clear out panel data', () => {
e2e.flows.openDashboard({ uid: 'TkZXxlNG3', queryParams: { editPanel: 47 } });
e2e.components.Tab.title('Transformations').should('be.visible').click();
e2e.components.Transforms.addTransformationButton().scrollIntoView().should('be.visible').click();
e2e.components.TransformTab.newTransform('Reduce').scrollIntoView().should('be.visible').click();
e2e.components.Transforms.disableTransformationButton().should('be.visible').click();
e2e.components.Panels.Panel.PanelDataErrorMessage().should('not.exist');
});
});