Prometheus: Fix e2e selector by using "data-test-id" instead of "id" (#93736)

* use data-test-id instead of id

* don't skip
pull/93741/head
ismail simsek 9 months ago committed by GitHub
parent 85bffcf787
commit 5472478ee8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      e2e/various-suite/prometheus-editor.spec.ts
  2. 4
      packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilderOptions.tsx

@ -1,5 +1,3 @@
import { selectors } from '@grafana/e2e-selectors';
import { e2e } from '../utils'; import { e2e } from '../utils';
import { getResources } from './helpers/prometheus-helpers'; import { getResources } from './helpers/prometheus-helpers';
@ -67,9 +65,9 @@ describe('Prometheus query editor', () => {
// check options // check options
e2e.components.DataSource.Prometheus.queryEditor.legend().scrollIntoView().should('exist'); e2e.components.DataSource.Prometheus.queryEditor.legend().scrollIntoView().should('exist');
e2e.components.DataSource.Prometheus.queryEditor.format().scrollIntoView().should('exist'); e2e.components.DataSource.Prometheus.queryEditor.format().scrollIntoView().should('exist');
cy.get(`#${selectors.components.DataSource.Prometheus.queryEditor.step}`).scrollIntoView().should('exist'); cy.get(`[data-test-id="prometheus-step"]`).scrollIntoView().should('exist');
e2e.components.DataSource.Prometheus.queryEditor.type().scrollIntoView().should('exist'); e2e.components.DataSource.Prometheus.queryEditor.type().scrollIntoView().should('exist');
cy.get(`#${selectors.components.DataSource.Prometheus.queryEditor.exemplars}`).scrollIntoView().should('exist'); cy.get(`[data-test-id="prometheus-exemplars"]`).scrollIntoView().should('exist');
}); });
describe('Code editor', () => { describe('Code editor', () => {

@ -92,7 +92,7 @@ export const PromQueryBuilderOptions = React.memo<PromQueryBuilderOptionsProps>(
minWidth={10} minWidth={10}
onCommitChange={onChangeStep} onCommitChange={onChangeStep}
defaultValue={query.interval} defaultValue={query.interval}
id={selectors.components.DataSource.Prometheus.queryEditor.step} data-test-id="prometheus-step"
/> />
</EditorField> </EditorField>
<EditorField label="Format"> <EditorField label="Format">
@ -112,7 +112,7 @@ export const PromQueryBuilderOptions = React.memo<PromQueryBuilderOptionsProps>(
<EditorSwitch <EditorSwitch
value={query.exemplar || false} value={query.exemplar || false}
onChange={onExemplarChange} onChange={onExemplarChange}
id={selectors.components.DataSource.Prometheus.queryEditor.exemplars} data-test-id="prometheus-exemplars"
/> />
</EditorField> </EditorField>
)} )}

Loading…
Cancel
Save