Alerting: Add data-testids for Fullstory (#94555)

* add data-testids for Fullstory

* add more data-testids
pull/94611/head
Sonia Aguilar 9 months ago committed by GitHub
parent 0a4e6ff86b
commit 1596acbd3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      public/app/features/alerting/unified/components/rule-editor/NotificationsStep.tsx
  2. 6
      public/app/features/alerting/unified/components/rule-editor/RuleEditorSection.tsx
  3. 2
      public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx
  4. 9
      public/app/features/alerting/unified/components/rule-editor/labels/LabelsFieldInForm.tsx
  5. 2
      public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx
  6. 3
      public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/SmartAlertTypeDetector.tsx

@ -143,6 +143,7 @@ function ManualAndAutomaticRouting({ alertUid }: { alertUid?: string }) {
<Stack direction="column" gap={2}>
<Stack direction="column">
<RadioButtonGroup
data-testid={manualRouting ? 'routing-options-contact-point' : 'routing-options-notification-policy'}
options={routingOptions}
value={manualRouting ? RoutingOptions.ContactPoint : RoutingOptions.NotificationPolicy}
onChange={onRoutingOptionChange}

@ -37,7 +37,11 @@ export const RuleEditorSection = ({
{switchMode && (
<Text variant="bodySmall">
<InlineSwitch
id="query-and-expressions-advanced-options"
data-testid={
switchMode.isAdvancedMode
? 'query-and-expressions-advanced-options'
: 'query-and-expressions-simple-options'
}
value={switchMode.isAdvancedMode}
onChange={(event) => {
switchMode.setAdvancedMode(event.currentTarget.checked);

@ -236,6 +236,7 @@ export const AlertRuleForm = ({ existing, prefill }: Props) => {
<Stack justifyContent="flex-end" alignItems="center">
{existing && (
<Button
data-testid="save-rule"
variant="primary"
type="button"
size="sm"
@ -247,6 +248,7 @@ export const AlertRuleForm = ({ existing, prefill }: Props) => {
</Button>
)}
<Button
data-testid="save-rule-and-exit"
variant="primary"
type="button"
size="sm"

@ -39,7 +39,14 @@ export function LabelsFieldInForm({ onEditClick }: LabelsFieldInFormProps) {
) : (
<Stack direction="row" gap={2} alignItems="center">
<Text>No labels selected</Text>
<Button icon="plus" type="button" variant="secondary" onClick={onEditClick} size="sm">
<Button
icon="plus"
type="button"
variant="secondary"
onClick={onEditClick}
size="sm"
data-testid="add-labels-button"
>
Add labels
</Button>
</Stack>

@ -718,7 +718,7 @@ function TypeSelectorButton({ onClickType }: { onClickType: (type: ExpressionQue
return (
<Dropdown overlay={newMenu}>
<Button variant="secondary">
<Button variant="secondary" data-testid={'add-expression-button'}>
Add expression
<Icon name="angle-down" />
</Button>

@ -2,7 +2,7 @@ import { useFormContext } from 'react-hook-form';
import { DataSourceInstanceSettings } from '@grafana/data';
import { DataSourceJsonData } from '@grafana/schema';
import { RadioButtonGroup, Text, Stack } from '@grafana/ui';
import { RadioButtonGroup, Stack, Text } from '@grafana/ui';
import { contextSrv } from 'app/core/core';
import { ExpressionDatasourceUID } from 'app/features/expressions/types';
import { AccessControlAction } from 'app/types';
@ -133,6 +133,7 @@ export function SmartAlertTypeDetector({
disabledOptions={disabledOptions}
value={ruleFormType}
onChange={onClickSwitch}
data-testid="rule-type-radio-group"
/>
{/* editing an existing rule, we just show "cannot be changed" */}
{editingExistingRule && (

Loading…
Cancel
Save