diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/CustomizeLandingPageUtils.js b/openmetadata-ui/src/main/resources/ui/cypress/common/CustomizeLandingPageUtils.js index 17609e5d33c..283d641eb42 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/CustomizeLandingPageUtils.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/CustomizeLandingPageUtils.js @@ -13,6 +13,7 @@ // eslint-disable-next-line spaced-comment /// +import { SidebarItem } from '../constants/Entity.interface'; import { interceptURL, toastNotification, @@ -47,7 +48,7 @@ export const navigateToCustomizeLandingPage = ({ }) => { interceptURL('GET', '/api/v1/teams/name/*', 'settingsPage'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@settingsPage', 200); cy.get('[data-testid="settings-left-panel"]').should('be.visible'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js b/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js index 3891927c7a6..2e00aaa6dab 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js @@ -17,6 +17,7 @@ import { NAME_VALIDATION_ERROR, SEARCH_ENTITY_TABLE, } from '../constants/constants'; +import { SidebarItem } from '../constants/Entity.interface'; import { descriptionBox, interceptURL, @@ -145,7 +146,7 @@ export const updateAssets = (domainObj) => { cy.get('[data-testid="domain-link"]').should('contain', domainObj.name); - cy.sidebarClick('app-bar-item-domain'); + cy.sidebarClick(SidebarItem.DOMAIN); goToAssetsTab(domainObj); @@ -179,7 +180,7 @@ export const removeAssets = (domainObj) => { cy.get('[data-testid="remove-owner"]').click(); verifyResponseStatusCode('@patchDomain', 200); - cy.sidebarClick('app-bar-item-domain'); + cy.sidebarClick(SidebarItem.DOMAIN); goToAssetsTab(domainObj); cy.contains('Adding a new Asset is easy, just give it a spin!').should( diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/ServiceBaseClass.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/ServiceBaseClass.ts index 6941ff1d6d7..cf61ca3a8a7 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/ServiceBaseClass.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/ServiceBaseClass.ts @@ -14,6 +14,7 @@ import { INVALID_NAMES, NAME_VALIDATION_ERROR, } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; import { interceptURL, replaceAllSpacialCharWith_, @@ -354,7 +355,7 @@ class ServiceBaseClass { verifyResponseStatusCode('@updateEntity', 200); // re-run ingestion flow - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); // Services page cy.get('.ant-menu-title-content').contains(this.category).click(); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/UserClass.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/UserClass.ts index 124241ff28c..49d6155f219 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/UserClass.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/UserClass.ts @@ -16,6 +16,7 @@ import { interceptURL, verifyResponseStatusCode, } from '../../common/common'; +import { SidebarItem } from '../../constants/Entity.interface'; import { VISIT_SERVICE_PAGE_DETAILS } from '../../constants/service.constants'; import { permanentDeleteUser, @@ -31,7 +32,7 @@ class UsersTestClass { } visitUserListPage() { - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); interceptURL('GET', '/api/v1/users?*', 'getUsers'); cy.get('[data-testid="settings-left-panel"]').contains('Users').click(); } @@ -76,14 +77,14 @@ class UsersTestClass { } checkStewardServicesPermissions() { - cy.sidebarClick('app-bar-item-explore'); + cy.sidebarClick(SidebarItem.EXPLORE); Object.values(VISIT_SERVICE_PAGE_DETAILS).forEach((service) => { - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); cy.get(`[data-menu-id*="${service.settingsMenuId}"]`).click(); cy.get('[data-testid="add-service-button"] > span').should('not.exist'); }); - cy.sidebarClick('app-bar-item-explore'); + cy.sidebarClick(SidebarItem.EXPLORE); cy.get('[data-testid="tables-tab"]').click(); cy.get( '.ant-drawer-title > [data-testid="entity-link"] > .ant-typography' diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/GlossaryUtils.js b/openmetadata-ui/src/main/resources/ui/cypress/common/GlossaryUtils.js index 2b570dbf0b9..bf823c527b4 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/GlossaryUtils.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/GlossaryUtils.js @@ -14,6 +14,7 @@ /// import { DELETE_TERM } from '../constants/constants'; +import { SidebarItem } from '../constants/Entity.interface'; import { interceptURL, toastNotification, @@ -23,15 +24,7 @@ import { export const visitGlossaryPage = () => { interceptURL('GET', '/api/v1/glossaries?fields=*', 'getGlossaries'); - cy.sidebarHover(); - cy.get('[data-testid="governance"]').click({ - animationDistanceThreshold: 20, - waitForAnimations: true, - }); - - // Applying force true as the hover over tooltip - - cy.sidebarClick('app-bar-item-glossary'); + cy.sidebarClick(SidebarItem.GLOSSARY); verifyResponseStatusCode('@getGlossaries', 200); }; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/TagUtils.js b/openmetadata-ui/src/main/resources/ui/cypress/common/TagUtils.js index 446dadf8a0a..62429c83bb9 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/TagUtils.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/TagUtils.js @@ -17,6 +17,7 @@ import { NAME_VALIDATION_ERROR, TAG_INVALID_NAMES, } from '../constants/constants'; +import { SidebarItem } from '../constants/Entity.interface'; import { interceptURL, verifyResponseStatusCode } from './common'; export const submitForm = () => { @@ -59,13 +60,7 @@ export const validateForm = () => { export const visitClassificationPage = () => { interceptURL('GET', '/api/v1/tags*', 'getTags'); - cy.sidebarHover(); - cy.get('[data-testid="governance"]').click({ - animationDistanceThreshold: 20, - waitForAnimations: true, - }); - - cy.sidebarClick('app-bar-item-tags'); + cy.sidebarClick(SidebarItem.TAGS); verifyResponseStatusCode('@getTags', 200); }; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/CustomProperty.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/CustomProperty.ts index 07a2324c783..baffc00b6f5 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/CustomProperty.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/CustomProperty.ts @@ -11,7 +11,7 @@ * limitations under the License. */ -import { EntityType } from '../../constants/Entity.interface'; +import { EntityType, SidebarItem } from '../../constants/Entity.interface'; import { interceptURL, verifyResponseStatusCode } from '../common'; export enum CustomPropertyType { @@ -41,7 +41,7 @@ export const createCustomPropertyForEntity = ({ }) => { interceptURL('GET', '/api/v1/teams/name/*', 'settingsPage'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@settingsPage', 200); @@ -81,7 +81,7 @@ export const deleteCustomPropertyForEntity = ({ property: CustomProperty; type: EntityType; }) => { - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); interceptURL('GET', `/api/v1/metadata/types/name/*`, 'getEntity'); interceptURL('PATCH', `/api/v1/metadata/types/*`, 'patchEntity'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Services.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Services.ts index 76ca9eb6f9e..22c408aaf4e 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Services.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Services.ts @@ -11,7 +11,7 @@ * limitations under the License. */ import { DELETE_TERM } from '../../constants/constants'; -import { EntityType } from '../../constants/Entity.interface'; +import { EntityType, SidebarItem } from '../../constants/Entity.interface'; import { interceptURL, toastNotification, @@ -38,7 +38,7 @@ export const goToServiceListingPage = (services: Services) => { 'getSettingsPage' ); // Click on settings page - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@getSettingsPage', 200); // Services page interceptURL('GET', '/api/v1/services/*', 'getServiceList'); 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 e460ab51184..bfd11699a12 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,6 +14,7 @@ import { customFormatDateTime, getEpochMillisForFutureDays, } from '../../../src/utils/date-time/DateTimeUtils'; +import { SidebarItem } from '../../constants/Entity.interface'; import { descriptionBox, interceptURL, @@ -170,7 +171,7 @@ export const permanentDeleteUser = (username: string) => { cy.get('[data-testid="search-error-placeholder"]').should('be.exist'); }; export const visitUserListPage = () => { - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); interceptURL('GET', '/api/v1/users?*', 'getUsers'); cy.get('[data-testid="settings-left-panel"]').contains('Users').click(); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/advancedSearch.js b/openmetadata-ui/src/main/resources/ui/cypress/common/advancedSearch.js index 632b8ea31dc..df19359e75c 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/advancedSearch.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/advancedSearch.js @@ -12,6 +12,7 @@ */ import { SEARCH_ENTITY_TABLE } from '../constants/constants'; +import { SidebarItem } from '../constants/Entity.interface'; import { DATABASE_DETAILS, DATABASE_SERVICE_DETAILS, @@ -229,7 +230,7 @@ export const searchForField = (condition, fieldid, searchCriteria, index) => { export const goToAdvanceSearch = () => { // Navigate to explore page - cy.sidebarClick('app-bar-item-explore'); + cy.sidebarClick(SidebarItem.EXPLORE); cy.get('[data-testid="advance-search-button"]').click(); cy.get('[data-testid="reset-btn"]').click(); }; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js index bdeddb18221..01046536ba2 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -30,6 +30,7 @@ import { NAME_VALIDATION_ERROR, SEARCH_INDEX, } from '../constants/constants'; +import { SidebarItem } from '../constants/Entity.interface'; export const descriptionBox = '.toastui-editor-md-container > .toastui-editor > .ProseMirror'; @@ -425,7 +426,7 @@ export const deleteCreatedService = ( 'getSettingsPage' ); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@getSettingsPage', 200); // Services page @@ -511,7 +512,7 @@ export const goToAddNewServicePage = (service_type) => { 'getSettingsPage' ); // Click on settings page - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@getSettingsPage', 200); // Services page @@ -967,7 +968,7 @@ export const updateDescriptionForIngestedTables = ( verifyResponseStatusCode('@updateEntity', 200); // re-run ingestion flow - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); // Services page cy.get('.ant-menu-title-content').contains(type).should('be.visible').click(); @@ -1141,7 +1142,7 @@ export const visitServiceDetailsPage = ( ); interceptURL('GET', '/api/v1/teams/name/*', 'getOrganization'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@getOrganization', 200); @@ -1173,7 +1174,7 @@ export const visitServiceDetailsPage = ( export const visitDataModelPage = (dataModelFQN, dataModelName) => { interceptURL('GET', '/api/v1/teams/name/*', 'getOrganization'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@getOrganization', 200); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/serviceUtils.js b/openmetadata-ui/src/main/resources/ui/cypress/common/serviceUtils.js index d5e673ccd55..9ed9a2a14b0 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/serviceUtils.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/serviceUtils.js @@ -10,6 +10,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { SidebarItem } from '../constants/Entity.interface'; import { interceptURL, verifyResponseStatusCode } from './common'; export const searchServiceFromSettingPage = (service) => { @@ -24,7 +25,7 @@ export const searchServiceFromSettingPage = (service) => { }; export const visitServiceDetailsPage = (service, verifyHeader = true) => { - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); // Services page interceptURL('GET', '/api/v1/services/*', 'getServices'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/Entity.interface.ts b/openmetadata-ui/src/main/resources/ui/cypress/constants/Entity.interface.ts index 80baa51afac..fd48d3cf5b9 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/Entity.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/Entity.interface.ts @@ -94,3 +94,19 @@ export const SEARCH_INDEX: Record< [EntityType.Glossary]: 'glossary_search_index', [EntityType.Domain]: 'domain_search_index', } as const; + +export enum SidebarItem { + EXPLORE = 'explore', + OBSERVABILITY = 'observability', + DATA_QUALITY = 'data-quality', + INCIDENT_MANAGER = 'incident-manager', + OBSERVABILITY_ALERT = 'observability-alert', + DATA_INSIGHT = 'data-insight', + DOMAIN = 'domain', + GOVERNANCE = 'governance', + GLOSSARY = 'glossary', + TAGS = 'tags', + INSIGHTS = 'insights', + SETTINGS = 'settings', + LOGOUT = 'logout', +} diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/sidebar.constant.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/sidebar.constant.js new file mode 100644 index 00000000000..36867a49f69 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/sidebar.constant.js @@ -0,0 +1,33 @@ +/* + * Copyright 2024 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { SidebarItem } from './Entity.interface'; + +export const SIDEBAR_LIST_ITEMS = { + [SidebarItem.DATA_QUALITY]: [ + SidebarItem.OBSERVABILITY, + SidebarItem.DATA_QUALITY, + ], + [SidebarItem.INCIDENT_MANAGER]: [ + SidebarItem.OBSERVABILITY, + SidebarItem.INCIDENT_MANAGER, + ], + [SidebarItem.OBSERVABILITY_ALERT]: [ + SidebarItem.OBSERVABILITY, + SidebarItem.OBSERVABILITY_ALERT, + ], + [SidebarItem.GLOSSARY]: [SidebarItem.GOVERNANCE, SidebarItem.GLOSSARY], + [SidebarItem.TAGS]: [SidebarItem.GOVERNANCE, SidebarItem.TAGS], + + // Profile Dropdown + 'user-name': ['dropdown-profile', 'user-name'], +}; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/IncidentManager.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/IncidentManager.spec.js index 3ab72acc62a..12f1f8f47c9 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/IncidentManager.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/IncidentManager.spec.js @@ -19,6 +19,7 @@ import { } from '../../common/common'; import { createEntityTableViaREST } from '../../common/Utils/Entity'; import { DATA_ASSETS, NEW_TABLE_TEST_CASE } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; import { DATABASE_SERVICE } from '../../constants/EntityConstant'; const TABLE_NAME = DATABASE_SERVICE.entity.name; @@ -148,9 +149,7 @@ describe('Incident Manager', () => { }); it('Assign incident to user', () => { - cy.sidebarHover(); - cy.get("[data-testid='observability'").click(); - cy.sidebarClick('app-bar-item-incident-manager'); + cy.sidebarClick(SidebarItem.INCIDENT_MANAGER); cy.get(`[data-testid="test-case-${NEW_TABLE_TEST_CASE.name}"]`).should( 'be.visible' ); @@ -187,9 +186,9 @@ describe('Incident Manager', () => { 'getTestCase' ); interceptURL('GET', '/api/v1/feed?entityLink=*&type=Task', 'getTaskFeed'); - cy.sidebarHover(); - cy.get("[data-testid='observability'").click(); - cy.sidebarClick('app-bar-item-incident-manager'); + + cy.sidebarClick(SidebarItem.INCIDENT_MANAGER); + cy.get(`[data-testid="test-case-${NEW_TABLE_TEST_CASE.name}"]`).click(); verifyResponseStatusCode('@getTestCase', 200); cy.get('[data-testid="incident"]').click(); @@ -226,9 +225,7 @@ describe('Incident Manager', () => { 'getTestCase' ); interceptURL('GET', '/api/v1/feed?entityLink=*&type=Task', 'getTaskFeed'); - cy.sidebarHover(); - cy.get("[data-testid='observability'").click(); - cy.sidebarClick('app-bar-item-incident-manager'); + cy.sidebarClick(SidebarItem.INCIDENT_MANAGER); cy.get(`[data-testid="test-case-${NEW_TABLE_TEST_CASE.name}"]`).click(); verifyResponseStatusCode('@getTestCase', 200); cy.get('[data-testid="incident"]').click(); @@ -338,9 +335,8 @@ describe('Incident Manager', () => { '/api/v1/dataQuality/testCases/testCaseIncidentStatus?latest=true&startTs=*&endTs=*&limit=*', 'getIncidentList' ); - cy.sidebarHover(); - cy.get("[data-testid='observability'").click(); - cy.sidebarClick('app-bar-item-incident-manager'); + cy.sidebarClick(SidebarItem.INCIDENT_MANAGER); + verifyResponseStatusCode('@getIncidentList', 200); cy.get(`[data-testid="test-case-${testName}"]`).should('be.visible'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/SchemaSearch.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/SchemaSearch.spec.js index 301498abba2..03e847311fb 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/SchemaSearch.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/SchemaSearch.spec.js @@ -15,6 +15,7 @@ import { interceptURL, verifyResponseStatusCode } from '../../common/common'; import { searchServiceFromSettingPage } from '../../common/serviceUtils'; +import { SidebarItem } from '../../constants/Entity.interface'; const schemaNames = ['sales', 'admin', 'anonymous', 'dip', 'gsmadmin_internal']; let serviceId; @@ -87,7 +88,7 @@ describe('Schema search', () => { 'getSettingsPage' ); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@getSettingsPage', 200); // Services page diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/TeamsHierarchy.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/TeamsHierarchy.spec.js index 3703f675030..0883357659a 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/TeamsHierarchy.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/TeamsHierarchy.spec.js @@ -17,6 +17,7 @@ import { uuid, verifyResponseStatusCode, } from '../../common/common'; +import { SidebarItem } from '../../constants/Entity.interface'; const buTeamName = `bu-${uuid()}`; const divTeamName = `div-${uuid()}`; @@ -40,7 +41,7 @@ describe('Add nested teams and test TeamsSelectable', () => { interceptURL('GET', '/api/v1/teams/name/*', 'getOrganization'); interceptURL('GET', '/api/v1/permissions/team/name/*', 'getPermissions'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@getOrganization', 200); }); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddRoleAndAssignToUser.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddRoleAndAssignToUser.spec.js index 78a5836b299..f042c43175f 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddRoleAndAssignToUser.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddRoleAndAssignToUser.spec.js @@ -18,6 +18,7 @@ import { verifyResponseStatusCode, } from '../../common/common'; import { BASE_URL } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; const roleName = `Role-test-${uuid()}`; const userName = `usercttest${uuid()}`; @@ -28,7 +29,7 @@ describe('Test Add role and assign it to the user', () => { cy.login(); interceptURL('GET', '*api/v1/roles*', 'getRoles'); interceptURL('GET', '/api/v1/users?*', 'usersPage'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); }); it('Create role', () => { diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AdvancedSearchQuickFilters.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AdvancedSearchQuickFilters.spec.js index 264a149afa1..ae8b80b3933 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AdvancedSearchQuickFilters.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AdvancedSearchQuickFilters.spec.js @@ -16,6 +16,7 @@ import { searchAndClickOnOption } from '../../common/advancedSearchQuickFilters' import { interceptURL, verifyResponseStatusCode } from '../../common/common'; import { QUICK_FILTERS_BY_ASSETS } from '../../constants/advancedSearchQuickFilters.constants'; import { SEARCH_ENTITY_TABLE } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; const ownerName = 'Aaron Johnson'; describe(`Advanced search quick filters should work properly for assets`, () => { @@ -35,7 +36,7 @@ describe(`Advanced search quick filters should work properly for assets`, () => it(`should show the quick filters for respective assets`, () => { // Navigate to explore page - cy.sidebarClick('app-bar-item-explore'); + cy.sidebarClick(SidebarItem.EXPLORE); QUICK_FILTERS_BY_ASSETS.map((asset) => { cy.get(`[data-testid="${asset.tab}"]`).scrollIntoView().click(); @@ -52,7 +53,7 @@ describe(`Advanced search quick filters should work properly for assets`, () => const asset = QUICK_FILTERS_BY_ASSETS[0]; // Navigate to explore page - cy.sidebarClick('app-bar-item-explore'); + cy.sidebarClick(SidebarItem.EXPLORE); cy.get(`[data-testid="${asset.tab}"]`).scrollIntoView().click(); asset.filters @@ -77,7 +78,7 @@ describe(`Advanced search quick filters should work properly for assets`, () => }); const testIsNullAndIsNotNullFilters = (operatorTitle, queryFilter, alias) => { - cy.sidebarClick('app-bar-item-explore'); + cy.sidebarClick(SidebarItem.EXPLORE); const asset = QUICK_FILTERS_BY_ASSETS[0]; cy.get(`[data-testid="${asset.tab}"]`).scrollIntoView().click(); cy.get('[data-testid="advance-search-button"]').click(); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Collect.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Collect.spec.js index 7157e583818..eece92fe2bf 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Collect.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Collect.spec.js @@ -12,40 +12,37 @@ */ import { interceptURL } from '../../common/common'; +import { SidebarItem } from '../../constants/Entity.interface'; describe('Collect end point should work properly', () => { const PAGES = { setting: { name: 'Settings', - mainMenuId: `[data-testid="app-bar-item-settings"]`, + menuId: SidebarItem.SETTINGS, }, explore: { name: 'Explore', - mainMenuId: `[data-testid="app-bar-item-explore"]`, + menuId: SidebarItem.EXPLORE, }, dataQuality: { name: 'Quality', - mainMenuId: `[data-testid="observability"]`, - subMenu: `[data-testid="app-bar-item-data-quality"]`, + menuId: SidebarItem.DATA_QUALITY, }, incidentManager: { name: 'Incident Manager', - mainMenuId: `[data-testid="observability"]`, - subMenu: `[data-testid="app-bar-item-incident-manager"]`, + menuId: SidebarItem.INCIDENT_MANAGER, }, insight: { name: 'Insights', - mainMenuId: `[data-testid="app-bar-item-data-insight"]`, + menuId: SidebarItem.DATA_INSIGHT, }, glossary: { name: 'Glossary', - mainMenuId: `[data-testid="governance"]`, - subMenu: `[data-testid="app-bar-item-glossary"]`, + menuId: SidebarItem.GLOSSARY, }, tag: { name: 'Tags', - mainMenuId: `[data-testid="governance"]`, - subMenu: `[data-testid="app-bar-item-tags"]`, + menuId: SidebarItem.TAGS, }, }; @@ -66,16 +63,7 @@ describe('Collect end point should work properly', () => { Object.values(PAGES).map((page) => { it(`Visit ${page.name} page should trigger collect API`, () => { - cy.sidebarHover(); - cy.get(page.mainMenuId) - .should('be.visible') - .click({ animationDistanceThreshold: 10 }); - if (page.subMenu) { - // adding manual wait to open dropdown in UI - cy.wait(500); - cy.get(page.subMenu).should('be.visible').click({ force: true }); - } - cy.sidebarHoverOutside(); + cy.sidebarClick(page.menuId); assertCollectEndPoint(); }); }); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/PersonaFlow.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/PersonaFlow.spec.js index dd6a754c363..d67f76bae9c 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/PersonaFlow.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/PersonaFlow.spec.js @@ -20,6 +20,7 @@ import { verifyResponseStatusCode, } from '../../common/common'; import { DELETE_TERM } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; import { PERSONA_DETAILS, USER_DETAILS } from '../../constants/EntityConstant'; const updatePersonaDisplayName = (displayName) => { @@ -78,7 +79,7 @@ describe('Persona operations', () => { cy.login(); interceptURL('GET', '/api/v1/teams/name/*', 'settingsPage'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@settingsPage', 200); cy.get('[data-testid="settings-left-panel"]').should('be.visible'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Alerts.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Alerts.spec.js index ea2da021d7d..4833a61c967 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Alerts.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Alerts.spec.js @@ -22,6 +22,7 @@ import { verifyResponseStatusCode, } from '../../common/common'; import { DELETE_TERM, DESTINATION, TEST_CASE } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; const alertForAllAssets = `Alert-ct-test-${uuid()}`; const description = 'This is alert description'; @@ -62,7 +63,7 @@ describe.skip('Alerts page should work properly', () => { interceptURL('POST', '/api/v1/events/subscriptions', 'createAlert'); interceptURL('GET', `/api/v1/search/query?q=*`, 'getSearchResult'); cy.login(); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); interceptURL('GET', '/api/v1/events/subscriptions?*', 'alertsPage'); cy.get('[data-testid="global-setting-left-panel"]') .contains('Alerts') diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Bots.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Bots.spec.js index 67be0b148f0..c610f306cf7 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Bots.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Bots.spec.js @@ -21,6 +21,7 @@ import { verifyResponseStatusCode, } from '../../common/common'; import { DELETE_TERM } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; const botName = `Bot-ct-test-${uuid()}`; const botEmail = `${botName}@mail.com`; @@ -70,7 +71,7 @@ const revokeToken = () => { describe('Bots Page should work properly', () => { beforeEach(() => { cy.login(); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); interceptURL( 'GET', 'api/v1/bots?limit=*&include=non-deleted', diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/CustomLogoConfig.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/CustomLogoConfig.spec.js index c4cf70856cc..05cf1106d8c 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/CustomLogoConfig.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/CustomLogoConfig.spec.js @@ -14,6 +14,7 @@ /// import { interceptURL, verifyResponseStatusCode } from '../../common/common'; +import { SidebarItem } from '../../constants/Entity.interface'; const config = { logo: 'https://custom-logo.png', @@ -26,7 +27,7 @@ describe('Custom Logo Config', () => { beforeEach(() => { cy.login(); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); interceptURL( 'GET', diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Customproperties.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Customproperties.spec.js index e9027a96796..cdb85db4ca3 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Customproperties.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Customproperties.spec.js @@ -19,12 +19,13 @@ import { verifyResponseStatusCode, } from '../../common/common'; import { ENTITIES, uuid } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; describe('Custom Properties should work properly', () => { beforeEach(() => { cy.login(); interceptURL('GET', '/api/v1/teams/name/*', 'settingsPage'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@settingsPage', 200); cy.get('[data-testid="settings-left-panel"]').should('be.visible'); }); @@ -57,7 +58,7 @@ describe('Custom Properties should work properly', () => { ); // Navigating back to custom properties page - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`) .scrollIntoView() .click(); @@ -128,7 +129,7 @@ describe('Custom Properties should work properly', () => { ); // Navigating back to custom properties page - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); // Selecting the entity cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`) .scrollIntoView() @@ -202,7 +203,7 @@ describe('Custom Properties should work properly', () => { ); // Navigating back to custom properties page - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`) .scrollIntoView() .should('be.visible') @@ -273,7 +274,7 @@ describe('Custom Properties should work properly', () => { ); // Navigating to explore page - cy.sidebarClick('app-bar-item-explore'); + cy.sidebarClick(SidebarItem.EXPLORE); interceptURL( 'GET', `/api/v1/metadata/types/name/glossaryTerm*`, diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsight.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsight.spec.js index a69ed0ef230..ee1e3844c8b 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsight.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsight.spec.js @@ -23,6 +23,7 @@ import { verifyResponseStatusCode, } from '../../common/common'; import { checkDataInsightSuccessStatus } from '../../common/DataInsightUtils'; +import { SidebarItem } from '../../constants/Entity.interface'; const KPI_DATA = [ { @@ -93,13 +94,13 @@ describe('Data Insight feature', () => { }); it('Initial setup', () => { - cy.sidebarClick('app-bar-item-data-insight'); + cy.sidebarClick(SidebarItem.DATA_INSIGHT); verifyResponseStatusCode('@dataInsightsChart', 200); deleteKpiRequest(); }); it('Create description and owner KPI', () => { - cy.sidebarClick('app-bar-item-data-insight'); + cy.sidebarClick(SidebarItem.DATA_INSIGHT); verifyResponseStatusCode('@dataInsightsChart', 200); cy.get('[data-menu-id*="kpi"]').click(); KPI_DATA.map((data) => { @@ -144,7 +145,7 @@ describe('Data Insight feature', () => { }); it('Verifying Data assets tab', () => { - cy.sidebarClick('app-bar-item-data-insight'); + cy.sidebarClick(SidebarItem.DATA_INSIGHT); verifyResponseStatusCode('@dataInsightsChart', 200); cy.get('[data-testid="search-dropdown-Team"]').should('be.visible'); cy.get('[data-testid="search-dropdown-Tier"]').should('be.visible'); @@ -170,7 +171,7 @@ describe('Data Insight feature', () => { }); it('Verifying App analytics tab', () => { - cy.sidebarClick('app-bar-item-data-insight'); + cy.sidebarClick(SidebarItem.DATA_INSIGHT); verifyResponseStatusCode('@dataInsightsChart', 200); cy.get('[data-menu-id*="app-analytics"]').click(); verifyResponseStatusCode('@dataInsightsChart', 200); @@ -192,7 +193,7 @@ describe('Data Insight feature', () => { }); it('Verifying KPI tab', () => { - cy.sidebarClick('app-bar-item-data-insight'); + cy.sidebarClick(SidebarItem.DATA_INSIGHT); verifyResponseStatusCode('@dataInsightsChart', 200); cy.get('[data-menu-id*="kpi"]').click(); verifyResponseStatusCode('@dataInsightsChart', 200); @@ -210,7 +211,7 @@ describe('Data Insight feature', () => { it('Update KPI', () => { interceptURL('GET', '/api/v1/kpi/name/*', 'fetchKpiByName'); interceptURL('PATCH', '/api/v1/kpi/*', 'updateKpi'); - cy.sidebarClick('app-bar-item-data-insight'); + cy.sidebarClick(SidebarItem.DATA_INSIGHT); verifyResponseStatusCode('@dataInsightsChart', 200); cy.get('[data-menu-id*="kpi"]').click(); verifyResponseStatusCode('@dataInsightsChart', 200); @@ -233,7 +234,7 @@ describe('Data Insight feature', () => { '/api/v1/kpi/*?hardDelete=true&recursive=false', 'deleteKpi' ); - cy.sidebarClick('app-bar-item-data-insight'); + cy.sidebarClick(SidebarItem.DATA_INSIGHT); verifyResponseStatusCode('@dataInsightsChart', 200); cy.get('[data-menu-id*="kpi"]').click(); verifyResponseStatusCode('@dataInsightsChart', 200); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsightAlert.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsightAlert.spec.js index 4cfb70fbd8a..49eaede3e47 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsightAlert.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsightAlert.spec.js @@ -16,6 +16,7 @@ import { toastNotification, verifyResponseStatusCode, } from '../../common/common'; +import { SidebarItem } from '../../constants/Entity.interface'; const dataInsightReport = { triggerType: 'Scheduled', @@ -30,8 +31,7 @@ const dataInsightReport = { describe.skip('Data Insight Alert', () => { beforeEach(() => { cy.login(); - cy.sidebarClick('app-bar-item-settings'); - + cy.sidebarClick(SidebarItem.SETTINGS); interceptURL( 'GET', 'api/v1/events/subscriptions/name/DataInsightReport?include=all', diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsightSettings.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsightSettings.spec.js index 51c050b6e04..14560c17553 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsightSettings.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataInsightSettings.spec.js @@ -12,13 +12,14 @@ */ import { interceptURL, verifyResponseStatusCode } from '../../common/common'; +import { SidebarItem } from '../../constants/Entity.interface'; describe('Data Insight settings page should work properly', () => { beforeEach(() => { cy.login(); interceptURL('GET', '/api/v1/teams/name/*', 'settingsPage'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@settingsPage', 200); cy.get('[data-testid="settings-left-panel"]').should('be.visible'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js index f8707ec4258..8713258b117 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js @@ -43,6 +43,7 @@ import { SERVICE_TYPE, TEAM_ENTITY, } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; import { DATABASE_SERVICE } from '../../constants/EntityConstant'; import { SERVICE_CATEGORIES } from '../../constants/service.constants'; @@ -114,13 +115,7 @@ const visitTestSuiteDetailsPage = (testSuiteName) => { ); interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase'); - cy.sidebarHover(); - - cy.get('[data-testid="observability"]').click(); - - cy.sidebarClick('app-bar-item-data-quality'); - - cy.sidebarHoverOutside(); + cy.sidebarClick(SidebarItem.DATA_QUALITY); cy.get('[data-testid="by-test-suites"]').click(); verifyResponseStatusCode('@testSuite', 200); @@ -214,11 +209,8 @@ describe('Data Quality and Profiler should work properly', () => { goToProfilerTab(); cy.get('[data-testid="no-profiler-placeholder"]').should('be.visible'); - cy.clickOnLogo(); - - cy.sidebarClick('app-bar-item-settings'); - + cy.sidebarClick(SidebarItem.SETTINGS); cy.get('[data-menu-id*="services.databases"]').should('be.visible').click(); cy.intercept('/api/v1/services/ingestionPipelines?*').as('ingestionData'); interceptURL( @@ -549,13 +541,7 @@ describe('Data Quality and Profiler should work properly', () => { 'getTestCase' ); - cy.sidebarHover(); - - cy.get('[data-testid="observability"]').click(); - - cy.sidebarClick('app-bar-item-data-quality'); - - cy.sidebarHoverOutside(); + cy.sidebarClick(SidebarItem.DATA_QUALITY); cy.get('[data-testid="by-test-suites"]').click(); verifyResponseStatusCode('@testSuite', 200); @@ -865,13 +851,7 @@ describe('Data Quality and Profiler should work properly', () => { it('Update displayName of test case', () => { interceptURL('GET', '/api/v1/dataQuality/testCases?*', 'getTestCase'); - cy.sidebarHover(); - - cy.get('[data-testid="observability"]').click(); - - cy.sidebarClick('app-bar-item-data-quality'); - - cy.sidebarHoverOutside(); + cy.sidebarClick(SidebarItem.DATA_QUALITY); cy.get('[data-testid="by-test-cases"]').click(); verifyResponseStatusCode('@getTestCase', 200); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Domains.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Domains.spec.js index f040f52e1dc..bf699b3ab0b 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Domains.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Domains.spec.js @@ -29,12 +29,12 @@ import { verifyDomain, } from '../../common/DomainUtils'; import { DOMAIN_1, DOMAIN_2, DOMAIN_3 } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; describe('Domain page should work properly', () => { beforeEach(() => { cy.login(); - - cy.sidebarClick('app-bar-item-domain'); + cy.sidebarClick(SidebarItem.DOMAIN); }); it('Create new domain flow should work properly', () => { @@ -59,14 +59,14 @@ describe('Domain page should work properly', () => { it('Create new data product should work properly', () => { DOMAIN_1.dataProducts.forEach((dataProduct) => { createDataProducts(dataProduct, DOMAIN_1); - cy.sidebarClick('app-bar-item-domain'); + cy.sidebarClick(SidebarItem.DOMAIN); }); }); it('Add data product assets using asset selection modal should work properly', () => { DOMAIN_2.dataProducts.forEach((dp) => { createDataProducts(dp, DOMAIN_2); - cy.sidebarClick('app-bar-item-domain'); + cy.sidebarClick(SidebarItem.DOMAIN); }); addAssetsToDataProduct(DOMAIN_2.dataProducts[0], DOMAIN_2); @@ -75,7 +75,7 @@ describe('Domain page should work properly', () => { it('Add data product assets using asset selection modal with separate domain and dp having space', () => { DOMAIN_3.dataProducts.forEach((dp) => { createDataProducts(dp, DOMAIN_3); - cy.sidebarClick('app-bar-item-domain'); + cy.sidebarClick(SidebarItem.DOMAIN); }); addAssetsToDataProduct(DOMAIN_3.dataProducts[0], DOMAIN_3); @@ -96,7 +96,7 @@ describe('Domain page should work properly', () => { 'tableSearchQuery' ); - cy.sidebarClick('app-bar-item-explore'); + cy.sidebarClick(SidebarItem.EXPLORE); verifyResponseStatusCode('@tableSearchQuery', 200); }); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Glossary.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Glossary.spec.js index b55f1a3bf3f..4b1e2d1ef2c 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Glossary.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Glossary.spec.js @@ -44,6 +44,7 @@ import { NEW_GLOSSARY_TERMS, SEARCH_ENTITY_TABLE, } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; const userName = `test_dataconsumer${uuid()}`; @@ -584,14 +585,7 @@ const voteGlossary = (isGlossary) => { const goToGlossaryPage = () => { interceptURL('GET', '/api/v1/glossaryTerms*', 'getGlossaryTerms'); interceptURL('GET', '/api/v1/glossaries?fields=*', 'fetchGlossaries'); - - cy.sidebarHover(); - cy.get('[data-testid="governance"]').click({ - animationDistanceThreshold: 20, - waitForAnimations: true, - }); - - cy.sidebarClick('app-bar-item-glossary', 'governance'); + cy.sidebarClick(SidebarItem.GLOSSARY); }; const approveGlossaryTermWorkflow = ({ glossary, glossaryTerm }) => { diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/LoginConfiguration.ts b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/LoginConfiguration.ts index 2987752e8bb..40b2d5a76f6 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/LoginConfiguration.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/LoginConfiguration.ts @@ -1,3 +1,5 @@ +import { SidebarItem } from '../../constants/Entity.interface'; + /* * Copyright 2023 Collate. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,8 +15,7 @@ describe('template spec', () => { beforeEach(() => { cy.login(); - - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); cy.get('[data-testid="settings-left-panel"]') .contains('Login Configuration') diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Policies.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Policies.spec.js index e82ad1d0dbb..da636c40255 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Policies.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Policies.spec.js @@ -18,6 +18,7 @@ import { verifyResponseStatusCode, } from '../../common/common'; import { BASE_URL } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; const roles = { dataConsumer: 'Data Consumer', @@ -100,7 +101,7 @@ describe('Policy page should work properly', () => { cy.login(); cy.intercept('GET', '*api/v1/policies*').as('getPolicies'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); cy.get('[data-testid="settings-left-panel"]') .contains('Policies') diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Roles.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Roles.spec.js index 05873e4dab7..ba6abdb88b1 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Roles.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Roles.spec.js @@ -18,6 +18,7 @@ import { verifyResponseStatusCode, } from '../../common/common'; import { BASE_URL } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; const roles = { dataConsumer: 'Data Consumer', @@ -61,7 +62,7 @@ describe('Roles page should work properly', () => { interceptURL('GET', '*api/v1/roles*', 'getRoles'); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); cy.get('[data-testid="settings-left-panel"]') .contains('Roles') diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexDetails.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexDetails.spec.js index dcb59105de9..ee17b5d664e 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexDetails.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/SearchIndexDetails.spec.js @@ -24,6 +24,7 @@ import { visitEntityDetailsPage, } from '../../common/common'; import { BASE_URL, uuid } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; import { SEARCH_INDEX_DETAILS_FOR_DETAILS_PAGE_TEST, SEARCH_INDEX_DISPLAY_NAME, @@ -190,7 +191,7 @@ describe('Prerequisite for data steward role tests', () => { // Assign data steward role to the created user - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); interceptURL('GET', `/api/v1/users?*`, 'getUsersList'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Service.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Service.spec.js index a2dc3fabf0c..799d0a5d458 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Service.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Service.spec.js @@ -18,6 +18,7 @@ import { } from '../../common/common'; import { searchServiceFromSettingPage } from '../../common/serviceUtils'; import { service } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; describe('Services page should work properly', () => { beforeEach(() => { @@ -39,7 +40,7 @@ describe('Services page should work properly', () => { cy.login(); // redirecting to services page - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); cy.get('[data-testid="settings-left-panel"]') .contains('Database') diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js index 2a7fc2ea649..a8a74b67f67 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js @@ -23,6 +23,7 @@ import { uuid, verifyResponseStatusCode, } from '../../common/common'; +import { SidebarItem } from '../../constants/Entity.interface'; const updatedDescription = 'This is updated description'; @@ -53,7 +54,7 @@ describe('Teams flow should work properly', () => { interceptURL('GET', `/api/v1/permissions/team/name/*`, 'permissions'); cy.login(); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); // Clicking on teams cy.get('[data-testid="settings-left-panel"]').contains('Teams').click(); 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 d63c9b5b8e2..fdfdcc6c758 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 @@ -32,7 +32,7 @@ import { ID, uuid, } from '../../constants/constants'; -import { EntityType } from '../../constants/Entity.interface'; +import { EntityType, SidebarItem } from '../../constants/Entity.interface'; import { NAVBAR_DETAILS } from '../../constants/redirections.constants'; const entity = new UsersTestClass(); @@ -110,16 +110,7 @@ describe('User with different Roles', () => { cy.url().should('eq', `${BASE_URL}/my-data`); // Check CRUD for Glossary - cy.sidebarHover(); - - cy.get(glossary.testid) - .should('be.visible') - .click({ animationDistanceThreshold: 10, waitForAnimations: true }); - if (glossary.subMenu) { - cy.get(glossary.subMenu).should('be.visible').click({ force: true }); - } - cy.clickOutside(); - + cy.sidebarClick(SidebarItem.GLOSSARY); cy.clickOnLogo(); // Check CRUD for Tags diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/redirections.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/redirections.spec.js index 732a4fd9327..a831b8d42e6 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/redirections.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/redirections.spec.js @@ -34,7 +34,6 @@ describe('Redirection link should work properly', () => { if (navbar.subMenu) { cy.get(navbar.subMenu).should('be.visible').click({ force: true }); } - // cy.get('body').click(); validateURL(navbar.url); cy.clickOnLogo(); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Service/redshiftWithDBT.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Service/redshiftWithDBT.spec.js index cba926a8242..566dc62b5a5 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Service/redshiftWithDBT.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Service/redshiftWithDBT.spec.js @@ -30,6 +30,7 @@ import { HTTP_CONFIG_SOURCE, SERVICE_TYPE, } from '../../constants/constants'; +import { SidebarItem } from '../../constants/Entity.interface'; import { REDSHIFT } from '../../constants/service.constants'; const dbtEntityFqn = `${REDSHIFT.serviceName}.${Cypress.env( @@ -106,7 +107,7 @@ describe('RedShift Ingestion', () => { '/api/v1/services/ingestionPipelines/*/pipelineStatus?startTs=*&endTs=*', 'pipelineStatus' ); - cy.sidebarClick('app-bar-item-settings'); + cy.sidebarClick(SidebarItem.SETTINGS); verifyResponseStatusCode('@getSettingsPage', 200); // Services page interceptURL('GET', '/api/v1/services/*', 'getServices'); @@ -223,10 +224,8 @@ describe('RedShift Ingestion', () => { `/api/v1/tags?*parent=${DBT.classification}*`, 'getTagList' ); - cy.sidebarHover(); - cy.get('[data-testid="governance"]').click(); - cy.sidebarClick('app-bar-item-tags'); + cy.sidebarClick(SidebarItem.TAGS); verifyResponseStatusCode('@fetchClassifications', 200); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/support/commands.js b/openmetadata-ui/src/main/resources/ui/cypress/support/commands.js index a520d101769..bb954f30e82 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/support/commands.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/support/commands.js @@ -38,6 +38,7 @@ import { interceptURL, verifyResponseStatusCode } from '../common/common'; import { BASE_URL, LOGIN } from '../constants/constants'; +import { SIDEBAR_LIST_ITEMS } from '../constants/sidebar.constant'; Cypress.Commands.add('loginByGoogleApi', () => { cy.log('Logging in to Google'); @@ -164,17 +165,24 @@ Cypress.Commands.add('logout', () => { Cypress.session.clearAllSavedSessions(); }); -// This command is used to click on the sidebar item -// id: data-testid of the sidebar item -// parentId: data-testid of the parent sidebar item to close after click if present -Cypress.Commands.add('sidebarClick', (id, parentId) => { - cy.get(`[data-testid="${id}"]`).click({ - animationDistanceThreshold: 20, - waitForAnimations: true, - }); +/* + This command is used to click on the sidebar item + id: data-testid of the sidebar item to be clicked + */ +Cypress.Commands.add('sidebarClick', (id) => { + const items = SIDEBAR_LIST_ITEMS[id]; + if (items) { + cy.sidebarHover(); + cy.get(`[data-testid="${items[0]}"]`).click({ + animationDistanceThreshold: 20, + waitForAnimations: true, + }); - if (parentId) { - cy.get(`[data-testid="${parentId}"]`).click(); + cy.get(`[data-testid="app-bar-item-${items[1]}"]`).click(); + + cy.get(`[data-testid="${items[0]}"]`).click(); + } else { + cy.get(`[data-testid="app-bar-item-${id}"]`).click(); } cy.sidebarHoverOutside(); diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/LeftSidebar.constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/LeftSidebar.constants.ts index 57335ba54b9..0a1ef9b5446 100644 --- a/openmetadata-ui/src/main/resources/ui/src/constants/LeftSidebar.constants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/constants/LeftSidebar.constants.ts @@ -25,6 +25,7 @@ import { ReactComponent as SettingsIcon } from '../assets/svg/ic-settings-v1.svg import { ReactComponent as InsightsIcon } from '../assets/svg/lampcharge.svg'; import { ReactComponent as LogoutIcon } from '../assets/svg/logout.svg'; +import { SidebarItem } from '../enums/sidebar.enum'; import { getDataInsightPathWithFqn } from '../utils/DataInsightUtils'; import { ROUTES } from './constants'; @@ -34,34 +35,34 @@ export const SIDEBAR_LIST = [ label: i18next.t('label.explore'), redirect_url: '/explore/tables', icon: ExploreIcon, - dataTestId: 'app-bar-item-explore', + dataTestId: `app-bar-item-${SidebarItem.EXPLORE}`, }, { key: ROUTES.OBSERVABILITY, label: i18next.t('label.observability'), icon: ObservabilityIcon, - dataTestId: 'observability', + dataTestId: SidebarItem.OBSERVABILITY, children: [ { key: ROUTES.DATA_QUALITY, label: i18next.t('label.data-quality'), redirect_url: ROUTES.DATA_QUALITY, icon: DataQualityIcon, - dataTestId: 'app-bar-item-data-quality', + dataTestId: `app-bar-item-${SidebarItem.DATA_QUALITY}`, }, { key: ROUTES.INCIDENT_MANAGER, label: i18next.t('label.incident-manager'), redirect_url: ROUTES.INCIDENT_MANAGER, icon: IncidentMangerIcon, - dataTestId: 'app-bar-item-incident-manager', + dataTestId: `app-bar-item-${SidebarItem.INCIDENT_MANAGER}`, isBeta: true, }, { key: ROUTES.OBSERVABILITY, label: i18next.t('label.alert-plural'), icon: AlertIcon, - dataTestId: 'app-bar-item-observability-alert', + dataTestId: `app-bar-item-${SidebarItem.OBSERVABILITY_ALERT}`, }, ], }, @@ -70,34 +71,34 @@ export const SIDEBAR_LIST = [ label: i18next.t('label.insight-plural'), redirect_url: getDataInsightPathWithFqn(), icon: InsightsIcon, - dataTestId: 'app-bar-item-data-insight', + dataTestId: `app-bar-item-${SidebarItem.DATA_INSIGHT}`, }, { key: ROUTES.DOMAIN, label: i18next.t('label.domain-plural'), redirect_url: ROUTES.DOMAIN, icon: DomainsIcon, - dataTestId: 'app-bar-item-domain', + dataTestId: `app-bar-item-${SidebarItem.DOMAIN}`, }, { key: 'governance', label: i18next.t('label.govern'), icon: GovernIcon, - dataTestId: 'governance', + dataTestId: SidebarItem.GOVERNANCE, children: [ { key: ROUTES.GLOSSARY, label: i18next.t('label.glossary'), redirect_url: ROUTES.GLOSSARY, icon: GlossaryIcon, - dataTestId: 'app-bar-item-glossary', + dataTestId: `app-bar-item-${SidebarItem.GLOSSARY}`, }, { key: ROUTES.TAGS, label: i18next.t('label.classification'), redirect_url: ROUTES.TAGS, icon: ClassificationIcon, - dataTestId: 'app-bar-item-tags', + dataTestId: `app-bar-item-${SidebarItem.TAGS}`, }, ], }, @@ -108,12 +109,12 @@ export const SETTING_ITEM = { label: i18next.t('label.setting-plural'), redirect_url: ROUTES.SETTINGS, icon: SettingsIcon, - dataTestId: 'app-bar-item-settings', + dataTestId: `app-bar-item-${SidebarItem.SETTINGS}`, }; export const LOGOUT_ITEM = { key: 'logout', label: i18next.t('label.logout'), icon: LogoutIcon, - dataTestId: 'app-bar-item-logout', + dataTestId: `app-bar-item-${SidebarItem.LOGOUT}`, }; diff --git a/openmetadata-ui/src/main/resources/ui/src/enums/sidebar.enum.ts b/openmetadata-ui/src/main/resources/ui/src/enums/sidebar.enum.ts new file mode 100644 index 00000000000..501bce18b13 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/enums/sidebar.enum.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export enum SidebarItem { + EXPLORE = 'explore', + OBSERVABILITY = 'observability', + DATA_QUALITY = 'data-quality', + INCIDENT_MANAGER = 'incident-manager', + OBSERVABILITY_ALERT = 'observability-alert', + DATA_INSIGHT = 'data-insight', + DOMAIN = 'domain', + GOVERNANCE = 'governance', + GLOSSARY = 'glossary', + TAGS = 'tags', + INSIGHTS = 'insights', + SETTINGS = 'settings', + LOGOUT = 'logout', +}