diff --git a/.betterer.results b/.betterer.results index c99a1a1c714..84fde18b403 100644 --- a/.betterer.results +++ b/.betterer.results @@ -605,9 +605,6 @@ exports[`better eslint`] = { "packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx:5381": [ - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] - ], "packages/grafana-ui/src/components/DataSourceSettings/CustomHeadersSettings.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -794,10 +791,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"] ], "packages/grafana-ui/src/components/ValuePicker/ValuePicker.tsx:5381": [ - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"] - ], - "packages/grafana-ui/src/components/VizLegend/VizLegendListItem.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] ], "packages/grafana-ui/src/components/VizLegend/types.ts:5381": [ @@ -6382,12 +6375,11 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/plugins/panel/piechart/PieChart.tsx:5381": [ - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], + [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"], [0, 0, 0, "Styles should be written using objects.", "2"], [0, 0, 0, "Styles should be written using objects.", "3"], - [0, 0, 0, "Styles should be written using objects.", "4"], - [0, 0, 0, "Styles should be written using objects.", "5"] + [0, 0, 0, "Styles should be written using objects.", "4"] ], "public/app/plugins/panel/piechart/migrations.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -6543,7 +6535,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "11"] ], "public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx:5381": [ - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], + [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"], [0, 0, 0, "Styles should be written using objects.", "2"], [0, 0, 0, "Styles should be written using objects.", "3"], @@ -6553,8 +6545,7 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "7"], [0, 0, 0, "Styles should be written using objects.", "8"], [0, 0, 0, "Styles should be written using objects.", "9"], - [0, 0, 0, "Styles should be written using objects.", "10"], - [0, 0, 0, "Styles should be written using objects.", "11"] + [0, 0, 0, "Styles should be written using objects.", "10"] ], "public/app/plugins/panel/timeseries/plugins/ThresholdDragHandle.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], diff --git a/e2e/various-suite/pie-chart.spec.ts b/e2e/various-suite/pie-chart.spec.ts index 3ed6c1f6896..2030aed53fe 100644 --- a/e2e/various-suite/pie-chart.spec.ts +++ b/e2e/various-suite/pie-chart.spec.ts @@ -11,7 +11,7 @@ describe('Pie Chart Panel', () => { // open Panel Tests - Pie Chart e2e.flows.openDashboard({ uid: 'lVE-2YFMz' }); - cy.get(`[data-panelid=11] [aria-label^="${selectors.components.Panels.Visualization.PieChart.svgSlice}"]`).should( + cy.get(`[data-panelid=11] [data-testid^="${selectors.components.Panels.Visualization.PieChart.svgSlice}"]`).should( 'have.length', 5 ); diff --git a/packages/grafana-e2e-selectors/src/selectors/components.ts b/packages/grafana-e2e-selectors/src/selectors/components.ts index 5814e805b30..3d651915ede 100644 --- a/packages/grafana-e2e-selectors/src/selectors/components.ts +++ b/packages/grafana-e2e-selectors/src/selectors/components.ts @@ -64,7 +64,7 @@ export const Components = { exemplarsAddButton: 'Add exemplar config button', internalLinkSwitch: 'Internal link switch', }, - exemplarMarker: 'Exemplar marker', + exemplarMarker: 'data-testid Exemplar marker', }, }, Menu: { @@ -113,7 +113,7 @@ export const Components = { valueV2: 'data-testid Bar gauge value', }, PieChart: { - svgSlice: 'Pie Chart Slice', + svgSlice: 'data testid Pie Chart Slice', }, Text: { container: () => '.markdown-html', @@ -126,7 +126,7 @@ export const Components = { }, }, VizLegend: { - seriesName: (name: string) => `VizLegend series ${name}`, + seriesName: (name: string) => `data-testid VizLegend series ${name}`, }, Drawer: { General: { @@ -353,8 +353,8 @@ export const Components = { matchOperatorSelect: 'Select match operator', }, ValuePicker: { - button: (name: string) => `Value picker button ${name}`, - select: (name: string) => `Value picker select ${name}`, + button: (name: string) => `data-testid Value picker button ${name}`, + select: (name: string) => `data-testid Value picker select ${name}`, }, Search: { /** @@ -392,7 +392,7 @@ export const Components = { buttonV2: (name: string) => `data-testid Call to action button ${name}`, }, DataLinksContextMenu: { - singleLink: 'Data link', + singleLink: 'data-testid Data link', }, CodeEditor: { container: 'data-testid Code editor container', diff --git a/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.test.tsx b/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.test.tsx index e64e0460618..34c826a03f9 100644 --- a/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.test.tsx +++ b/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.test.tsx @@ -54,6 +54,6 @@ describe('DataLinksContextMenu', () => { ); expect(screen.getByLabelText(fakeAriaLabel)).toBeInTheDocument(); - expect(screen.getByLabelText(selectors.components.DataLinksContextMenu.singleLink)).toBeInTheDocument(); + expect(screen.getByTestId(selectors.components.DataLinksContextMenu.singleLink)).toBeInTheDocument(); }); }); diff --git a/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx b/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx index 23dbd13c95f..64e11a28288 100644 --- a/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx +++ b/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx @@ -63,7 +63,7 @@ export const DataLinksContextMenu = ({ children, links, style }: DataLinksContex target={linkModel.target} title={linkModel.title} style={{ ...style, overflow: 'hidden', display: 'flex' }} - aria-label={selectors.components.DataLinksContextMenu.singleLink} + data-testid={selectors.components.DataLinksContextMenu.singleLink} > {children({})} diff --git a/packages/grafana-ui/src/components/ValuePicker/ValuePicker.tsx b/packages/grafana-ui/src/components/ValuePicker/ValuePicker.tsx index 2fda7a1c086..092d09a1931 100644 --- a/packages/grafana-ui/src/components/ValuePicker/ValuePicker.tsx +++ b/packages/grafana-ui/src/components/ValuePicker/ValuePicker.tsx @@ -65,7 +65,7 @@ export function ValuePicker({ variant={variant} fill={fill} fullWidth={isFullWidth} - aria-label={selectors.components.ValuePicker.button(ariaLabel ?? label)} + data-testid={selectors.components.ValuePicker.button(ariaLabel ?? label)} > {label} diff --git a/packages/grafana-ui/src/components/VizLegend/VizLegendListItem.tsx b/packages/grafana-ui/src/components/VizLegend/VizLegendListItem.tsx index f1ba5bf7488..0518ae5ac5d 100644 --- a/packages/grafana-ui/src/components/VizLegend/VizLegendListItem.tsx +++ b/packages/grafana-ui/src/components/VizLegend/VizLegendListItem.tsx @@ -68,7 +68,7 @@ export const VizLegendListItem = ({ return (