From 505690e5239e8fd79f82a5584ec8465e6703c23a Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Sun, 26 May 2024 14:12:27 +0530 Subject: [PATCH] cypress: fixed aut failure part 7 (#16371) * cypress: fixed aut failure part 7 * updated cypress * fixed failing cypress --- .../ui/cypress/common/DataInsightUtils.ts | 3 ++- .../ui/cypress/common/Utils/Owner.ts | 9 +++------ .../ui/cypress/common/Utils/Users.ts | 7 +------ .../ui/cypress/e2e/Pages/DataInsight.spec.ts | 4 ++-- .../e2e/Pages/GlossaryVersionPage.spec.ts | 2 +- .../e2e/Pages/SearchIndexApplication.spec.ts | 10 ++++------ .../ui/cypress/e2e/Pages/Users.spec.ts | 19 +++++++++---------- .../AppSchedule/AppSchedule.component.tsx | 6 ++++-- 8 files changed, 26 insertions(+), 34 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/DataInsightUtils.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/DataInsightUtils.ts index f172da110c34..cb22164d30ff 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/DataInsightUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/DataInsightUtils.ts @@ -11,9 +11,10 @@ * limitations under the License. */ import { SidebarItem } from '../constants/Entity.interface'; -import { interceptURL, RETRY_TIMES, verifyResponseStatusCode } from './common'; +import { interceptURL, verifyResponseStatusCode } from './common'; const BASE_WAIT_TIME = 4000; +const RETRY_TIMES = 3; let isSuccessStatus = false; export const checkDataInsightSuccessStatus = ( diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Owner.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Owner.ts index ccd2b914fba1..3ba6cee3d889 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Owner.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Owner.ts @@ -65,12 +65,12 @@ export const validateOwnerAndTeamCounts = () => { }; export const addOwner = (ownerName: string, dataTestId?: string) => { + interceptURL('GET', '/api/v1/users?*isBot=false*', 'getUsers'); cy.get('[data-testid="edit-owner"]').click(); cy.get("[data-testid='select-owner-tabs']").should('be.visible'); - cy.log('/api/v1/users?limit=*&isBot=false*'); cy.get('.ant-tabs [id*=tab-users]').click(); - + verifyResponseStatusCode('@getUsers', 200); interceptURL( 'GET', `api/v1/search/query?q=*&index=user_search_index*`, @@ -94,7 +94,6 @@ export const addOwner = (ownerName: string, dataTestId?: string) => { export const updateOwner = (ownerName: string, dataTestId?: string) => { cy.get('[data-testid="edit-owner"]').click(); - cy.get("[data-testid='select-owner-tabs']").should('be.visible'); cy.log('/api/v1/users?limit=*&isBot=false*'); cy.get('.ant-tabs [id*=tab-users]').click(); @@ -129,11 +128,9 @@ export const removeOwner = (ownerName: string, dataTestId?: string) => { interceptURL('PATCH', `/api/v1/**`, 'patchOwner'); - cy.get('[data-testid="select-owner-tabs"]').should('be.visible'); - cy.get( '[data-testid="select-owner-tabs"] [data-testid="remove-owner"]' - ).scrollIntoView({ offset: { top: -100, left: 0 } }); + ).should('be.visible'); cy.get( '[data-testid="select-owner-tabs"] [data-testid="remove-owner"]' diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Users.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Users.ts index e6de01053a2f..a8ce674160e9 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Users.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Users.ts @@ -14,7 +14,6 @@ import { customFormatDateTime, getEpochMillisForFutureDays, } from '../../../src/utils/date-time/DateTimeUtils'; -import { GlobalSettingOptions } from '../../constants/settings.constant'; import { descriptionBox, interceptURL, @@ -166,10 +165,6 @@ export const permanentDeleteUser = (username: string, displayName: string) => { cy.get('[data-testid="search-error-placeholder"]').should('be.exist'); }; -export const visitUserListPage = () => { - interceptURL('GET', '/api/v1/users?*', 'getUsers'); - cy.settingClick(GlobalSettingOptions.USERS); -}; export const generateToken = () => { cy.get('[data-testid="no-token"]').should('be.visible'); @@ -202,7 +197,7 @@ export const updateExpiration = (expiry: number | string) => { cy.get('[data-testid="token-expiry"]').click(); cy.contains(`${expiry} days`).click(); const expiryDate = customFormatDateTime( - getEpochMillisForFutureDays(expiry), + getEpochMillisForFutureDays(expiry as number), `ccc d'th' MMMM, yyyy` ); cy.get('[data-testid="save-edit"]').click(); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsight.spec.ts b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsight.spec.ts index 69cb20d9f5c5..7465b7616d7f 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsight.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsight.spec.ts @@ -242,7 +242,7 @@ describe('Data Insight feature', { tags: 'Observability' }, () => { cy.sidebarClick(SidebarItem.DATA_INSIGHT); verifyResponseStatusCode('@dataInsightsChart', 200); cy.get('[data-menu-id*="kpi"]').click(); - verifyResponseStatusCode('@dataInsightsChart', 200); + verifyResponseStatusCode('@getKpi', 200); cy.get('[data-testid="kpi-card"]').should('be.visible'); cy.get( '[data-row-key="cypress-description-with-percentage-completed-description-fraction"]' @@ -283,7 +283,7 @@ describe('Data Insight feature', { tags: 'Observability' }, () => { cy.sidebarClick(SidebarItem.DATA_INSIGHT); verifyResponseStatusCode('@dataInsightsChart', 200); cy.get('[data-menu-id*="kpi"]').click(); - verifyResponseStatusCode('@dataInsightsChart', 200); + verifyResponseStatusCode('@getKpi', 200); KPI_DATA.map((data) => { cy.get(`[data-testid="delete-action-${data.displayName}"]`).click(); cy.get('[data-testid="confirmation-text-input"]').type('DELETE'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/GlossaryVersionPage.spec.ts b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/GlossaryVersionPage.spec.ts index 38516eef8a11..1efa9a7fae6a 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/GlossaryVersionPage.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/GlossaryVersionPage.spec.ts @@ -415,7 +415,7 @@ describe( .scrollIntoView() .should('be.visible'); - cy.get('[data-testid="version-button"]').click(); + cy.get('[data-testid="version-button"]').scrollIntoView().click(); verifyResponseStatusCode('@getGlossaryTermParents', 200); verifyResponseStatusCode('@getChildGlossaryTerms', 200); 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 01b62e44d43f..1bed63512b1b 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 @@ -64,12 +64,10 @@ describe('Search Index Application', { tags: 'Settings' }, () => { visitSearchApplicationPage(); cy.get('[data-testid="edit-button"]').click(); cy.get('[data-testid="cron-type"]').click(); - cy.get('.rc-virtual-list [title="Day"]').click(); - cy.get('[data-testid="hour-options"]').click(); - cy.get('[title="01"]').click(); + cy.get('.rc-virtual-list [title="None"]').click(); cy.get('.ant-modal-body [data-testid="deploy-button"]').click(); verifyResponseStatusCode('@updateApplication', 200); - cy.get('[data-testid="cron-string"]').should('contain', 'At 01:00 AM'); + cy.get('[data-testid="schedule-type"]').should('contain', 'None'); cy.get('[data-testid="configuration"]').click(); @@ -114,8 +112,8 @@ describe('Search Index Application', { tags: 'Settings' }, () => { cy.get('[data-testid="save-button"]').scrollIntoView().click(); cy.get('[data-testid="submit-btn"]').scrollIntoView().click(); cy.get('[data-testid="cron-type"]').click(); - cy.get('.rc-virtual-list [title="Day"]').click(); - cy.get('[data-testid="cron-type"]').should('contain', 'Day'); + cy.get('.rc-virtual-list [title="None"]').click(); + cy.get('[data-testid="cron-type"]').should('contain', 'None'); cy.get('[data-testid="deploy-button"]').click(); verifyResponseStatusCode('@installApplication', 201); verifyResponseStatusCode('@getApplications', 200); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Users.spec.ts b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Users.spec.ts index 6aabc91337fe..cb1032d1c716 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Users.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Users.spec.ts @@ -34,7 +34,6 @@ import { revokeToken, updateDetails, updateExpiration, - visitUserListPage, } from '../../common/Utils/Users'; import { BASE_URL, @@ -46,8 +45,8 @@ import { import { EntityType, SidebarItem } from '../../constants/Entity.interface'; import { GlobalSettingOptions, - SETTINGS_OPTIONS_PATH, SETTING_CUSTOM_PROPERTIES_PATH, + SETTINGS_OPTIONS_PATH, } from '../../constants/settings.constant'; const entity = new UsersTestClass(); @@ -118,7 +117,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => { it('Create Data Consumer User', () => { cy.login(); - visitUserListPage(); + entity.visitUserListPage(); addUser({ ...user, role: DATA_CONSUMER_ROLE.name }); cy.logout(); }); @@ -145,7 +144,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => { it(`Update token expiration`, () => { cy.login(user.email, user.newPassword); - visitUserListPage(); + entity.visitUserListPage(); Object.values(expirationTime).forEach((expiry) => { updateExpiration(expiry); }); @@ -225,7 +224,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => { it('Update Data Steward details', () => { // change role from consumer to steward cy.login(); - visitUserListPage(); + entity.visitUserListPage(); editRole(user.name, DATA_STEWARD_ROLE.name); cy.logout(); // login to steward user @@ -243,7 +242,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => { it('Token generation & revocation for Data Steward', () => { cy.login(user.email, user.newStewardPassword); - visitUserListPage(); + entity.visitUserListPage(); cy.get('[data-testid="dropdown-profile"]').click({ force: true }); cy.get('[data-testid="user-name"] > .ant-typography').click({ force: true, @@ -255,7 +254,7 @@ describe('User with different Roles', { tags: 'Settings' }, () => { it(`Update token expiration for Data Steward`, () => { cy.login(user.email, user.newStewardPassword); - visitUserListPage(); + entity.visitUserListPage(); Object.values(expirationTime).forEach((expiry) => { updateExpiration(expiry); }); @@ -307,19 +306,19 @@ describe('User with different Roles', { tags: 'Settings' }, () => { it('Admin Soft delete user', () => { cy.login(); - visitUserListPage(); + entity.visitUserListPage(); entity.softDeleteUser(user.name, user.updatedDisplayName); }); it('Admin Restore soft deleted user', () => { cy.login(); - visitUserListPage(); + entity.visitUserListPage(); entity.restoreSoftDeletedUser(user.name, user.updatedDisplayName); }); it('Admin Permanent Delete User', () => { cy.login(); - visitUserListPage(); + entity.visitUserListPage(); entity.permanentDeleteUser(user.name, user.updatedDisplayName); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Applications/AppSchedule/AppSchedule.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Applications/AppSchedule/AppSchedule.component.tsx index d3e71c4c13a9..901df85801be 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Applications/AppSchedule/AppSchedule.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Applications/AppSchedule/AppSchedule.component.tsx @@ -26,9 +26,9 @@ import { AppType, } from '../../../../generated/entity/applications/app'; import { getIngestionPipelineByFqn } from '../../../../rest/ingestionPipelineAPI'; -import Loader from '../../../common/Loader/Loader'; import { TestSuiteIngestionDataType } from '../../../DataQuality/AddDataQualityTest/AddDataQualityTest.interface'; import TestSuiteScheduler from '../../../DataQuality/AddDataQualityTest/components/TestSuiteScheduler'; +import Loader from '../../../common/Loader/Loader'; import AppRunsHistory from '../AppRunsHistory/AppRunsHistory.component'; import { AppRunsHistoryRef } from '../AppRunsHistory/AppRunsHistory.interface'; import { AppScheduleProps } from './AppScheduleProps.interface'; @@ -155,7 +155,9 @@ const AppSchedule = ({ {t('label.schedule-type')} - + {(appData.appSchedule as AppScheduleClass).scheduleTimeline ?? ''}