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 51be5c9a657..d21aeb4153e 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -422,7 +422,7 @@ export const visitEntityDetailsPage = (term, serviceName, entity) => { .click(); } else { // if term is not available in search suggestion, hitting enter to search box so it will redirect to explore page - cy.get('body').click(); + cy.get('body').click(1, 1); cy.get('[data-testid="searchBox"]').type('{enter}'); cy.get(`[data-testid="${entity}-tab"]`).should('be.visible').click(); @@ -439,15 +439,23 @@ export const visitEntityDetailsPage = (term, serviceName, entity) => { }); verifyResponseStatusCode('@getEntityDetails', 200); - cy.get('body').click(); + cy.get('body').then(($body) => { + if ($body.find('[data-testid="suggestion-overlay"]').length) { + cy.get('[data-testid="suggestion-overlay"]').click(1, 1); + } + }); + cy.get('body').click(1, 1); cy.get('[data-testid="searchBox"]').clear(); }; // add new tag to entity and its table -export const addNewTagToEntity = (entity, term) => { - searchEntity(entity); +export const addNewTagToEntity = (entityObj, term) => { + visitEntityDetailsPage( + entityObj.term, + entityObj.serviceName, + entityObj.entity + ); cy.wait(500); - cy.get('[data-testid="table-link"]').first().contains(entity).click(); cy.get('[data-testid="tags"] > [data-testid="add-tag"]') .eq(0) .should('be.visible') @@ -651,7 +659,12 @@ export const toastNotification = (msg) => { cy.get('.Toastify__close-button').should('be.visible').click(); }; -export const addCustomPropertiesForEntity = (entityType, customType, value) => { +export const addCustomPropertiesForEntity = ( + entityType, + customType, + value, + entityObj +) => { const propertyName = `entity${entityType.name}test${uuid()}`; //Add Custom property for selected entity @@ -677,19 +690,12 @@ export const addCustomPropertiesForEntity = (entityType, customType, value) => { cy.clickOnLogo(); //Checking the added property in Entity - //cy.contains(entityType.name).scrollIntoView().should('be.visible').click(); - cy.get(`[data-testid*="${entityType.name}"] > .ant-btn > span`) - .scrollIntoView() - .should('be.visible') - .click(); - - cy.wait(1000); - cy.get('[data-testid="table-link"]') - .first() - .should('exist') - .should('be.visible') - .click(); + visitEntityDetailsPage( + entityObj.term, + entityObj.serviceName, + entityObj.entity + ); cy.get('[data-testid="Custom Properties"]') .should('exist') diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js index 0dc9f3bac0d..19bbc3442dd 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js @@ -68,20 +68,15 @@ export const SEARCH_ENTITY_DASHBOARD = { serviceName: 'sample_superset', }, }; - +// Note:- Please do not change term name of pipeline export const SEARCH_ENTITY_PIPELINE = { pipeline_1: { - term: 'Snowflake ETL', + term: 'dim_product_etl', entity: MYDATA_SUMMARY_OPTIONS.pipelines, serviceName: 'sample_airflow', }, pipeline_2: { - term: 'Hive ETL', - entity: MYDATA_SUMMARY_OPTIONS.pipelines, - serviceName: 'sample_airflow', - }, - pipeline_3: { - term: 'Trino ETL', + term: 'dim_location_etl', entity: MYDATA_SUMMARY_OPTIONS.pipelines, serviceName: 'sample_airflow', }, @@ -208,6 +203,7 @@ export const ENTITIES = { integerValue: '45', stringValue: 'This is string propery', markdownValue: 'This is markdown value', + entityObj: SEARCH_ENTITY_TABLE.table_1, }, entity_topic: { name: 'topic', @@ -215,6 +211,7 @@ export const ENTITIES = { integerValue: '23', stringValue: 'This is string propery', markdownValue: 'This is markdown value', + entityObj: SEARCH_ENTITY_TOPIC.topic_1, }, entity_dashboard: { name: 'dashboard', @@ -222,6 +219,7 @@ export const ENTITIES = { integerValue: '14', stringValue: 'This is string propery', markdownValue: 'This is markdown value', + entityObj: SEARCH_ENTITY_DASHBOARD.dashboard_1, }, entity_pipeline: { name: 'pipeline', @@ -229,6 +227,7 @@ export const ENTITIES = { integerValue: '78', stringValue: 'This is string propery', markdownValue: 'This is markdown value', + entityObj: SEARCH_ENTITY_PIPELINE.pipeline_1, }, }; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/metabase.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/metabase.spec.js index 08e666e0bd2..9002950abc4 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/metabase.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/metabase.spec.js @@ -16,7 +16,7 @@ import { LOGIN, SERVICE_TYPE } from '../../constants/constants'; const serviceType = 'Metabase'; const serviceName = `${serviceType}-ct-test-${uuid()}`; -const tableName = 'jaffle_shop'; +const tableName = 'jaffle_shop dashboard'; const description = `This is ${serviceName} description`; describe('Metabase Ingestion', () => { 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 cb41e4e8e28..3645392730f 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 @@ -15,15 +15,24 @@ import { addCustomPropertiesForEntity, deleteCreatedProperty, editCreatedPropert import { ENTITIES, LOGIN } from '../../constants/constants'; describe('Custom Properties should work properly', () => { - beforeEach(() => { + before(() => { + cy.clearLocalStorageSnapshot(); login(LOGIN.username, LOGIN.password); cy.goToHomePage(); - + cy.saveLocalStorage('localstorage'); + }); + beforeEach(() => { + cy.log('Restoring local storage snapshot'); + cy.restoreLocalStorage('localstorage'); + cy.clickOnLogo(); + interceptURL('GET', '/api/v1/users*', 'settingsPage'); cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click(); + verifyResponseStatusCode('@settingsPage', 200); + cy.get('[data-testid="settings-left-panel"]').should('be.visible'); }); - it('Add Integer custom property for all Entities', () => { - Object.values(ENTITIES).forEach((entity) => { + Object.values(ENTITIES).forEach((entity) => { + it(`Add Integer custom property for ${entity.name} Entities`, () => { interceptURL( 'GET', `/api/v1/metadata/types/name/${entity.name}*`, @@ -41,7 +50,8 @@ describe('Custom Properties should work properly', () => { const propertyName = addCustomPropertiesForEntity( entity, 'integer', - entity.integerValue + entity.integerValue, + entity.entityObj ); //Navigating back to custom properties page cy.get('[data-testid="appbar-item-settings"]') @@ -60,8 +70,8 @@ describe('Custom Properties should work properly', () => { }); }); - it('Add String custom property for all Entities', () => { - Object.values(ENTITIES).forEach((entity) => { + Object.values(ENTITIES).forEach((entity) => { + it(`Add String custom property for ${entity.name} Entities`, () => { interceptURL( 'GET', `/api/v1/metadata/types/name/${entity.name}*`, @@ -79,7 +89,8 @@ describe('Custom Properties should work properly', () => { const propertyName = addCustomPropertiesForEntity( entity, 'string', - entity.stringValue + entity.stringValue, + entity.entityObj ); //Navigating back to custom properties page @@ -100,8 +111,8 @@ describe('Custom Properties should work properly', () => { }); }); - it('Add Markdown custom property for all Entities', () => { - Object.values(ENTITIES).forEach((entity) => { + Object.values(ENTITIES).forEach((entity) => { + it(`Add Markdown custom property for ${entity.name} Entities`, () => { interceptURL( 'GET', `/api/v1/metadata/types/name/${entity.name}*`, @@ -119,7 +130,8 @@ describe('Custom Properties should work properly', () => { const propertyName = addCustomPropertiesForEntity( entity, 'markdown', - entity.markdownValue + entity.markdownValue, + entity.entityObj ); //Navigating back to custom properties page cy.get('[data-testid="appbar-item-settings"]') diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.js index 67468bd8898..e97e91d1184 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.js @@ -13,25 +13,19 @@ /// -import { deleteCreatedService, descriptionBox, goToAddNewServicePage, handleIngestionRetry, interceptURL, login, mySqlConnectionInput, scheduleIngestion, searchEntity, testServiceCreationAndIngestion, uuid, verifyResponseStatusCode } from '../../common/common'; -import { DELETE_TERM, LOGIN, NEW_COLUMN_TEST_CASE, NEW_TABLE_TEST_CASE, NEW_TEST_SUITE, SERVICE_TYPE, TEAM_ENTITY } from '../../constants/constants'; +import { deleteCreatedService, descriptionBox, goToAddNewServicePage, handleIngestionRetry, interceptURL, login, mySqlConnectionInput, scheduleIngestion, testServiceCreationAndIngestion, uuid, verifyResponseStatusCode, visitEntityDetailsPage } from '../../common/common'; +import { DELETE_TERM, LOGIN, MYDATA_SUMMARY_OPTIONS, NEW_COLUMN_TEST_CASE, NEW_TABLE_TEST_CASE, NEW_TEST_SUITE, SERVICE_TYPE, TEAM_ENTITY } from '../../constants/constants'; const serviceType = 'Mysql'; const serviceName = `${serviceType}-ct-test-${uuid()}`; const columnTestName = `${NEW_COLUMN_TEST_CASE.column}_${NEW_COLUMN_TEST_CASE.type}`; const goToProfilerTab = () => { - // click on the 1st result and go to entity details page and follow the entity - interceptURL( - 'GET', - '/api/v1/tables/name/*?fields=columns,usageSummary,followers,joins,tags,owner,dataModel,profile,tests,tableConstraints,extension&include=all', - 'getEntityDetails' + visitEntityDetailsPage( + TEAM_ENTITY, + serviceName, + MYDATA_SUMMARY_OPTIONS.tables ); - cy.get('[data-testid="table-link"]') - .first() - .contains(TEAM_ENTITY, { matchCase: false }) - .click(); - verifyResponseStatusCode('@getEntityDetails', 200); cy.get('[data-testid="Profiler & Data Quality"]') .should('be.visible') @@ -62,7 +56,6 @@ describe('Data Quality and Profiler should work properly', () => { it('Add Profiler ingestion', () => { login(LOGIN.username, LOGIN.password); cy.goToHomePage(); - searchEntity(TEAM_ENTITY); goToProfilerTab(); cy.get('[data-testid="no-profiler-placeholder"]').should('be.visible'); @@ -107,17 +100,18 @@ describe('Data Quality and Profiler should work properly', () => { .click(); handleIngestionRetry('database', true, 0, 'profiler'); + }); - // check if profiler is ingested properly - searchEntity(TEAM_ENTITY, false); + it('Check if profiler is ingested properly or not', () => { + login(LOGIN.username, LOGIN.password); + cy.goToHomePage(); goToProfilerTab(); cy.get('[data-testid="no-profiler-placeholder"]').should('not.exist'); - }); + }) it('Add table test case with new test suite', () => { login(LOGIN.username, LOGIN.password); cy.goToHomePage(); - searchEntity(TEAM_ENTITY); goToProfilerTab(); cy.get('[data-testid="profiler-add-table-test-btn"]') @@ -182,7 +176,6 @@ describe('Data Quality and Profiler should work properly', () => { const testName = `${TEAM_ENTITY}_${NEW_TABLE_TEST_CASE.type}`; login(LOGIN.username, LOGIN.password); cy.goToHomePage(); - searchEntity(TEAM_ENTITY); goToProfilerTab(); cy.get('[data-testid="profiler-switch"] > :nth-child(2)') @@ -213,7 +206,6 @@ describe('Data Quality and Profiler should work properly', () => { login(LOGIN.username, LOGIN.password); cy.goToHomePage(); - searchEntity(TEAM_ENTITY); goToProfilerTab(); cy.get('[data-testid="profiler-switch"] > :nth-child(2)') @@ -249,7 +241,6 @@ describe('Data Quality and Profiler should work properly', () => { it('Add Column test case should work properly', () => { login(LOGIN.username, LOGIN.password); cy.goToHomePage(); - searchEntity(TEAM_ENTITY); goToProfilerTab(); cy.get('[data-testid="add-test-id"]') .scrollIntoView() @@ -302,7 +293,6 @@ describe('Data Quality and Profiler should work properly', () => { it('Edit column test case should work properly', () => { login(LOGIN.username, LOGIN.password); cy.goToHomePage(); - searchEntity(TEAM_ENTITY); interceptURL('GET', '/api/v1/testCase?*', 'testCase'); goToProfilerTab(); verifyResponseStatusCode('@testCase', 200); @@ -330,7 +320,6 @@ describe('Data Quality and Profiler should work properly', () => { it('Delete Column Test Case should work properly', () => { login(LOGIN.username, LOGIN.password); cy.goToHomePage(); - searchEntity(TEAM_ENTITY); interceptURL('GET', '/api/v1/testCase?*', 'testCase'); goToProfilerTab(); verifyResponseStatusCode('@testCase', 200); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Tags.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Tags.spec.js index a08da21d9ca..9544bd0da11 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Tags.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Tags.spec.js @@ -103,7 +103,7 @@ describe('Tags page should work', () => { }); it('Use newly created tag to any entity should work', () => { - const entity = SEARCH_ENTITY_TABLE.table_2.term; + const entity = SEARCH_ENTITY_TABLE.table_2; addNewTagToEntity(entity, `${NEW_TAG_CATEGORY.name}.${NEW_TAG.name}`); }); 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 49cf49b5a3c..16e9109d664 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 @@ -28,19 +28,24 @@ const TEAM_DETAILS = { }; describe('Teams flow should work properly', () => { - beforeEach(() => { + before(() => { + cy.clearLocalStorageSnapshot(); login(LOGIN.username, LOGIN.password); cy.goToHomePage(); + cy.saveLocalStorage('localstorage'); + }); + beforeEach(() => { + cy.log('Restoring local storage snapshot'); + cy.restoreLocalStorage('localstorage'); + cy.clickOnLogo(); cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click(); - interceptURL('GET', '/api/v1/users*', 'getTeams'); + //Clicking on teams cy.get('[data-menu-id*="teams"]') .should('exist') .should('be.visible') .click(); - - verifyResponseStatusCode('@getTeams', 200); }); it('Add new team', () => { @@ -431,23 +436,6 @@ describe('Teams flow should work properly', () => { .should('exist') .should('be.disabled'); - cy.get('[data-testid="discard-button"]') - .should('exist') - .should('be.visible') - .click(); - - cy.get('[data-testid="manage-button"]') - .should('exist') - .should('be.visible') - .click(); - - cy.get('[data-menu-id*="delete-button"]').should('be.visible'); - - cy.get('[data-testid="delete-button-title"]') - .should('exist') - .should('be.visible') - .click(); - //Check if soft delete option is present cy.get('[data-testid="soft-delete-option"]') .should('contain', TEAM_DETAILS.name)