The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/e2e/scenes/dashboards-suite/new-query-variable.spec.ts

186 lines
6.9 KiB

Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
1 year ago
import { selectors } from '@grafana/e2e-selectors';
import { e2e } from '../utils';
const PAGE_UNDER_TEST = '-Y-tnEDWk/templating-nested-template-variables';
const DASHBOARD_NAME = 'Templating - Nested Template Variables';
describe('Variables - Query - Add variable', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('query variable should be default and default fields should be correct', () => {
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&editview=variables` });
cy.contains(DASHBOARD_NAME).should('be.visible');
cy.get(`[data-testid="${selectors.pages.Dashboard.Settings.Variables.List.newButton}"]`)
.should('be.visible')
.click();
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalNameInputV2()
.should('be.visible')
.within((input) => {
expect(input.attr('placeholder')).equals('Variable name');
expect(input.val()).equals('query0');
});
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalTypeSelectV2()
.should('be.visible')
.within((select) => {
e2e.components.Select.singleValue().should('have.text', 'Query');
});
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInputV2()
.should('be.visible')
.within((input) => {
expect(input.attr('placeholder')).equals('Label name');
expect(input.val()).equals('');
});
cy.get('[placeholder="Descriptive text"]')
.should('be.visible')
.within((input) => {
expect(input.attr('placeholder')).equals('Descriptive text');
expect(input.val()).equals('');
});
cy.get('label').contains('Show on dashboard').should('be.visible');
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsDataSourceSelect()
.get('input[placeholder="gdev-testdata"]')
.scrollIntoView()
.should('be.visible');
cy.get('label').contains('Refresh').scrollIntoView().should('be.visible');
cy.get('label').contains('On dashboard load').scrollIntoView().should('be.visible');
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2()
.should('be.visible')
.within((input) => {
const placeholder = '/.*-(?<text>.*)-(?<value>.*)-.*/';
expect(input.attr('placeholder')).equals(placeholder);
expect(input.val()).equals('');
});
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsSortSelectV2()
.should('be.visible')
.within((select) => {
e2e.components.Select.singleValue().should('have.text', 'Disabled');
});
cy.contains('label', 'Multi-value').within(() => {
cy.get('input[type="checkbox"]').should('not.be.checked');
});
cy.contains('label', 'Include All option').within(() => {
cy.get('input[type="checkbox"]').should('not.be.checked');
});
e2e.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption().should('not.have.text');
e2e.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsCustomAllInput().should('not.exist');
});
it('adding a single value query variable', () => {
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&editview=variables` });
cy.contains(DASHBOARD_NAME).should('be.visible');
cy.get(`[data-testid="${selectors.pages.Dashboard.Settings.Variables.List.newButton}"]`)
.should('be.visible')
.click();
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInputV2()
.should('be.visible')
.clear()
.type('a label');
cy.get('[placeholder="Descriptive text"]').should('be.visible').clear().type('a description');
e2e.components.DataSourcePicker.container().should('be.visible').type('gdev-testdata{enter}');
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsQueryInput()
.should('be.visible')
.type('*')
.blur();
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2()
.should('be.visible')
.type('/.*C.*/')
.blur();
e2e.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption().should('exist');
e2e.pages.Dashboard.Settings.Variables.Edit.General.submitButton().scrollIntoView().should('be.visible').click();
e2e.components.NavToolbar.editDashboard.backToDashboardButton().click();
e2e.pages.Dashboard.SubMenu.submenuItemLabels('a label').should('be.visible');
e2e.pages.Dashboard.SubMenu.submenuItem()
.should('have.length', 4)
.eq(3)
.within(() => {
cy.get('input').click();
});
e2e.components.Select.option().should('have.length', 1);
e2e.components.Select.option().contains('C');
});
it('adding a multi value query variable', () => {
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&editview=variables` });
cy.contains(DASHBOARD_NAME).should('be.visible');
cy.get(`[data-testid="${selectors.pages.Dashboard.Settings.Variables.List.newButton}"]`)
.should('be.visible')
.click();
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInputV2()
.should('be.visible')
.clear()
.type('a label');
cy.get('[placeholder="Descriptive text"]').should('be.visible').clear().type('a description');
e2e.components.DataSourcePicker.container().type('gdev-testdata{enter}');
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsQueryInput()
.should('be.visible')
.type('*')
.blur();
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2()
.should('be.visible')
.type('/.*C.*/')
.blur();
cy.contains('label', 'Multi-value').within(() => {
cy.get('input[type="checkbox"]').click({ force: true }).should('be.checked');
});
cy.contains('label', 'Include All option').within(() => {
cy.get('input[type="checkbox"]').click({ force: true }).should('be.checked');
});
e2e.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsCustomAllInput().within((input) => {
expect(input.attr('placeholder')).equals('blank = auto');
expect(input.val()).equals('');
});
e2e.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption().should('exist');
e2e.pages.Dashboard.Settings.Variables.Edit.General.submitButton().scrollIntoView().should('be.visible').click();
e2e.components.NavToolbar.editDashboard.backToDashboardButton().click();
e2e.pages.Dashboard.SubMenu.submenuItemLabels('a label').should('be.visible');
e2e.pages.Dashboard.SubMenu.submenuItem()
.should('have.length', 4)
.eq(3)
.within(() => {
cy.get('input').click();
});
e2e.components.Select.option().should('have.length', 3);
e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)');
Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
1 year ago
e2e.components.Select.option().contains('All');
e2e.components.Select.option().contains('C');
Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
1 year ago
});
});