diff --git a/e2e/shared/smokeTestScenario.ts b/e2e/shared/smokeTestScenario.ts index eb838b36dc2..fa129cd5a14 100644 --- a/e2e/shared/smokeTestScenario.ts +++ b/e2e/shared/smokeTestScenario.ts @@ -14,7 +14,7 @@ export const smokeTestScenario = { e2e.components.DataSource.TestData.QueryTab.scenarioSelectContainer() .should('be.visible') .within(() => { - e2e().get('input[id*="scenario-input-"]').should('be.visible').click(); + e2e().get('input[id*="test-data-scenario-select-"]').should('be.visible').click(); }); cy.contains('CSV Metric Values').scrollIntoView().should('be.visible').click(); diff --git a/e2e/suite1/specs/exemplars.spec.ts b/e2e/suite1/specs/exemplars.spec.ts index a0c62652240..bd466c56d7b 100644 --- a/e2e/suite1/specs/exemplars.spec.ts +++ b/e2e/suite1/specs/exemplars.spec.ts @@ -9,11 +9,7 @@ const addDataSource = () => { form: () => { e2e.components.DataSource.Prometheus.configPage.exemplarsAddButton().click(); e2e.components.DataSource.Prometheus.configPage.internalLinkSwitch().check({ force: true }); - e2e.components.DataSourcePicker.container() - .should('be.visible') - .within(() => { - e2e.components.DataSourcePicker.input().should('be.visible').click({ force: true }); - }); + e2e.components.DataSourcePicker.inputV2().should('be.visible').click({ force: true }); e2e().contains('gdev-tempo').scrollIntoView().should('be.visible').click(); }, @@ -48,11 +44,7 @@ describe('Exemplars', () => { e2e.pages.Explore.visit(); - e2e.components.DataSourcePicker.container() - .should('be.visible') - .within(() => { - e2e.components.DataSourcePicker.input().should('be.visible').click(); - }); + e2e.components.DataSourcePicker.input().should('be.visible').click(); e2e().contains(dataSourceName).scrollIntoView().should('be.visible').click(); e2e.components.TimePicker.openButton().click(); e2e.components.TimePicker.fromField().clear().type('2021-07-10 17:10:00'); diff --git a/e2e/suite1/specs/explore.spec.ts b/e2e/suite1/specs/explore.spec.ts index c815e092be0..91872ff59cd 100644 --- a/e2e/suite1/specs/explore.spec.ts +++ b/e2e/suite1/specs/explore.spec.ts @@ -14,7 +14,7 @@ e2e.scenario({ e2e.components.DataSource.TestData.QueryTab.scenarioSelectContainer() .should('be.visible') .within(() => { - e2e().get('input[id*="scenario-input-"]').should('be.visible').click(); + e2e().get('input[id*="test-data-scenario-select-"]').should('be.visible').click(); }); cy.contains('CSV Metric Values').scrollIntoView().should('be.visible').click(); diff --git a/e2e/suite1/specs/panelEdit_queries.spec.ts b/e2e/suite1/specs/panelEdit_queries.spec.ts index 7f1fa883632..9708204c8a0 100644 --- a/e2e/suite1/specs/panelEdit_queries.spec.ts +++ b/e2e/suite1/specs/panelEdit_queries.spec.ts @@ -50,7 +50,7 @@ e2e.scenario({ e2e.components.DataSource.TestData.QueryTab.scenarioSelectContainer() .should('be.visible') .within(() => { - e2e().get('input[id*="scenario-input-"]').eq(0).should('be.visible').click(); + e2e().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(); diff --git a/e2e/suite1/specs/query-editor.spec.ts b/e2e/suite1/specs/query-editor.spec.ts index ccb66ba5fa6..626228d8e36 100644 --- a/e2e/suite1/specs/query-editor.spec.ts +++ b/e2e/suite1/specs/query-editor.spec.ts @@ -8,11 +8,7 @@ e2e.scenario({ skipScenario: false, scenario: () => { e2e.pages.Explore.visit(); - e2e.components.DataSourcePicker.container() - .should('be.visible') - .within(() => { - e2e.components.DataSourcePicker.input().should('be.visible').click(); - }); + e2e.components.DataSourcePicker.inputV2().should('be.visible').click(); cy.contains('gdev-prometheus').scrollIntoView().should('be.visible').click(); const queryText = 'http_requests_total'; diff --git a/e2e/suite1/specs/trace-view-scrolling.spec.ts b/e2e/suite1/specs/trace-view-scrolling.spec.ts index b8c1c3ac0f1..b7436dc6e6c 100644 --- a/e2e/suite1/specs/trace-view-scrolling.spec.ts +++ b/e2e/suite1/specs/trace-view-scrolling.spec.ts @@ -11,11 +11,7 @@ describe('Trace view', () => { e2e.pages.Explore.visit(); - e2e.components.DataSourcePicker.container() - .should('be.visible') - .within(() => { - e2e.components.DataSourcePicker.input().should('be.visible').click(); - }); + e2e.components.DataSourcePicker.inputV2().should('be.visible').click(); e2e().contains('gdev-jaeger').scrollIntoView().should('be.visible').click(); diff --git a/e2e/suite1/specs/variables/new-query-variable.ts b/e2e/suite1/specs/variables/new-query-variable.ts index 3ff190a1fe9..8139c62ed3f 100644 --- a/e2e/suite1/specs/variables/new-query-variable.ts +++ b/e2e/suite1/specs/variables/new-query-variable.ts @@ -82,11 +82,7 @@ describe('Variables - Add variable', () => { e2e().get('#Description').should('be.visible').clear().type('a description'); - e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsDataSourceSelect() - .should('be.visible') - .within(() => { - e2e.components.DataSourcePicker.input().should('be.visible').type('gdev-testdata').type('{enter}'); - }); + e2e.components.DataSourcePicker.inputV2().should('be.visible').type('gdev-testdata').type('{enter}'); e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsQueryInput() .should('be.visible') @@ -136,11 +132,7 @@ describe('Variables - Add variable', () => { e2e().get('#Description').should('be.visible').clear().type('a description'); - e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsDataSourceSelect() - .should('be.visible') - .within(() => { - e2e.components.DataSourcePicker.input().should('be.visible').type('gdev-testdata').type('{enter}'); - }); + e2e.components.DataSourcePicker.inputV2().should('be.visible').type('gdev-testdata').type('{enter}'); e2e.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsQueryInput() .should('be.visible') diff --git a/packages/grafana-e2e-selectors/src/selectors/components.ts b/packages/grafana-e2e-selectors/src/selectors/components.ts index 810a64613e1..ae23016feea 100644 --- a/packages/grafana-e2e-selectors/src/selectors/components.ts +++ b/packages/grafana-e2e-selectors/src/selectors/components.ts @@ -209,7 +209,11 @@ export const Components = { }, DataSourcePicker: { container: 'Data source picker select container', + /** + * @deprecated use inputV2 instead + */ input: () => 'input[id="data-source-picker"]', + inputV2: 'Select a data source', }, TimeZonePicker: { container: 'Time zone picker select container', diff --git a/packages/grafana-runtime/src/components/DataSourcePicker.tsx b/packages/grafana-runtime/src/components/DataSourcePicker.tsx index 4dd5bac238b..334f7cd1dbe 100644 --- a/packages/grafana-runtime/src/components/DataSourcePicker.tsx +++ b/packages/grafana-runtime/src/components/DataSourcePicker.tsx @@ -145,6 +145,7 @@ export class DataSourcePicker extends PureComponent item.value === query.scenarioId)} onChange={onScenarioChange} width={32} - inputId={`scenario-input-${query.refId}`} /> {currentScenario?.stringInput && (