Skip to content

Commit fdc3630

Browse files
authored
✨ Add testing identifier to new upload modal (#797)
1 parent 4c10de7 commit fdc3630

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

tdrive/frontend/src/app/components/file-uploads/pending-root-components/pending-root-list.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ const ModalHeader: React.FC<ModalHeaderProps> = ({
3232
modalExpanded,
3333
}) => (
3434
<div className="w-full flex bg-[#45454A] text-white p-4 items-center justify-between">
35-
<p className="testid:upload-modal-head-status">
35+
<p className="testid:upload-root-modal-head-status">
3636
{uploadingCount > 0
3737
? `${Languages.t('general.uploading')} ${uploadingCount}`
3838
: `${Languages.t('general.uploaded')} ${completedCount}`}{' '}
3939
{Languages.t('general.files')}
4040
</p>
4141
<button
42-
className="ml-auto flex items-center testid:upload-modal-toggle-arrow"
42+
className="ml-auto flex items-center testid:upload-root-modal-toggle-arrow"
4343
onClick={toggleModal}
4444
>
4545
{modalExpanded ? <ArrowDownIcon /> : <ArrowUpIcon />}
@@ -64,14 +64,14 @@ const ModalFooter: React.FC<ModalFooterProps> = ({
6464
<div className="flex space-x-4 ml-auto">
6565
{uploadingCount > 0 && (
6666
<button
67-
className="text-blue-500 px-4 py-2 rounded hover:bg-blue-600 hover:text-white testid:upload-modal-pause-resume"
67+
className="text-blue-500 px-4 py-2 rounded hover:bg-blue-600 hover:text-white testid:upload-root-modal-pause-resume"
6868
onClick={pauseOrResumeUpload}
6969
>
7070
{isPaused() ? Languages.t('general.resume') : Languages.t('general.pause')}
7171
</button>
7272
)}
7373
<button
74-
className="text-blue-500 px-4 py-2 rounded hover:bg-blue-600 hover:text-white testid:upload-modal-cancel-close"
74+
className="text-blue-500 px-4 py-2 rounded hover:bg-blue-600 hover:text-white testid:upload-root-modal-cancel-close"
7575
onClick={cancelUpload}
7676
>
7777
{uploadingCount ? Languages.t('general.cancel') : Languages.t('general.close')}
@@ -112,7 +112,7 @@ const PendingRootList = ({
112112
return (
113113
<>
114114
{totalRoots > 0 && (
115-
<div className="fixed bottom-4 right-4 w-1/3 shadow-lg rounded-sm overflow-hidden testid:upload-modal">
115+
<div className="fixed bottom-4 right-4 w-1/3 shadow-lg rounded-sm overflow-hidden testid:upload-root-modal">
116116
<ModalHeader
117117
uploadingCount={uploadingCount + pausedCount}
118118
completedCount={completedCount}

tdrive/frontend/src/app/components/file-uploads/pending-root-components/pending-root-row.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ const PendingRootRow = ({
110110
};
111111

112112
return (
113-
<div className="root-row">
113+
<div className="root-row testid:upload-root-modal-row">
114114
<div className="root-details mt-2">
115115
<div className="flex items-center">
116116
<div className="w-10 h-10 flex items-center justify-center bg-[#f3f3f7] rounded-md">
117-
<div className="w-full h-full flex items-center justify-center testid:upload-modal-row-type">
117+
<div className="w-full h-full flex items-center justify-center testid:upload-root-modal-row-type">
118118
{itemTypeIcon(firstPendingFile?.type)}
119119
</div>
120120
</div>
@@ -134,7 +134,7 @@ const PendingRootRow = ({
134134
{isUploadCompleted ? (
135135
<button
136136
onClick={handleShowFolder}
137-
className="hover:bg-gray-100 p-2 rounded-md transition-all duration-200 testid:upload-modal-row-show-folder"
137+
className="hover:bg-gray-100 p-2 rounded-md transition-all duration-200 testid:upload-root-modal-row-show-folder"
138138
>
139139
{!isFileRoot && (
140140
<>
@@ -158,18 +158,23 @@ const PendingRootRow = ({
158158
!['cancelled', 'failed'].includes(root.status) &&
159159
firstPendingFile?.status !== 'error' && (
160160
<>
161-
<button
162-
onClick={() => pauseOrResumeRootUpload(rootKey)}
163-
className="hover:bg-blue-100 p-2 rounded-md transition-all duration-200 testid:upload-modal-row-pause-resume"
164-
>
165-
{root.status === 'paused' ? (
161+
{root.status === 'paused' ? (
162+
<button
163+
onClick={() => pauseOrResumeRootUpload(rootKey)}
164+
className="hover:bg-blue-100 p-2 rounded-md transition-all duration-200 testid:upload-root-modal-row-resume"
165+
>
166166
<ResumeIcon className="hover:scale-110 transition-transform duration-200" />
167-
) : (
167+
</button>
168+
) : (
169+
<button
170+
onClick={() => pauseOrResumeRootUpload(rootKey)}
171+
className="hover:bg-blue-100 p-2 rounded-md transition-all duration-200 testid:upload-root-modal-row-pause"
172+
>
168173
<PauseIcon className="hover:scale-110 transition-transform duration-200" />
169-
)}
170-
</button>
174+
</button>
175+
)}
171176
<button
172-
className="ml-2 hover:bg-red-100 p-2 rounded-md transition-all duration-200 testid:upload-modal-row-cancel"
177+
className="ml-2 hover:bg-red-100 p-2 rounded-md transition-all duration-200 testid:upload-root-modal-row-cancel"
173178
onClick={() => cancelRootUpload(rootKey)}
174179
>
175180
<CancelIcon className="hover:scale-110 transition-transform duration-200" />
@@ -185,7 +190,7 @@ const PendingRootRow = ({
185190
{!showFolder && (
186191
<div className="w-full h-[3px] bg-[#F0F2F3]">
187192
<div
188-
className={`testid:upload-modal-row-progress h-full ${
193+
className={`testid:upload-root-modal-row-progress h-full ${
189194
root.status === 'failed'
190195
? 'bg-[#FF0000]' // Red color for failed uploads
191196
: root.status === 'cancelled'

0 commit comments

Comments
 (0)