diff --git a/packages/components/src/components/atoms/backToLastPage/BackToLastPage.tsx b/packages/components/src/components/atoms/backToLastPage/BackToLastPage.tsx index 4b0b2249..199b4321 100644 --- a/packages/components/src/components/atoms/backToLastPage/BackToLastPage.tsx +++ b/packages/components/src/components/atoms/backToLastPage/BackToLastPage.tsx @@ -26,6 +26,7 @@ function BackToLastPage(props: IProps): JSX.Element { )} diff --git a/packages/components/src/components/atoms/form/InputTextWithoutError.tsx b/packages/components/src/components/atoms/form/InputTextWithoutError.tsx index 34d509cf..d989457e 100644 --- a/packages/components/src/components/atoms/form/InputTextWithoutError.tsx +++ b/packages/components/src/components/atoms/form/InputTextWithoutError.tsx @@ -42,6 +42,7 @@ export interface IInputTextProps onChange?: (value: string | number, event: SyntheticEvent) => void suffix?: ReactNode requiredLabel?: boolean + dataTestId?: string } function InputTextWithoutError( @@ -62,6 +63,8 @@ function InputTextWithoutError( suffix, value, requiredLabel, + dataTestId, + inputProps, ...InputProps } = props @@ -94,12 +97,18 @@ function InputTextWithoutError( required={required} ref={ref} value={(value ?? '').toString()} + inputProps={{ + ...inputProps, + 'data-testid': dataTestId, + }} {...InputProps} /> {Boolean(suffix) && {suffix}} {Boolean(helperText) && ( - + {Boolean(helperIcon) && ( void suffix?: ReactNode value: (string | number | null)[] + dataTestId?: string } function RangeWithoutError( @@ -58,6 +59,7 @@ function RangeWithoutError( suffix, value, type = 'number', + dataTestId, ...InputProps } = props const [placeholderFrom, placeholderTo] = placeholder @@ -98,7 +100,11 @@ function RangeWithoutError( required={required} {...InputProps} type={type} - inputProps={{ ...inputProps, max: valueTo }} + inputProps={{ + ...inputProps, + max: valueTo, + 'data-testid': dataTestId ? `${dataTestId}First` : null, + }} placeholder={placeholderFrom} value={valueFrom ? String(valueFrom) : ''} inputRef={ref} @@ -110,14 +116,21 @@ function RangeWithoutError( required={required} {...InputProps} type={type} - inputProps={{ ...inputProps, min: valueFrom }} + inputProps={{ + ...inputProps, + min: valueFrom, + 'data-testid': dataTestId ? `${dataTestId}Second` : null, + }} placeholder={placeholderTo} value={valueTo ? String(valueTo) : ''} /> {Boolean(suffix) && {suffix}} {Boolean(helperText) && ( - + {Boolean(helperIcon) && ( { @@ -110,6 +112,7 @@ function RequestType(props: IProps): JSX.Element { onChange={updateSelectedDropDown} value={value.requestTypes.map((item) => item.requestType)} options={requestTypesOptions} + dataTestId={dataTestId ? `${dataTestId}Dropdown` : null} /> {Boolean(helperText) && ( diff --git a/packages/components/src/components/atoms/form/RequestTypeItem.tsx b/packages/components/src/components/atoms/form/RequestTypeItem.tsx index b8a794f0..bd961f4c 100644 --- a/packages/components/src/components/atoms/form/RequestTypeItem.tsx +++ b/packages/components/src/components/atoms/form/RequestTypeItem.tsx @@ -56,6 +56,7 @@ export interface IRequestTypeItem { requestTypesOptions: IRequestTypesOptions[] categoriesList: ITreeItem[] showError?: boolean + dataTestId?: string } interface IPropsComponent { @@ -72,6 +73,7 @@ function RequestTypeItem(props: IRequestTypeItem): JSX.Element { requestTypesOptions, categoriesList, showError, + dataTestId, } = props const { t } = useTranslation('common') @@ -200,6 +202,7 @@ function RequestTypeItem(props: IRequestTypeItem): JSX.Element { onChange={(val: boolean): void => onChangeApplyToAll(requestTypeOption, val) } + dataTestId={dataTestId ? `${dataTestId}Checkbox` : null} /> @@ -210,6 +213,9 @@ function RequestTypeItem(props: IRequestTypeItem): JSX.Element { disabledValue={t(item.labelAll)} options={options} value={limitationsData as ISearchLimitations[]} + dataTestId={ + dataTestId ? `${dataTestId}TextFieldTagsMultiple` : null + } /> )} diff --git a/packages/components/src/components/atoms/form/Slider.tsx b/packages/components/src/components/atoms/form/Slider.tsx index fe6d1a63..38d187e0 100644 --- a/packages/components/src/components/atoms/form/Slider.tsx +++ b/packages/components/src/components/atoms/form/Slider.tsx @@ -21,6 +21,7 @@ export interface ISliderProps value: number width?: number required?: boolean + dataTestId?: string } const indicatorNumber = [-99, 0, 100] @@ -38,6 +39,7 @@ function Slider(props: ISliderProps): JSX.Element { required, value, width, + dataTestId, } = props function handleChange(_: Event, value: number): void { @@ -81,6 +83,7 @@ function Slider(props: ISliderProps): JSX.Element { }, }, }} + data-testid={dataTestId} /> {Boolean(helperText) && ( diff --git a/packages/components/src/components/atoms/form/TextFieldTagsMultiple.tsx b/packages/components/src/components/atoms/form/TextFieldTagsMultiple.tsx index 6d0fb88d..f715d149 100644 --- a/packages/components/src/components/atoms/form/TextFieldTagsMultiple.tsx +++ b/packages/components/src/components/atoms/form/TextFieldTagsMultiple.tsx @@ -34,6 +34,7 @@ export interface ITextFieldTagsMultipleProps value: ISearchLimitations[] onChange?: (value: ISearchLimitations[]) => void showError?: boolean + dataTestId?: string } function TextFieldTagsMultiple( @@ -54,6 +55,7 @@ function TextFieldTagsMultiple( infoTooltip, options, showError, + dataTestId, } = props const { t } = useTranslation('common') @@ -191,6 +193,7 @@ function TextFieldTagsMultiple( value={option?.value} options={newOptionsList} sx={{ marginBottom: 1 }} + dataTestId={dataTestId ? `${dataTestId}DropDown` : null} /> } + data-testid={dataTestId ? `${dataTestId}AddButton` : null} > {t('Add')} diff --git a/packages/components/src/components/atoms/form/TextFieldTagsWithoutError.tsx b/packages/components/src/components/atoms/form/TextFieldTagsWithoutError.tsx index e3f7500d..fc32065b 100644 --- a/packages/components/src/components/atoms/form/TextFieldTagsWithoutError.tsx +++ b/packages/components/src/components/atoms/form/TextFieldTagsWithoutError.tsx @@ -112,6 +112,7 @@ export interface ITextFieldTag extends Omit { withCleanButton?: boolean onChange?: (value: string[]) => void onRemoveItem?: () => void + dataTestId?: string } function TextFieldTagsWithoutError( @@ -135,6 +136,7 @@ function TextFieldTagsWithoutError( size, disabledValue, withCleanButton, + dataTestId, } = props const { t } = useTranslation('common') @@ -183,6 +185,7 @@ function TextFieldTagsWithoutError(
{withCleanButton === true && ( { if (value.length > 0) { onChange([]) @@ -251,6 +254,7 @@ function TextFieldTagsWithoutError( if (event.code === 'Enter') manageTags(undefined, event) }} inputRef={ref} + dataTestId={dataTestId ? `${dataTestId}InputText` : null} /> )} diff --git a/packages/components/src/components/atoms/help/Help.tsx b/packages/components/src/components/atoms/help/Help.tsx index b1035478..2c137711 100644 --- a/packages/components/src/components/atoms/help/Help.tsx +++ b/packages/components/src/components/atoms/help/Help.tsx @@ -47,6 +47,7 @@ function Help(): JSX.Element { return ( setHelpVisible(true)} onMouseLeave={(): void => setHelpVisible(false)} onFocus={(): void => setHelpVisible(true)} diff --git a/packages/components/src/components/atoms/help/HelpOver.tsx b/packages/components/src/components/atoms/help/HelpOver.tsx index 9869055e..d2a7e5f0 100644 --- a/packages/components/src/components/atoms/help/HelpOver.tsx +++ b/packages/components/src/components/atoms/help/HelpOver.tsx @@ -24,7 +24,7 @@ const CustomA = styled('a')({ function HelpOver(): JSX.Element { return ( - + Helpdesk diff --git a/packages/components/src/components/atoms/help/__snapshots__/Help.test.tsx.snap b/packages/components/src/components/atoms/help/__snapshots__/Help.test.tsx.snap index 27b9c53a..08830056 100644 --- a/packages/components/src/components/atoms/help/__snapshots__/Help.test.tsx.snap +++ b/packages/components/src/components/atoms/help/__snapshots__/Help.test.tsx.snap @@ -4,6 +4,7 @@ exports[`Help match snapshot Help simple 1`] = `
- + {!menuChildren && ( - + {label} diff --git a/packages/components/src/components/atoms/menu/MenuItemIcon.tsx b/packages/components/src/components/atoms/menu/MenuItemIcon.tsx index 00d647be..a9bec650 100644 --- a/packages/components/src/components/atoms/menu/MenuItemIcon.tsx +++ b/packages/components/src/components/atoms/menu/MenuItemIcon.tsx @@ -188,7 +188,10 @@ function MenuItemIcon(props: IProps): JSX.Element { */ if (childPadding) { return ( - + +
- + setOpenUserMenu(!openUserMenu)}> - + - + diff --git a/packages/components/src/components/atoms/userMenu/UserMenuShow.tsx b/packages/components/src/components/atoms/userMenu/UserMenuShow.tsx index bd9a0ce7..be01b2ae 100644 --- a/packages/components/src/components/atoms/userMenu/UserMenuShow.tsx +++ b/packages/components/src/components/atoms/userMenu/UserMenuShow.tsx @@ -56,11 +56,13 @@ function UserMenuShow({ user }: IProps): JSX.Element { return ( - + - {t('log.out')} + + {t('log.out')} + ) } diff --git a/packages/components/src/components/atoms/userMenu/__snapshots__/UserMenu.test.tsx.snap b/packages/components/src/components/atoms/userMenu/__snapshots__/UserMenu.test.tsx.snap index b26b5b42..5fb00af7 100644 --- a/packages/components/src/components/atoms/userMenu/__snapshots__/UserMenu.test.tsx.snap +++ b/packages/components/src/components/atoms/userMenu/__snapshots__/UserMenu.test.tsx.snap @@ -4,6 +4,7 @@ exports[`UserMenu match snapshot UserMenu 1`] = `
Admin@example.com
@@ -41,12 +43,14 @@ exports[`UserMenu match snapshot UserMenu 1`] = ` >
Admin@example.com
@@ -55,6 +59,7 @@ exports[`UserMenu match snapshot UserMenu 1`] = ` />
log.out
diff --git a/packages/components/src/components/molecules/layout/Menu/Menu.tsx b/packages/components/src/components/molecules/layout/Menu/Menu.tsx index 4bb074ea..d0f665ec 100644 --- a/packages/components/src/components/molecules/layout/Menu/Menu.tsx +++ b/packages/components/src/components/molecules/layout/Menu/Menu.tsx @@ -70,7 +70,7 @@ function Menu(props: IProps): JSX.Element { if (!itemRouterTabs[item.code]) { return ( - + - + {item.children?.map((item: IMenuChild) => { path = removeFirstCharIfExist('/', item?.path) @@ -113,7 +113,7 @@ function Menu(props: IProps): JSX.Element { ) } return ( -
+
diff --git a/packages/components/src/components/molecules/layout/Sidebar/__snapshots__/Sidebar.test.tsx.snap b/packages/components/src/components/molecules/layout/Sidebar/__snapshots__/Sidebar.test.tsx.snap index 70b098b2..a227dd3e 100644 --- a/packages/components/src/components/molecules/layout/Sidebar/__snapshots__/Sidebar.test.tsx.snap +++ b/packages/components/src/components/molecules/layout/Sidebar/__snapshots__/Sidebar.test.tsx.snap @@ -4,6 +4,7 @@ exports[`SideBar match snapshot SideBarStateFalse 1`] = `