From c59545aff1559a2c61b97618de641a91ba5b6f9b Mon Sep 17 00:00:00 2001 From: lethemanh Date: Thu, 12 Dec 2024 13:33:58 +0700 Subject: [PATCH] :art: [element-identifier]: Update test id convention --- .../frontend/src/app/atoms/avatar/index.tsx | 15 +++-- .../src/app/atoms/input/input-checkbox.tsx | 6 +- .../frontend/src/app/atoms/loader/index.tsx | 2 +- .../frontend/src/app/atoms/modal/confirm.tsx | 6 +- .../src/app/components/banner/banner.tsx | 8 ++- .../connection-indicator.tsx | 8 +-- .../pending-file-row.tsx | 12 ++-- .../pending-files-list.tsx | 2 +- .../app/components/modal/modal-component.tsx | 1 + .../src/app/components/modal/modal-manager.ts | 7 ++- .../new-version/new-version-component.tsx | 6 +- .../new-version/new-version-modal.tsx | 2 +- .../components/object-modal/object-modal.tsx | 6 +- .../search-popup/parts/drive-item-result.tsx | 10 +-- .../components/search-popup/search-input.tsx | 2 +- .../app/molecules/grouped-rows/user/index.tsx | 7 ++- .../app/views/client/body/drive/browser.tsx | 19 +++--- .../client/body/drive/documents/common.tsx | 1 - .../body/drive/documents/document-icon.tsx | 5 +- .../body/drive/documents/document-row.tsx | 5 +- .../body/drive/documents/folder-row.tsx | 5 +- .../views/client/body/drive/header-path.tsx | 14 ++++- .../drive/modals/confirm-delete/index.tsx | 2 +- .../body/drive/modals/confirm-move/index.tsx | 4 +- .../body/drive/modals/confirm-trash/index.tsx | 2 +- .../body/drive/modals/manage-users/common.tsx | 3 +- .../body/drive/modals/manage-users/index.tsx | 7 ++- .../body/drive/modals/properties/index.tsx | 4 +- .../modals/public-link/expiry-editor-row.tsx | 10 +-- .../body/drive/modals/public-link/index.tsx | 4 +- .../public-link/password-editor-row.tsx | 10 +-- .../body/drive/modals/selector/index.tsx | 62 ++++++++++--------- .../update-access/internal-users-access.tsx | 10 +-- .../client/body/drive/modals/upload/index.tsx | 28 ++++----- .../body/drive/modals/versions/index.tsx | 2 +- .../client/body/drive/shared-files-table.tsx | 15 ++++- .../app/views/client/body/drive/shared.tsx | 12 ++-- .../src/app/views/client/common/account.tsx | 1 + .../src/app/views/client/common/app-grid.tsx | 1 + .../src/app/views/client/common/search.tsx | 8 +-- .../src/app/views/client/header/index.tsx | 6 +- .../frontend/src/app/views/client/index.tsx | 2 +- .../src/app/views/client/side-bar/actions.tsx | 22 +++---- .../src/app/views/client/side-bar/index.tsx | 2 +- .../views/client/viewer/archive/display.tsx | 4 +- .../app/views/client/viewer/code/display.tsx | 2 +- .../src/app/views/client/viewer/display.tsx | 2 +- .../views/client/viewer/images/display.tsx | 2 +- .../app/views/client/viewer/other/display.tsx | 4 +- .../app/views/client/viewer/pdf/display.tsx | 2 +- .../views/client/viewer/videos/display.tsx | 2 +- .../src/app/views/client/viewer/viewer.tsx | 16 ++--- 52 files changed, 220 insertions(+), 180 deletions(-) diff --git a/tdrive/frontend/src/app/atoms/avatar/index.tsx b/tdrive/frontend/src/app/atoms/avatar/index.tsx index 961370e9..a6b554fc 100644 --- a/tdrive/frontend/src/app/atoms/avatar/index.tsx +++ b/tdrive/frontend/src/app/atoms/avatar/index.tsx @@ -40,7 +40,8 @@ export default function Avatar(props: AvatarProps) { const fontSize = fontSizes[props.size || 'md']; const addedClassName = props.className || ''; const avatarTitle = props.title || ''; - const restProps = _.omit(props, 'size', 'type', 'avatar', 'title', 'className', 'icon'); + const testClassId = props.testClassId; + const restProps = _.omit(props, 'size', 'type', 'avatar', 'title', 'className', 'icon', 'testClassId'); let className = `w-${avatarSize} h-${avatarSize} ${ avatarType === 'circle' ? 'rounded-full' : 'rounded-sm' @@ -65,17 +66,19 @@ export default function Avatar(props: AvatarProps) { ? {} : { backgroundImage: `url('${getGradient(props.title || '')}')` }; + const testId = testClassId ? `testid:${testClassId}` : '' + if (props.icon) { className += ' '; return (
{props.icon} @@ -85,18 +88,18 @@ export default function Avatar(props: AvatarProps) { if (props.avatar) { return ( -
+
{props.title}
); } return ( -
+
{letters.toUpperCase()}
); diff --git a/tdrive/frontend/src/app/atoms/input/input-checkbox.tsx b/tdrive/frontend/src/app/atoms/input/input-checkbox.tsx index 102639d7..b019b618 100644 --- a/tdrive/frontend/src/app/atoms/input/input-checkbox.tsx +++ b/tdrive/frontend/src/app/atoms/input/input-checkbox.tsx @@ -8,10 +8,13 @@ export const Checkbox = (props: { value?: boolean; className?: string; disabled?: boolean; + testClassId?: string; }) => { const renderSwitch = () => { const className = props.className || ''; + const testId = props.testClassId ? `testid:${props.testClassId}` : ''; + return (
!props.label && !props.disabled && props.onChange && props.onChange(!props.value) diff --git a/tdrive/frontend/src/app/atoms/loader/index.tsx b/tdrive/frontend/src/app/atoms/loader/index.tsx index a2692306..d3dfd63b 100644 --- a/tdrive/frontend/src/app/atoms/loader/index.tsx +++ b/tdrive/frontend/src/app/atoms/loader/index.tsx @@ -1,7 +1,7 @@ export const Loader = (props: { className?: string }) => { return ( { }; } return <> - + { className="ml-2" theme={props.buttonOkTheme || "danger"} onClick={dialogCloseHandler(true)} - testClassId="confirm-modal-button-confirm" + testClassId="button-confirm" > {Languages.t(props.buttonOkLabel)} diff --git a/tdrive/frontend/src/app/components/banner/banner.tsx b/tdrive/frontend/src/app/components/banner/banner.tsx index 49f711f6..db775619 100644 --- a/tdrive/frontend/src/app/components/banner/banner.tsx +++ b/tdrive/frontend/src/app/components/banner/banner.tsx @@ -15,6 +15,7 @@ type PropsType = { contentColumnStyle?: CSSProperties; className?: string; children?: JSX.Element | JSX.Element[]; + testClassId?: string; }; const Banner: FC = ({ @@ -27,6 +28,7 @@ const Banner: FC = ({ style, contentColumnStyle, className, + testClassId, }) => { const headerStyle = { height: height ? height : 68, @@ -34,13 +36,15 @@ const Banner: FC = ({ ...style, }; + const testId = testClassId ? `testid:${testClassId}` : '' + return ( - + {content || children || ''} - {closable && } + {closable && } diff --git a/tdrive/frontend/src/app/components/connection-indicator/connection-indicator.tsx b/tdrive/frontend/src/app/components/connection-indicator/connection-indicator.tsx index 7da21911..a22c00c6 100644 --- a/tdrive/frontend/src/app/components/connection-indicator/connection-indicator.tsx +++ b/tdrive/frontend/src/app/components/connection-indicator/connection-indicator.tsx @@ -12,19 +12,19 @@ export default () => { const [{ connected, reconnecting }] = useRecoilState(ConnectedState); return ( -
+
{connected === false && reconnecting !== true && ( -
+
{Languages.t('general.connexion_status.disconnected')}
)} {connected === false && reconnecting === true && ( -
+
{Languages.t('general.connexion_status.connecting')}
)} {connected === true && ( -
+
{Languages.t('general.connexion_status.connected')}
)} diff --git a/tdrive/frontend/src/app/components/file-uploads/pending-file-components/pending-file-row.tsx b/tdrive/frontend/src/app/components/file-uploads/pending-file-components/pending-file-row.tsx index 6c48f4c6..6002c519 100644 --- a/tdrive/frontend/src/app/components/file-uploads/pending-file-components/pending-file-row.tsx +++ b/tdrive/frontend/src/app/components/file-uploads/pending-file-components/pending-file-row.tsx @@ -76,7 +76,7 @@ export default ({ pendingFileState, pendingFile }: PropsType) => { maxWidth: isPendingFileStatusPause(pendingFile.status) ? 130 : 160, verticalAlign: 'middle', }} - className="testid:pending-file-name" + className="testid:file-name" > {capitalize(pendingFile?.originalFile.name)} @@ -100,6 +100,7 @@ export default ({ pendingFileState, pendingFile }: PropsType) => { {pendingFile?.label ? ( { ? Languages.t('general.resume') : Languages.t('general.pause') } + className="pending-file-row-tooltip-file-status" > } diff --git a/tdrive/frontend/src/app/components/object-modal/object-modal.tsx b/tdrive/frontend/src/app/components/object-modal/object-modal.tsx index 697b1e3c..414fcf67 100644 --- a/tdrive/frontend/src/app/components/object-modal/object-modal.tsx +++ b/tdrive/frontend/src/app/components/object-modal/object-modal.tsx @@ -38,7 +38,7 @@ const ObjectModal: FC = (props: PropsType) => { hasSider={false} style={props.style || {}} > -
+
{props.titleCenter && } {props.title && ( @@ -62,7 +62,7 @@ const ObjectModal: FC = (props: PropsType) => { type="times" className={`m-icon-small square-button ${ props.headerStyle?.backgroundColor ? 'red' : '' - }`} + } testid:button-close-modal`} onClick={() => (props?.onClose ? props.onClose() : ModalManager.closeAll())} /> @@ -71,7 +71,7 @@ const ObjectModal: FC = (props: PropsType) => {
{props.children && {props.children}} {props.footer && ( -