CYPRESS: simplify side navigation click in cypress (#14818)

* simplify side navigation click in cypress

* make sidbar item uses common enum

* fix cypress failure of outside import
This commit is contained in:
Ashish Gupta 2024-01-23 15:30:05 +05:30 committed by GitHub
parent 3cf8e0a308
commit 740541c0c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 225 additions and 179 deletions

View File

@ -13,6 +13,7 @@
// eslint-disable-next-line spaced-comment
/// <reference types="cypress" />
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');

View File

@ -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(

View File

@ -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();

View File

@ -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'

View File

@ -14,6 +14,7 @@
/// <reference types="cypress" />
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);
};

View File

@ -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);
};

View File

@ -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');

View File

@ -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');

View File

@ -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();

View File

@ -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();
};

View File

@ -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);

View File

@ -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');

View File

@ -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',
}

View File

@ -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'],
};

View File

@ -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');

View File

@ -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

View File

@ -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);
});

View File

@ -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', () => {

View File

@ -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();

View File

@ -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();
});
});

View File

@ -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');

View File

@ -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')

View File

@ -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',

View File

@ -14,6 +14,7 @@
/// <reference types="cypress" />
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',

View File

@ -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*`,

View File

@ -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);

View File

@ -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',

View File

@ -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');

View File

@ -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);

View File

@ -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);
});

View File

@ -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 }) => {

View File

@ -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')

View File

@ -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')

View File

@ -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')

View File

@ -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');

View File

@ -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')

View File

@ -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();

View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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();

View File

@ -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}`,
};

View File

@ -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',
}