diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ApiServiceRest.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ApiServiceRest.spec.ts index d2be0bb45dc..23627174f05 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ApiServiceRest.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ApiServiceRest.spec.ts @@ -104,6 +104,6 @@ test.describe('API service', () => { await deleteResponse; - await toastNotification(page, /Delete operation initiated for/); + await toastNotification(page, /deleted successfully!/); }); }); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/VersionPages/EntityVersionPages.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/VersionPages/EntityVersionPages.spec.ts index 3a2c075f638..17f46a7b9b2 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/VersionPages/EntityVersionPages.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/VersionPages/EntityVersionPages.spec.ts @@ -257,7 +257,7 @@ test.describe('Entity Version pages', () => { await deleteResponse; - await toastNotification(page, /Delete operation initiated for/); + await toastNotification(page, /deleted successfully!/); await page.reload(); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/VersionPages/ServiceEntityVersionPage.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/VersionPages/ServiceEntityVersionPage.spec.ts index 8895284e780..f0da8a02151 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/VersionPages/ServiceEntityVersionPage.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/VersionPages/ServiceEntityVersionPage.spec.ts @@ -215,7 +215,7 @@ test.describe('Service Version pages', () => { await deleteResponse; - await toastNotification(page, /Delete operation initiated for/); + await toastNotification(page, /deleted successfully!/); await page.reload(); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts index 718e4df7027..bb6abdb097b 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts @@ -117,9 +117,10 @@ export const getEntityTypeSearchIndexMapping = (entityType: string) => { export const toastNotification = async ( page: Page, - message: string | RegExp + message: string | RegExp, + timeout: number ) => { - await expect(page.getByTestId('alert-bar')).toHaveText(message); + await expect(page.getByTestId('alert-bar')).toHaveText(message, { timeout }); await expect(page.getByTestId('alert-icon')).toBeVisible(); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts index d134f3d623d..fc18a44813e 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts @@ -1248,7 +1248,7 @@ export const softDeleteEntity = async ( await deleteResponse; - await toastNotification(page, /Delete operation initiated for/); + await toastNotification(page, /deleted successfully!/); await page.reload(); @@ -1313,7 +1313,7 @@ export const hardDeleteEntity = async ( await page.click('[data-testid="confirm-button"]'); await deleteResponse; - await toastNotification(page, /Delete operation initiated for/); + await toastNotification(page, /deleted successfully!/); }; export const checkDataAssetWidget = async (page: Page, serviceType: string) => { diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/serviceIngestion.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/serviceIngestion.ts index 0b4fcac41a6..2aa42721829 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/serviceIngestion.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/serviceIngestion.ts @@ -120,10 +120,7 @@ export const deleteService = async ( await deleteResponse; // Closing the toast notification - await toastNotification( - page, - `Delete operation initiated for ${serviceName}` - ); + await toastNotification(page, /deleted successfully!/, 5 * 60 * 1000); // Wait for up to 5 minutes for the toast notification to appear await page.waitForSelector(`[data-testid="service-name-${serviceName}"]`, { state: 'hidden', diff --git a/openmetadata-ui/src/main/resources/ui/src/context/AsyncDeleteProvider/AsyncDeleteProvider.tsx b/openmetadata-ui/src/main/resources/ui/src/context/AsyncDeleteProvider/AsyncDeleteProvider.tsx index fb058c3f379..d88cbdde141 100644 --- a/openmetadata-ui/src/main/resources/ui/src/context/AsyncDeleteProvider/AsyncDeleteProvider.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/context/AsyncDeleteProvider/AsyncDeleteProvider.tsx @@ -57,8 +57,8 @@ const AsyncDeleteProvider = ({ children }: AsyncDeleteProviderProps) => { deleteType === DeleteType.HARD_DELETE ); - // In case of recursive delete if false and entity has data. - // sometime socket throw the error before the response + // In case of recursive delete if false and the deleting entity has data. + // sometime socket throw the error before the API response if (asyncDeleteJobRef.current?.status === 'FAILED') { showErrorToast( asyncDeleteJobRef.current.error ?? @@ -92,6 +92,23 @@ const AsyncDeleteProvider = ({ children }: AsyncDeleteProviderProps) => { }; setAsyncDeleteJob(updatedAsyncDeleteJob); asyncDeleteJobRef.current = updatedAsyncDeleteJob; + + if (response.status === 'FAILED') { + showErrorToast( + response.error ?? + t('server.delete-entity-error', { + entity: response.entityName, + }) + ); + } + + if (response.status === 'COMPLETED') { + showSuccessToast( + t('server.entity-deleted-successfully', { + entity: response.entityName, + }) + ); + } }; const activityFeedContextValues = useMemo(() => {