Prometheus: Migrate remaining selectors to data-testid (#106564)
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
|
||||
import { e2e } from '../utils';
|
||||
import { addDashboard } from '../utils/flows';
|
||||
|
||||
@@ -56,7 +54,7 @@ describe('Prometheus annotations', () => {
|
||||
|
||||
// check for other parts of the annotations
|
||||
// min step
|
||||
cy.get(`#${selectors.components.DataSource.Prometheus.annotations.minStep}`);
|
||||
e2e.components.DataSource.Prometheus.annotations.minStep().should('exist');
|
||||
|
||||
// title
|
||||
e2e.components.DataSource.Prometheus.annotations.title().scrollIntoView().should('exist');
|
||||
|
||||
@@ -65,9 +65,9 @@ describe('Prometheus query editor', () => {
|
||||
// check options
|
||||
e2e.components.DataSource.Prometheus.queryEditor.legend().scrollIntoView().should('exist');
|
||||
e2e.components.DataSource.Prometheus.queryEditor.format().scrollIntoView().should('exist');
|
||||
cy.get(`[data-test-id="prometheus-step"]`).scrollIntoView().should('exist');
|
||||
e2e.components.DataSource.Prometheus.queryEditor.step().scrollIntoView().should('exist');
|
||||
e2e.components.DataSource.Prometheus.queryEditor.type().scrollIntoView().should('exist');
|
||||
cy.get(`[data-testid="prometheus-exemplars"]`).scrollIntoView().should('exist');
|
||||
e2e.components.DataSource.Prometheus.queryEditor.exemplars().scrollIntoView().should('exist');
|
||||
});
|
||||
|
||||
describe('Code editor', () => {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
|
||||
import { e2e } from '../utils';
|
||||
import { addDashboard } from '../utils/flows';
|
||||
|
||||
@@ -57,7 +55,7 @@ describe('Prometheus annotations', () => {
|
||||
|
||||
// check for other parts of the annotations
|
||||
// min step
|
||||
cy.get(`#${selectors.components.DataSource.Prometheus.annotations.minStep}`);
|
||||
e2e.components.DataSource.Prometheus.annotations.minStep().should('exist');
|
||||
|
||||
// title
|
||||
e2e.components.DataSource.Prometheus.annotations.title().scrollIntoView().should('exist');
|
||||
|
||||
@@ -65,9 +65,9 @@ describe.skip('Prometheus query editor', () => {
|
||||
// check options
|
||||
e2e.components.DataSource.Prometheus.queryEditor.legend().scrollIntoView().should('exist');
|
||||
e2e.components.DataSource.Prometheus.queryEditor.format().scrollIntoView().should('exist');
|
||||
cy.get(`[data-test-id="prometheus-step"]`).scrollIntoView().should('exist');
|
||||
e2e.components.DataSource.Prometheus.queryEditor.step().scrollIntoView().should('exist');
|
||||
e2e.components.DataSource.Prometheus.queryEditor.type().scrollIntoView().should('exist');
|
||||
cy.get(`[data-testid="prometheus-exemplars"]`).scrollIntoView().should('exist');
|
||||
e2e.components.DataSource.Prometheus.queryEditor.exemplars().scrollIntoView().should('exist');
|
||||
});
|
||||
|
||||
describe('Code editor', () => {
|
||||
|
||||
@@ -250,13 +250,13 @@ export const versionedComponents = {
|
||||
'10.4.0': 'data-testid prometheus format',
|
||||
},
|
||||
step: {
|
||||
'10.4.0': 'prometheus-step', // id for autosize component
|
||||
'10.4.0': 'data-testid prometheus-step', // id for autosize component
|
||||
},
|
||||
type: {
|
||||
'10.4.0': 'data-testid prometheus type', //wrapper for radio button group
|
||||
},
|
||||
exemplars: {
|
||||
'10.4.0': 'prometheus-exemplars', // id for editor switch component
|
||||
'10.4.0': 'data-testid prometheus-exemplars', // id for editor switch component
|
||||
},
|
||||
builder: {
|
||||
// see QueryBuilder below for commented selectors
|
||||
@@ -349,7 +349,7 @@ export const versionedComponents = {
|
||||
},
|
||||
annotations: {
|
||||
minStep: {
|
||||
'10.4.0': 'prometheus-annotation-min-step', // id for autosize input
|
||||
'10.4.0': 'data-testid prometheus-annotation-min-step', // id for autosize input
|
||||
},
|
||||
title: {
|
||||
'10.4.0': 'data-testid prometheus annotation title',
|
||||
|
||||
@@ -100,6 +100,7 @@ export const AnnotationQueryEditor = memo(function AnnotationQueryEditor(props:
|
||||
value={query.interval ?? ''}
|
||||
onChange={(e) => handleMinStepChange(e.currentTarget.value)}
|
||||
id={selectors.components.DataSource.Prometheus.annotations.minStep}
|
||||
data-testid={selectors.components.DataSource.Prometheus.annotations.minStep}
|
||||
/>
|
||||
</EditorField>
|
||||
</EditorRow>
|
||||
|
||||
@@ -115,7 +115,7 @@ export const PromQueryBuilderOptions = React.memo<PromQueryBuilderOptionsProps>(
|
||||
minWidth={10}
|
||||
onCommitChange={onChangeStep}
|
||||
defaultValue={query.interval}
|
||||
data-test-id="prometheus-step"
|
||||
data-testid={selectors.components.DataSource.Prometheus.queryEditor.step}
|
||||
/>
|
||||
</EditorField>
|
||||
<EditorField label={t('grafana-prometheus.querybuilder.prom-query-builder-options.label-format', 'Format')}>
|
||||
|
||||
Reference in New Issue
Block a user