diff --git a/app/react/components/form-components/Slider/SliderWithInput.tsx b/app/react/components/form-components/Slider/SliderWithInput.tsx
index c66d9725b..088a91059 100644
--- a/app/react/components/form-components/Slider/SliderWithInput.tsx
+++ b/app/react/components/form-components/Slider/SliderWithInput.tsx
@@ -10,6 +10,7 @@ export function SliderWithInput({
step = 1,
dataCy,
visibleTooltip = false,
+ inputId,
}: {
value: number;
onChange: (value: number) => void;
@@ -18,6 +19,7 @@ export function SliderWithInput({
dataCy: string;
step?: number;
visibleTooltip?: boolean;
+ inputId?: string;
}) {
return (
@@ -44,6 +46,7 @@ export function SliderWithInput({
onChange={(e) => onChange(e.target.valueAsNumber)}
className="w-32"
data-cy={`${dataCy}Input`}
+ id={inputId}
/>
);
diff --git a/app/react/components/form-components/SwitchField/Switch.tsx b/app/react/components/form-components/SwitchField/Switch.tsx
index 2472a0aca..2ad968fae 100644
--- a/app/react/components/form-components/SwitchField/Switch.tsx
+++ b/app/react/components/form-components/SwitchField/Switch.tsx
@@ -2,6 +2,7 @@ import clsx from 'clsx';
import { isLimitedToBE } from '@/react/portainer/feature-flags/feature-flags.service';
import { FeatureId } from '@/react/portainer/feature-flags/enums';
+import { AutomationTestingProps } from '@/types';
import { BEFeatureIndicator } from '@@/BEFeatureIndicator';
@@ -9,7 +10,7 @@ import './Switch.css';
import styles from './Switch.module.css';
-export interface Props {
+export interface Props extends AutomationTestingProps {
checked: boolean;
id: string;
name: string;
@@ -17,7 +18,6 @@ export interface Props {
index?: number;
className?: string;
- dataCy?: string;
disabled?: boolean;
featureId?: FeatureId;
}
@@ -27,7 +27,7 @@ export function Switch({
checked,
id,
disabled,
- dataCy,
+ 'data-cy': dataCy,
onChange,
index,
featureId,
@@ -42,6 +42,8 @@ export function Switch({
business: limitedToBE,
limited: limitedToBE,
})}
+ data-cy={dataCy}
+ aria-checked={checked}
>
onChange(checked, index)}
/>
-
+
{limitedToBE &&
}
>
diff --git a/app/react/components/form-components/SwitchField/SwitchField.tsx b/app/react/components/form-components/SwitchField/SwitchField.tsx
index ecfb8a09a..4ab2e8848 100644
--- a/app/react/components/form-components/SwitchField/SwitchField.tsx
+++ b/app/react/components/form-components/SwitchField/SwitchField.tsx
@@ -3,13 +3,14 @@ import uuid from 'uuid';
import { ComponentProps, PropsWithChildren, ReactNode } from 'react';
import { FeatureId } from '@/react/portainer/feature-flags/enums';
+import { AutomationTestingProps } from '@/types';
import { Tooltip } from '@@/Tip/Tooltip';
import styles from './SwitchField.module.css';
import { Switch } from './Switch';
-export interface Props {
+export interface Props extends AutomationTestingProps {
label: string;
checked: boolean;
onChange(value: boolean, index?: number): void;
@@ -21,7 +22,7 @@ export interface Props {
labelClass?: string;
switchClass?: string;
fieldClass?: string;
- dataCy?: string;
+
disabled?: boolean;
featureId?: FeatureId;
valueExplanation?: ReactNode;
@@ -35,7 +36,7 @@ export function SwitchField({
name = uuid(),
labelClass,
fieldClass,
- dataCy,
+ 'data-cy': dataCy,
disabled,
onChange,
featureId,
@@ -65,7 +66,7 @@ export function SwitchField({
onChange={onChange}
index={index}
featureId={featureId}
- dataCy={dataCy}
+ data-cy={dataCy}
/>
{valueExplanation &&
{valueExplanation}}
diff --git a/app/react/kubernetes/cluster/ConfigureView/ConfigureForm/StorageClassDatatable.tsx b/app/react/kubernetes/cluster/ConfigureView/ConfigureForm/StorageClassDatatable.tsx
index 51c0a1745..b64d7daa4 100644
--- a/app/react/kubernetes/cluster/ConfigureView/ConfigureForm/StorageClassDatatable.tsx
+++ b/app/react/kubernetes/cluster/ConfigureView/ConfigureForm/StorageClassDatatable.tsx
@@ -40,7 +40,7 @@ export function StorageClassDatatable({ storageClassValues }: Props) {
className="mr-2 mb-0"
id={`kubeSetup-storageToggle${storageClassValue.Name}`}
name={`kubeSetup-storageToggle${storageClassValue.Name}`}
- dataCy={`kubeSetup-storageToggle${storageClassValue.Name}`}
+ data-cy={`kubeSetup-storageToggle${storageClassValue.Name}`}
/>