From e68f35ec855aefd9bd12aace2ac9eef37cfbfb1d Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Tue, 1 Nov 2022 09:46:01 +0530 Subject: [PATCH] Fixed: Custom property failing cypress test (#8460) * Custom property cypress * testing out entity topic name * Fixed Custom property topic search issue * removed import of deleted file --- .../resources/ui/cypress/common/common.js | 5 ++- .../e2e/Pages/Customproperties.spec.js | 18 +++++----- .../main/resources/ui/cypress/support/e2e.js | 1 - .../support/get-search-query.command.js | 33 ------------------- 4 files changed, 12 insertions(+), 45 deletions(-) delete mode 100644 openmetadata-ui/src/main/resources/ui/cypress/support/get-search-query.command.js 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 4d6f5475005..ada81048d10 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -683,8 +683,7 @@ export const addCustomPropertiesForEntity = ( entityType, customType, value, - entityObj, - entityName + entityObj ) => { const propertyName = `entity${entityType.name}test${uuid()}`; @@ -713,7 +712,7 @@ export const addCustomPropertiesForEntity = ( //Checking the added property in Entity visitEntityDetailsPage( - entityName || entityObj.term, + entityObj.term, entityObj.serviceName, entityObj.entity ); 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 2d50a0709c8..edd3eb3d0ce 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 @@ -11,7 +11,14 @@ * limitations under the License. */ -import { addCustomPropertiesForEntity, deleteCreatedProperty, editCreatedProperty, interceptURL, login, verifyResponseStatusCode } from '../../common/common'; +import { + addCustomPropertiesForEntity, + deleteCreatedProperty, + editCreatedProperty, + interceptURL, + login, + verifyResponseStatusCode +} from '../../common/common'; import { ENTITIES, LOGIN } from '../../constants/constants'; describe('Custom Properties should work properly', () => { @@ -33,8 +40,6 @@ describe('Custom Properties should work properly', () => { Object.values(ENTITIES).forEach((entity) => { it(`Add Integer custom property for ${entity.name} Entities`, () => { - cy.getSearchQueryName(entity.name).then((entityName) => { - interceptURL( 'GET', `/api/v1/metadata/types/name/${entity.name}*`, @@ -54,8 +59,7 @@ describe('Custom Properties should work properly', () => { entity, 'integer', entity.integerValue, - entity.entityObj, - entityName + entity.entityObj ); //Navigating back to custom properties page cy.get('[data-testid="appbar-item-settings"]') @@ -72,10 +76,8 @@ describe('Custom Properties should work properly', () => { deleteCreatedProperty(propertyName); }); - -}) }); - + Object.values(ENTITIES).forEach((entity) => { it(`Add String custom property for ${entity.name} Entities`, () => { interceptURL( diff --git a/openmetadata-ui/src/main/resources/ui/cypress/support/e2e.js b/openmetadata-ui/src/main/resources/ui/cypress/support/e2e.js index 94db5c448ff..2184f18b44a 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/support/e2e.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/support/e2e.js @@ -16,7 +16,6 @@ // Import commands.js using ES2015 syntax: import 'cypress-localstorage-commands'; import './commands'; -import './get-search-query.command'; // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/openmetadata-ui/src/main/resources/ui/cypress/support/get-search-query.command.js b/openmetadata-ui/src/main/resources/ui/cypress/support/get-search-query.command.js deleted file mode 100644 index 51dc951cea8..00000000000 --- a/openmetadata-ui/src/main/resources/ui/cypress/support/get-search-query.command.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2021 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. - */ - - -Cypress.Commands.add('getSearchQueryName', (entityName) => { - cy.getLocalStorage("oidcIdToken").then((token) => { - cy.request({ - method: 'GET', - url: `/api/v1/search/query?q=*&from=0&size=10&sort_field=updatedAt&sort_order=desc&index=${entityName}_search_index`, - headers: { - Authorization: `Bearer ${token}` - } - - }).then((response) => { - if (response && response.body && response.body.hits) { - const entitySource = response.body.hits.hits[0]._source; - const name = entitySource.name || entitySource.displayName; - - return name; - } - }) - }); -}); \ No newline at end of file