Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,13 @@ export const uploadCSVAndWaitForGrid = async (
}

await page.setInputFiles('[type="file"]', actualFilePath);
await page.getByTestId('upload-file-widget').waitFor({ state: 'hidden' });
await page
.getByTestId('upload-file-widget')
.waitFor({ state: 'hidden', timeout: 30000 });

await expect(page.locator('.rdg-header-row')).toBeVisible();
await page
.locator('.rdg-header-row')
.waitFor({ state: 'visible', timeout: 30000 });
const rowCount = await page.locator('.rdg-row').count();
return { rowCount, tempFilePath };
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,23 @@ const UploadFile: FC<UploadFileProps> = ({
const handleUpload: UploadProps['customRequest'] = useCallback(
(options: UploadRequestOption) => {
setUploading(true);
const reader = new FileReader();
reader.onload = (e) => {
setUploading(false);
onCSVUploaded(e);
};
reader.onerror = () => {
setUploading(false);
showErrorToast(new Error(t('server.unexpected-error')) as AxiosError);
};
try {
const reader = new FileReader();
reader.onload = onCSVUploaded;
reader.onerror = () => {
throw t('server.unexpected-error');
};
reader.readAsText(options.file as Blob);
} catch (error) {
showErrorToast(error as AxiosError);
} finally {
setUploading(false);
showErrorToast(error as AxiosError);
}
},
[onCSVUploaded]
[onCSVUploaded, t]
);

return uploading ? (
Expand Down
Loading