mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Frontend: Migrate DataSourceHttpSettings.tsx
from aria-label e2e selectors to data-testid (#79615)
This commit is contained in:
parent
642391c9f9
commit
71b98163e5
@ -609,9 +609,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/DataSourceSettings/types.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
|
@ -53,7 +53,7 @@ export const Components = {
|
||||
},
|
||||
},
|
||||
DataSourceHttpSettings: {
|
||||
urlInput: 'Datasource HTTP settings url',
|
||||
urlInput: 'data-testid Datasource HTTP settings url',
|
||||
},
|
||||
Jaeger: {
|
||||
traceIDInput: 'Trace ID',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { css, cx } from '@emotion/css';
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import React, { useState, useCallback, useId } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
@ -153,12 +153,15 @@ export const DataSourceHttpSettings = (props: HttpSettingsProps) => {
|
||||
|
||||
const inputStyle = cx({ [`width-20`]: true, [notValidStyle]: !isValidUrl });
|
||||
|
||||
const fromFieldId = useId();
|
||||
|
||||
const urlInput = (
|
||||
<Input
|
||||
id={fromFieldId}
|
||||
className={inputStyle}
|
||||
placeholder={defaultUrl}
|
||||
value={dataSourceConfig.url}
|
||||
aria-label={selectors.components.DataSource.DataSourceHttpSettings.urlInput}
|
||||
data-testid={selectors.components.DataSource.DataSourceHttpSettings.urlInput}
|
||||
onChange={(event) => onSettingsChange({ url: event.currentTarget.value })}
|
||||
disabled={dataSourceConfig.readOnly}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user