diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexApplication.spec.ts b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexApplication.spec.ts index 3a4c16e0fa23..192a2a318416 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexApplication.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexApplication.spec.ts @@ -25,6 +25,19 @@ const visitSearchApplicationPage = () => { verifyResponseStatusCode('@getSearchIndexingApplication', 200); }; +const verifyLastExecutionRun = (interceptedUrlLabel: string) => { + cy.wait(`@${interceptedUrlLabel}`).then((interception) => { + expect(interception.response.statusCode).to.eq(200); + + // Validate the last execution run response + const responseData = interception.response.body; + if (responseData.data.length > 0) { + expect(responseData.data).to.have.length(1); + expect(responseData.data[0].status).to.equal('success'); + } + }); +}; + describe('Search Index Application', { tags: 'Settings' }, () => { beforeEach(() => { cy.login(); @@ -36,6 +49,16 @@ describe('Search Index Application', { tags: 'Settings' }, () => { verifyResponseStatusCode('@getApplications', 200); }); + it('Verify last execution run', () => { + interceptURL( + 'GET', + '/api/v1/apps/name/SearchIndexingApplication/status?offset=0&limit=1', + 'lastExecutionRun' + ); + visitSearchApplicationPage(); + verifyLastExecutionRun('lastExecutionRun'); + }); + it('Edit application', () => { interceptURL('PATCH', '/api/v1/apps/*', 'updateApplication'); visitSearchApplicationPage(); @@ -114,5 +137,16 @@ describe('Search Index Application', { tags: 'Settings' }, () => { verifyResponseStatusCode('@getSearchIndexingApplication', 200); cy.get('[data-testid="run-now-button"]').click(); verifyResponseStatusCode('@triggerPipeline', 200); + + cy.wait(120000); // waiting for 2 minutes before we check if reindex was success + + interceptURL( + 'GET', + '/api/v1/apps/name/SearchIndexingApplication/status?offset=0&limit=1', + 'lastExecutionRun' + ); + + cy.reload(); + verifyLastExecutionRun('lastExecutionRun'); }); });