Dashboards: Migrate from aria-label e2e selectors to data-testid (#78536)

* Dashboards: Migrate from aria-label e2e selectors to data-testid

* more changes

* addPanelwidget

* Test: Update .betterer.results

* refactor: fix e2e tests

* refactor: fix failing test

* refactor: update plugin-e2e after adding selector changes to the packege

---------

Co-authored-by: Laura Benz <48948963+L-M-K-B@users.noreply.github.com>
Co-authored-by: Laura Benz <laura.benz@grafana.com>
This commit is contained in:
Khushi Jain
2024-04-24 18:46:19 +05:30
committed by GitHub
parent 38917c4e79
commit 5dd8353ab1
13 changed files with 49 additions and 65 deletions

View File

@@ -218,22 +218,22 @@ export const Components = {
},
PanelEditor: {
General: {
content: 'Panel editor content',
content: 'data-testid Panel editor content',
},
OptionsPane: {
content: 'Panel editor option pane content',
content: 'data-testid Panel editor option pane content',
select: 'Panel editor option pane select',
fieldLabel: (type: string) => `${type} field property editor`,
fieldInput: (title: string) => `data-testid Panel editor option pane field input ${title}`,
},
// not sure about the naming *DataPane*
DataPane: {
content: 'Panel editor data pane content',
content: 'data-testid Panel editor data pane content',
},
applyButton: 'data-testid Apply changes and go back to dashboard',
toggleVizPicker: 'data-testid toggle-viz-picker',
toggleVizOptions: 'data-testid toggle-viz-options',
toggleTableView: 'toggle-table-view',
toggleTableView: 'data-testid toggle-table-view',
// [Geomap] Map controls
showZoomField: 'Map controls Show zoom control field property editor',
@@ -252,7 +252,7 @@ export const Components = {
content: 'Panel inspector Stats content',
},
Json: {
content: 'Panel inspector Json content',
content: 'data-testid Panel inspector Json content',
},
Query: {
content: 'Panel inspector Query content',
@@ -377,8 +377,9 @@ export const Components = {
backArrow: 'data-testid Go Back',
},
OptionsGroup: {
group: (title?: string) => (title ? `Options group ${title}` : 'Options group'),
toggle: (title?: string) => (title ? `Options group ${title} toggle` : 'Options group toggle'),
group: (title?: string) => (title ? `data-testid Options group ${title}` : 'data-testid Options group'),
toggle: (title?: string) =>
title ? `data-testid Options group ${title} toggle` : 'data-testid Options group toggle',
},
PluginVisualization: {
item: (title: string) => `Plugin visualization item ${title}`,
@@ -535,8 +536,8 @@ export const Components = {
variableOption: 'data-testid variable-option',
},
Annotations: {
annotationsTypeInput: 'annotations-type-input',
annotationsChoosePanelInput: 'choose-panels-input',
annotationsTypeInput: 'data-testid annotations-type-input',
annotationsChoosePanelInput: 'data-testid choose-panels-input',
editor: {
testButton: 'data-testid annotations-test-button',
resultContainer: 'data-testid annotations-query-result-container',

View File

@@ -43,9 +43,9 @@ export const Pages = {
AddDashboard: {
url: '/dashboard/new',
itemButton: (title: string) => `data-testid ${title}`,
addNewPanel: 'Add new panel',
addNewRow: 'Add new row',
addNewPanelLibrary: 'Add new panel from panel library',
addNewPanel: 'data-testid Add new panel',
addNewRow: 'data-testid Add new row',
addNewPanelLibrary: 'data-testid Add new panel from panel library',
},
Dashboard: {
url: (uid: string) => `/d/${uid}`,
@@ -103,11 +103,11 @@ export const Pages = {
annotations: 'data-testid list-annotations',
},
Settings: {
name: 'Annotations settings name input',
name: 'data-testid Annotations settings name input',
},
NewAnnotation: {
panelFilterSelect: 'data-testid annotations-panel-filter',
showInLabel: 'show-in-label',
showInLabel: 'data-testid show-in-label',
previewInDashboard: 'data-testid annotations-preview',
delete: 'data-testid annotations-delete',
apply: 'data-testid annotations-apply',