mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
E2E: adds back missing e2e specs (#44576)
* E2E: adds back missing e2e specs * Chore: removes wrong import directive
This commit is contained in:
@@ -1,153 +0,0 @@
|
||||
import { e2e } from '@grafana/e2e';
|
||||
|
||||
const PAGE_UNDER_TEST = '-Y-tnEDWk/templating-nested-template-variables';
|
||||
|
||||
describe('Variables - Load options from Url', () => {
|
||||
it('default options should be correct', () => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({ uid: PAGE_UNDER_TEST });
|
||||
e2e()
|
||||
.intercept({
|
||||
method: 'POST',
|
||||
url: '/api/ds/query',
|
||||
})
|
||||
.as('query');
|
||||
|
||||
e2e().wait('@query');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('A').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('B').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('C').should('be.visible');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('AA').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AC').should('be.visible');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('All').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AAA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AAB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AAC').should('be.visible');
|
||||
});
|
||||
|
||||
it('options set in url should load correct options', () => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&var-datacenter=B&var-server=BB&var-pod=BBB` });
|
||||
e2e()
|
||||
.intercept({
|
||||
method: 'POST',
|
||||
url: '/api/ds/query',
|
||||
})
|
||||
.as('query');
|
||||
|
||||
e2e().wait('@query');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('B').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('B').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('C').should('be.visible');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('BB').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BC').should('be.visible');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('BBB').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBC').should('be.visible');
|
||||
});
|
||||
|
||||
it('options set in url that do not exist should load correct options', () => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
// @ts-ignore some typing issue
|
||||
e2e().on('uncaught:exception', (err) => {
|
||||
if (err.stack?.indexOf("Couldn't find any field of type string in the results.") !== -1) {
|
||||
// return false to prevent the error from
|
||||
// failing this test
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&var-datacenter=X` });
|
||||
e2e()
|
||||
.intercept({
|
||||
method: 'POST',
|
||||
url: '/api/ds/query',
|
||||
})
|
||||
.as('query');
|
||||
|
||||
e2e().wait('@query');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('X').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('B').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('C').should('be.visible');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('AA').should('be.visible').click();
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 10);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,185 +0,0 @@
|
||||
import { e2e } from '@grafana/e2e';
|
||||
|
||||
const PAGE_UNDER_TEST = '-Y-tnEDWk/templating-nested-template-variables';
|
||||
|
||||
describe('Variables - Add variable', () => {
|
||||
it('query variable should be default and default fields should be correct', () => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&editview=templating` });
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.List.newButton().should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalNameInput()
|
||||
.should('be.visible')
|
||||
.within((input) => {
|
||||
expect(input.attr('placeholder')).equals('name');
|
||||
expect(input.val()).equals('query0');
|
||||
});
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalTypeSelect()
|
||||
.should('be.visible')
|
||||
.within((select) => {
|
||||
e2e.components.Select.singleValue().should('have.text', 'Query');
|
||||
});
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInput()
|
||||
.should('be.visible')
|
||||
.within((input) => {
|
||||
expect(input.attr('placeholder')).equals('optional display name');
|
||||
expect(input.val()).equals('');
|
||||
});
|
||||
e2e()
|
||||
.get('#Description')
|
||||
.should('be.visible')
|
||||
.within((input) => {
|
||||
expect(input.attr('placeholder')).equals('descriptive text');
|
||||
expect(input.val()).equals('');
|
||||
});
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalHideSelect()
|
||||
.should('be.visible')
|
||||
.within((select) => {
|
||||
e2e.components.Select.singleValue().should('have.text', '');
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsDataSourceSelect()
|
||||
.should('be.visible')
|
||||
.within((select) => {
|
||||
e2e.components.Select.singleValue().should('have.text', 'gdev-testdata');
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRefreshSelect()
|
||||
.should('be.visible')
|
||||
.within((select) => {
|
||||
e2e.components.Select.singleValue().should('have.text', 'On dashboard load');
|
||||
});
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInput()
|
||||
.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.queryOptionsSortSelect()
|
||||
.should('be.visible')
|
||||
.within((select) => {
|
||||
e2e.components.Select.singleValue().should('have.text', 'Disabled');
|
||||
});
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsMultiSwitch().should('not.be.checked');
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsIncludeAllSwitch().should('not.be.checked');
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption().should('not.exist');
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsCustomAllInput().should('not.exist');
|
||||
});
|
||||
|
||||
it('adding a single value query variable', () => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&editview=templating` });
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.List.newButton().should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInput()
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type('a label');
|
||||
|
||||
e2e().get('#Description').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.queryOptionsRegExInput()
|
||||
.should('be.visible')
|
||||
.type('/.*C.*/')
|
||||
.blur();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption().should('exist');
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.submitButton().should('be.visible').click();
|
||||
|
||||
e2e().wait(1500);
|
||||
|
||||
e2e.components.BackButton.backArrow().should('be.visible').click({ force: true });
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemLabels('a label').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItem()
|
||||
.should('have.length', 4)
|
||||
.eq(3)
|
||||
.within(() => {
|
||||
e2e().get('.variable-link-wrapper').should('be.visible').click();
|
||||
e2e().wait(500);
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 1);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('C').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('adding a multi value query variable', () => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&editview=templating` });
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.List.newButton().should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInput()
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type('a label');
|
||||
|
||||
e2e().get('#Description').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.queryOptionsRegExInput()
|
||||
.should('be.visible')
|
||||
.type('/.*C.*/')
|
||||
.blur();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsMultiSwitch()
|
||||
.click({ force: true })
|
||||
.should('be.checked');
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsIncludeAllSwitch()
|
||||
.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().should('be.visible').click();
|
||||
|
||||
e2e().wait(500);
|
||||
|
||||
e2e.components.BackButton.backArrow().should('be.visible').click({ force: true });
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemLabels('a label').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItem()
|
||||
.should('have.length', 4)
|
||||
.eq(3)
|
||||
.within(() => {
|
||||
e2e().get('.variable-link-wrapper').should('be.visible').click();
|
||||
e2e().wait(500);
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 2);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('C').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,155 +0,0 @@
|
||||
import { e2e } from '@grafana/e2e';
|
||||
|
||||
const PAGE_UNDER_TEST = '-Y-tnEDWk/templating-nested-template-variables';
|
||||
const flakyTimeout = 5000;
|
||||
|
||||
describe('Variables - Set options from ui', () => {
|
||||
it('clicking a value that is not part of dependents options should change these to All', () => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&var-datacenter=A&var-server=AA&var-pod=AAA` });
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('A').should('be.visible').click();
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible').click();
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('B').should('be.visible').click();
|
||||
|
||||
e2e.components.PageToolbar.container().click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('B').scrollIntoView().should('be.visible');
|
||||
|
||||
e2e().wait(flakyTimeout);
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('All')
|
||||
.should('have.length', 2)
|
||||
.eq(0)
|
||||
.should('be.visible')
|
||||
.click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BC').should('be.visible');
|
||||
|
||||
e2e().wait(flakyTimeout);
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('All').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 10);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BAA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BAB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BAC').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBC').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BCA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BCB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BCC').should('be.visible');
|
||||
});
|
||||
|
||||
it('adding a value that is not part of dependents options should add the new values dependant options', () => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&var-datacenter=A&var-server=AA&var-pod=AAA` });
|
||||
e2e().intercept('/api/ds/query').as('query');
|
||||
|
||||
e2e().wait('@query');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('A').should('be.visible').click();
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('B').should('be.visible').click();
|
||||
|
||||
e2e.components.PageToolbar.container().click();
|
||||
|
||||
e2e().wait('@query');
|
||||
e2e().wait(500);
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('A + B').scrollIntoView().should('be.visible');
|
||||
|
||||
e2e.components.LoadingIndicator.icon().should('have.length', 0);
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('AA').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 7);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AC').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BC').should('be.visible');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('AAA').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AAA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AAB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AAC').should('be.visible');
|
||||
});
|
||||
|
||||
it('removing a value that is part of dependents options should remove the new values dependant options', () => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({
|
||||
uid: `${PAGE_UNDER_TEST}?orgId=1&var-datacenter=A&var-datacenter=B&var-server=AA&var-server=BB&var-pod=AAA&var-pod=BBB`,
|
||||
});
|
||||
e2e().intercept('/api/ds/query').as('query');
|
||||
|
||||
e2e().wait('@query');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('A + B').should('be.visible').click();
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible').click();
|
||||
|
||||
e2e.components.PageToolbar.container().click();
|
||||
|
||||
e2e().wait('@query');
|
||||
e2e().wait(500);
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('B').scrollIntoView().should('be.visible');
|
||||
|
||||
e2e.components.LoadingIndicator.icon().should('have.length', 0);
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('BB').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BC').should('be.visible');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('BBB').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('.variable-option').should('have.length', 4);
|
||||
});
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBA').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBB').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBC').should('be.visible');
|
||||
});
|
||||
});
|
||||
@@ -1,246 +0,0 @@
|
||||
import { e2e } from '@grafana/e2e';
|
||||
|
||||
const PAGE_UNDER_TEST = 'AejrN1AMz';
|
||||
|
||||
describe('TextBox - load options scenarios', function () {
|
||||
it('default options should be correct', function () {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}/templating-textbox-e2e-scenarios?orgId=1` });
|
||||
|
||||
validateTextboxAndMarkup('default value');
|
||||
});
|
||||
|
||||
it('loading variable from url should be correct', function () {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e.flows.openDashboard({
|
||||
uid: `${PAGE_UNDER_TEST}/templating-textbox-e2e-scenarios?orgId=1&var-text=not default value`,
|
||||
});
|
||||
|
||||
validateTextboxAndMarkup('not default value');
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('TextBox - change query scenarios', function () {
|
||||
it('when changing the query value and not saving current as default should revert query value', function () {
|
||||
copyExistingDashboard();
|
||||
|
||||
changeQueryInput();
|
||||
|
||||
e2e.components.BackButton.backArrow().should('be.visible').click({ force: true });
|
||||
|
||||
validateTextboxAndMarkup('changed value');
|
||||
|
||||
saveDashboard(false);
|
||||
|
||||
e2e()
|
||||
.get('@dashuid')
|
||||
.then((dashuid: any) => {
|
||||
expect(dashuid).not.to.eq(PAGE_UNDER_TEST);
|
||||
|
||||
e2e.flows.openDashboard({ uid: dashuid });
|
||||
|
||||
e2e().wait('@load-dash');
|
||||
|
||||
validateTextboxAndMarkup('default value');
|
||||
|
||||
validateVariable('changed value');
|
||||
});
|
||||
});
|
||||
|
||||
it('when changing the query value and saving current as default should change query value', function () {
|
||||
copyExistingDashboard();
|
||||
|
||||
changeQueryInput();
|
||||
|
||||
e2e.components.BackButton.backArrow().should('be.visible').click({ force: true });
|
||||
|
||||
validateTextboxAndMarkup('changed value');
|
||||
|
||||
saveDashboard(true);
|
||||
|
||||
e2e()
|
||||
.get('@dashuid')
|
||||
.then((dashuid: any) => {
|
||||
expect(dashuid).not.to.eq(PAGE_UNDER_TEST);
|
||||
|
||||
e2e.flows.openDashboard({ uid: dashuid });
|
||||
|
||||
e2e().wait('@load-dash');
|
||||
|
||||
validateTextboxAndMarkup('changed value');
|
||||
|
||||
validateVariable('changed value');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('TextBox - change picker value scenarios', function () {
|
||||
it('when changing the input value and not saving current as default should revert query value', function () {
|
||||
copyExistingDashboard();
|
||||
|
||||
changeTextBoxInput();
|
||||
|
||||
validateTextboxAndMarkup('changed value');
|
||||
|
||||
saveDashboard(false);
|
||||
|
||||
e2e()
|
||||
.get('@dashuid')
|
||||
.then((dashuid: any) => {
|
||||
expect(dashuid).not.to.eq(PAGE_UNDER_TEST);
|
||||
|
||||
e2e.flows.openDashboard({ uid: dashuid });
|
||||
|
||||
e2e().wait('@load-dash');
|
||||
|
||||
validateTextboxAndMarkup('default value');
|
||||
validateVariable('default value');
|
||||
});
|
||||
});
|
||||
|
||||
it('when changing the input value and saving current as default should change query value', function () {
|
||||
copyExistingDashboard();
|
||||
|
||||
changeTextBoxInput();
|
||||
|
||||
validateTextboxAndMarkup('changed value');
|
||||
|
||||
saveDashboard(true);
|
||||
|
||||
e2e()
|
||||
.get('@dashuid')
|
||||
.then((dashuid: any) => {
|
||||
expect(dashuid).not.to.eq(PAGE_UNDER_TEST);
|
||||
|
||||
e2e.flows.openDashboard({ uid: dashuid });
|
||||
|
||||
e2e().wait('@load-dash');
|
||||
|
||||
validateTextboxAndMarkup('changed value');
|
||||
validateVariable('changed value');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function copyExistingDashboard() {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
e2e()
|
||||
.intercept({
|
||||
method: 'GET',
|
||||
url: '/api/search?query=&type=dash-folder&permission=Edit',
|
||||
})
|
||||
.as('dash-settings');
|
||||
e2e()
|
||||
.intercept({
|
||||
method: 'POST',
|
||||
url: '/api/dashboards/db/',
|
||||
})
|
||||
.as('save-dash');
|
||||
e2e()
|
||||
.intercept({
|
||||
method: 'GET',
|
||||
url: /\/api\/dashboards\/uid\/(?!AejrN1AMz)\w+/,
|
||||
})
|
||||
.as('load-dash');
|
||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}/templating-textbox-e2e-scenarios?orgId=1&editview=settings` });
|
||||
|
||||
e2e().wait('@dash-settings');
|
||||
|
||||
e2e.pages.Dashboard.Settings.General.saveAsDashBoard().should('be.visible').click();
|
||||
|
||||
e2e.pages.SaveDashboardAsModal.newName().should('be.visible').type(`${Date.now()}`);
|
||||
|
||||
e2e.pages.SaveDashboardAsModal.save().should('be.visible').click();
|
||||
|
||||
e2e().wait('@save-dash');
|
||||
e2e().wait('@load-dash');
|
||||
|
||||
e2e.pages.Dashboard.SubMenu.submenuItem().should('be.visible');
|
||||
|
||||
e2e()
|
||||
.location()
|
||||
.then((loc) => {
|
||||
const dashuid = /\/d\/(\w+)\//.exec(loc.href)![1];
|
||||
e2e().wrap(dashuid).as('dashuid');
|
||||
});
|
||||
|
||||
e2e().wait(500);
|
||||
}
|
||||
|
||||
function saveDashboard(saveVariables: boolean) {
|
||||
e2e.components.PageToolbar.item('Save dashboard').should('be.visible').click();
|
||||
|
||||
if (saveVariables) {
|
||||
e2e.pages.SaveDashboardModal.saveVariables().should('exist').click({ force: true });
|
||||
}
|
||||
|
||||
e2e.pages.SaveDashboardModal.save().should('be.visible').click();
|
||||
|
||||
e2e().wait('@save-dash');
|
||||
}
|
||||
|
||||
function validateTextboxAndMarkup(value: string) {
|
||||
e2e.pages.Dashboard.SubMenu.submenuItem()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemLabels('text').should('be.visible');
|
||||
e2e().get('input').should('be.visible').should('have.value', value);
|
||||
});
|
||||
|
||||
e2e.components.Panels.Visualization.Text.container()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e().get('h1').should('be.visible').should('have.text', `variable: ${value}`);
|
||||
});
|
||||
}
|
||||
|
||||
function validateVariable(value: string) {
|
||||
e2e.components.PageToolbar.item('Dashboard settings').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.Settings.General.sectionItems('Variables').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.List.tableRowNameFields('text').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.TextBoxVariable.textBoxOptionsQueryInput()
|
||||
.should('be.visible')
|
||||
.should('have.value', value);
|
||||
}
|
||||
|
||||
function changeTextBoxInput() {
|
||||
e2e.pages.Dashboard.SubMenu.submenuItemLabels('text').should('be.visible');
|
||||
e2e.pages.Dashboard.SubMenu.submenuItem()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e()
|
||||
.get('input')
|
||||
.should('be.visible')
|
||||
.should('have.value', 'default value')
|
||||
.clear()
|
||||
.type('changed value')
|
||||
.type('{enter}');
|
||||
});
|
||||
|
||||
e2e()
|
||||
.location()
|
||||
.should((loc) => {
|
||||
expect(loc.search).to.contain('var-text=changed%20value');
|
||||
});
|
||||
}
|
||||
|
||||
function changeQueryInput() {
|
||||
e2e.components.PageToolbar.item('Dashboard settings').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.Settings.General.sectionItems('Variables').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.List.tableRowNameFields('text').should('be.visible').click();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.TextBoxVariable.textBoxOptionsQueryInput()
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type('changed value')
|
||||
.blur();
|
||||
|
||||
e2e.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption()
|
||||
.should('have.length', 1)
|
||||
.should('have.text', 'changed value');
|
||||
}
|
||||
Reference in New Issue
Block a user