Alerting: Migrate from aria-label e2e selectors to data-testid (#78437)

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
pull/75712/head
Khushi Jain 2 years ago committed by GitHub
parent 6708848056
commit b7c74a1af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      .betterer.results
  2. 4
      packages/grafana-e2e-selectors/src/selectors/components.ts
  3. 2
      public/app/features/alerting/AlertTab.tsx
  4. 2
      public/app/features/alerting/unified/PanelAlertTabContent.tsx
  5. 2
      public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx

@ -1634,8 +1634,7 @@ exports[`better eslint`] = {
],
"public/app/features/alerting/AlertTab.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"]
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/features/alerting/AlertTabCtrl.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -1769,10 +1768,9 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "0"]
],
"public/app/features/alerting/unified/PanelAlertTabContent.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.", "2"]
],
"public/app/features/alerting/unified/RedirectToRuleViewer.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"],
@ -2344,11 +2342,10 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "1"]
],
"public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.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.", "3"]
],
"public/app/features/alerting/unified/components/rule-editor/rule-types/RuleType.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"],

@ -214,7 +214,7 @@ export const Components = {
container: (refId: string) => `Query editor row ${refId}`,
},
AlertTab: {
content: 'Alert editor tab content',
content: 'data-testid Alert editor tab content',
},
Alert: {
/**
@ -405,7 +405,7 @@ export const Components = {
submit: 'data-testid-import-dashboard-submit',
},
PanelAlertTabContent: {
content: 'Unified alert editor tab content',
content: 'data-testid Unified alert editor tab content',
},
VisualizationPreview: {
card: (name: string) => `data-testid suggestion-${name}`,

@ -229,7 +229,7 @@ class UnConnectedAlertTab extends PureComponent<Props, State> {
<>
<CustomScrollbar autoHeightMin="100%">
<Container padding="md">
<div aria-label={selectors.components.AlertTab.content}>
<div data-testid={selectors.components.AlertTab.content}>
{alert && hasTransformations && (
<Alert
severity={AppNotificationSeverity.Error}

@ -59,7 +59,7 @@ export const PanelAlertTabContent = ({ dashboard, panel }: Props) => {
}
return (
<div aria-label={selectors.components.PanelAlertTabContent.content} className={styles.noRulesWrapper}>
<div data-testid={selectors.components.PanelAlertTabContent.content} className={styles.noRulesWrapper}>
{alert}
{!!dashboard.uid && (
<>

@ -457,7 +457,7 @@ export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: P
dispatch(addNewDataQuery());
}}
variant="secondary"
aria-label={selectors.components.QueryTab.addQuery}
data-testid={selectors.components.QueryTab.addQuery}
disabled={noCompatibleDataSources}
className={styles.addQueryButton}
>

Loading…
Cancel
Save