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 492033952c8..cd7d858baa5 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -12,13 +12,24 @@ */ /// - +export const descriptionBox = + '.toastui-editor-md-container > .toastui-editor > .ProseMirror'; export const uuid = () => Cypress._.random(0, 1e6); const AARON_JOHNSON = 'Aaron Johnson'; const isDatabaseService = (type) => type === 'database'; +//intercepting URL with cy.intercept +export const interceptURL = (method, url, alias) => { + cy.intercept({ method: method, url: url }).as(alias); +}; + +//waiting for response and validating the response status code +export const verifyResponseStatusCode = (alias, responseCode) => { + cy.wait(alias).its('response.statusCode').should('eq', responseCode); +}; + export const handleIngestionRetry = (type, testIngestionButton, count = 0) => { // ingestions page const retryTimes = 25; @@ -166,11 +177,15 @@ export const deleteCreatedService = (typeOfService, service_Name) => { cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click(); // Services page + interceptURL('GET', '/api/v1/services/*', 'getServices'); + cy.get('.ant-menu-title-content') .contains(typeOfService) .should('be.visible') .click(); + verifyResponseStatusCode('@getServices', 200); + //click on created service cy.get(`[data-testid="service-name-${service_Name}"]`) .should('exist') @@ -185,14 +200,13 @@ export const deleteCreatedService = (typeOfService, service_Name) => { expect(text).to.equal(service_Name); }); - cy.wait(1000); + verifyResponseStatusCode('@getServices', 200); cy.get('[data-testid="service-delete"]') .should('exist') .should('be.visible') .click(); - //Clicking on permanent delete radio button and checking the service name cy.get('[data-testid="hard-delete-option"]') .contains(service_Name) @@ -203,18 +217,17 @@ export const deleteCreatedService = (typeOfService, service_Name) => { .should('be.visible') .type('DELETE'); + interceptURL('GET', '/api/v1/*', 'homePage'); + cy.get('[data-testid="confirm-button"]').should('be.visible').click(); - cy.wait(2000); - cy.get('[class="Toastify__toast-body"] >div') - .eq(1) + + cy.get('.Toastify__toast-body') .should('exist') .should('be.visible') .should('have.text', `${typeOfService} Service deleted successfully!`); - + cy.url().should('eq', 'http://localhost:8585/my-data'); + verifyResponseStatusCode('@homePage', 200); //Checking if the service got deleted successfully - cy.clickOnLogo(); - - cy.wait(1000); //Click on settings page cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click(); @@ -239,13 +252,21 @@ export const editOwnerforCreatedService = (service_type, service_Name) => { .should('be.visible') .click(); + interceptURL( + 'GET', + `/api/v1/services/*/name/${service_Name}*`, + 'getSelectedService' + ); + //click on created service cy.get(`[data-testid="service-name-${service_Name}"]`) .should('exist') .should('be.visible') .click(); - cy.wait(1000); + verifyResponseStatusCode('@getSelectedService', 200); + + interceptURL('GET', '/api/v1/users/loggedInUser/groupTeams', 'waitForUsers'); //Click on edit owner button cy.get('[data-testid="edit-Owner-icon"]') @@ -253,7 +274,8 @@ export const editOwnerforCreatedService = (service_type, service_Name) => { .should('be.visible') .click(); - cy.wait(500); + verifyResponseStatusCode('@waitForUsers', 200); + //Clicking on users tab cy.get('[data-testid="dropdown-tab"]') .contains('Users') @@ -266,7 +288,6 @@ export const editOwnerforCreatedService = (service_type, service_Name) => { .should('exist') .should('be.visible') .click(); - cy.wait(1000); cy.get('[data-testid="owner-dropdown"]') .invoke('text') @@ -352,7 +373,8 @@ export const addNewTagToEntity = (entity, term) => { searchEntity(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) + cy.get('[data-testid="tags"] > [data-testid="add-tag"]') + .eq(0) .should('be.visible') .scrollIntoView() .click(); @@ -400,7 +422,7 @@ export const addUser = (username, email) => { .should('exist') .should('be.visible') .type(username); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') + cy.get(descriptionBox) .should('exist') .should('be.visible') .type('Adding user'); @@ -409,12 +431,13 @@ export const addUser = (username, email) => { export const softDeleteUser = (username) => { //Search the created user + interceptURL('GET', '/api/v1/search/query*', 'searchUser'); cy.get('[data-testid="searchbar"]') .should('exist') .should('be.visible') .type(username); - cy.wait(1000); + verifyResponseStatusCode('@searchUser', 200); //Click on delete button cy.get('.ant-table-row .ant-table-cell button') @@ -425,12 +448,15 @@ export const softDeleteUser = (username) => { //Soft deleting the user cy.get('[data-testid="soft-delete"]').click(); cy.get('[data-testid="confirmation-text-input"]').type('DELETE'); + + interceptURL('DELETE', '/api/v1/users/*', 'softdeleteUser'); + interceptURL('GET', '/api/v1/users*', 'userDeleted'); cy.get('[data-testid="confirm-button"]') .should('exist') .should('be.visible') .click(); - - cy.wait(1000); + verifyResponseStatusCode('@softdeleteUser', 200); + verifyResponseStatusCode('@userDeleted', 200); cy.get('.Toastify__toast-body > :nth-child(2)').should( 'have.text', @@ -443,6 +469,8 @@ export const softDeleteUser = (username) => { .should('be.visible') .click(); + interceptURL('GET', '/api/v1/search/query*', 'searchUser'); + //Verifying the deleted user cy.get('[data-testid="searchbar"]') .should('exist') @@ -450,7 +478,7 @@ export const softDeleteUser = (username) => { .clear() .type(username); - cy.wait(1000); + verifyResponseStatusCode('@searchUser', 200); cy.get('.ant-table-placeholder > .ant-table-cell').should( 'not.contain', username @@ -459,19 +487,21 @@ export const softDeleteUser = (username) => { export const restoreUser = (username) => { //Click on deleted user toggle + interceptURL('GET', '/api/v1/users*', 'deletedUser'); cy.get('.ant-switch-handle').should('exist').should('be.visible').click(); - cy.wait(1000); + verifyResponseStatusCode('@deletedUser', 200); cy.get('button [alt="Restore"]').should('exist').should('be.visible').click(); cy.get('.ant-modal-body > p').should( 'contain', `Are you sure you want to restore ${username}?` ); + interceptURL('PUT', '/api/v1/users', 'restoreUser'); cy.get('.ant-modal-footer > .ant-btn-primary') .should('exist') .should('be.visible') .click(); - cy.wait(1000); + verifyResponseStatusCode('@restoreUser', 200); cy.get('.Toastify__toast-body > :nth-child(2)').should( 'contain', 'User restored successfully!' @@ -486,12 +516,13 @@ export const restoreUser = (username) => { //Verifying the restored user cy.get('.ant-switch').should('exist').should('be.visible').click(); + interceptURL('GET', '/api/v1/search/query*', 'searchUser'); cy.get('[data-testid="searchbar"]') .should('exist') .should('be.visible') .type(username); + verifyResponseStatusCode('@searchUser', 200); - cy.wait(1000); cy.get('.ant-table-row > :nth-child(1)').should('contain', username); }; @@ -561,11 +592,13 @@ export const addCustomPropertiesForEntity = (entityType, customType, value) => { cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') .should('be.visible') .type(entityType.description); + //Check if the property got added + cy.intercept('/api/v1/metadata/types/name/*?fields=customProperties').as( + 'customProperties' + ); cy.get('[data-testid="create-custom-field"]').scrollIntoView().click(); - //Check if the property got added - cy.intercept('/api/v1/metadata/types/name/*?fields=customProperties').as("customProperties"); - cy.wait("@customProperties"); + cy.wait('@customProperties'); cy.get('[data-testid="data-row"]').should('contain', propertyName); //Navigating to home page @@ -649,14 +682,16 @@ export const editCreatedProperty = (propertyName) => { cy.get('@editbutton').click(); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') + cy.get(descriptionBox) .should('be.visible') .clear() .type('This is new description'); + interceptURL('PATCH', '/api/v1/metadata/types/*', 'checkPatchForDescription'); + cy.get('[data-testid="save"]').should('be.visible').click(); - cy.wait(1000); + verifyResponseStatusCode('@checkPatchForDescription', 200); //Fetching for updated descriptions for the created custom property cy.get('[data-testid="table-body"]') @@ -695,11 +730,11 @@ export const updateOwner = () => { .invoke('text') .then((text) => { cy.get('[data-testid="hiden-layer"]').should('exist').click(); - + interceptURL('GET', '/api/v1/users/loggedInUser/groupTeams', 'getUser'); //Clicking on edit owner button cy.get('[data-testid="edit-Owner-icon"]').should('be.visible').click(); - cy.wait(1000); + verifyResponseStatusCode('@getUser', 200); //Clicking on users tab cy.get('button[data-testid="dropdown-tab"]') @@ -708,14 +743,12 @@ export const updateOwner = () => { .contains('Users') .click(); - cy.get('[data-testid="list-item"]').first() + cy.get('[data-testid="list-item"]') + .first() .should('contain', text.trim()) .click(); //Asserting the added name - cy.get('[data-testid="owner-link"]').should( - 'contain', - text.trim() - ); + cy.get('[data-testid="owner-link"]').should('contain', text.trim()); }); -} +}; 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 3d99b03054b..d7fbf2d257f 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js @@ -147,7 +147,7 @@ export const service = { name: 'Glue', description: 'This is a Glue service', newDescription: 'This is updated Glue service description', - Owner: 'Cloud_Infra', + Owner: 'Aaron Johnson', }; export const SERVICE_TYPE = { 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 28f65497983..0f259225a62 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,26 +11,35 @@ * limitations under the License. */ -import { addCustomPropertiesForEntity, deleteCreatedProperty, editCreatedProperty } from '../../common/common'; +import { addCustomPropertiesForEntity, deleteCreatedProperty, editCreatedProperty, interceptURL, verifyResponseStatusCode } from '../../common/common'; import { ENTITIES } from '../../constants/constants'; describe('Custom Properties should work properly', () => { beforeEach(() => { cy.goToHomePage(); + + interceptURL('GET', '/api/v1/users*', 'getTeams'); + cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click(); - cy.wait(1000); + + verifyResponseStatusCode('@getTeams', 200); }); it('Add Integer custom property for all Entities', () => { Object.values(ENTITIES).forEach((entity) => { + interceptURL( + 'GET', + `/api/v1/metadata/types/name/${entity.name}*`, + 'getEntity' + ); //Selecting the entity cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`) .scrollIntoView() .should('be.visible') .click(); - cy.wait(1000); - + verifyResponseStatusCode('@getEntity', 200); + //Getting the property const propertyName = addCustomPropertiesForEntity( entity, @@ -45,7 +54,8 @@ describe('Custom Properties should work properly', () => { .scrollIntoView() .should('be.visible') .click(); - cy.wait(1000); + + verifyResponseStatusCode('@getEntity', 200); editCreatedProperty(propertyName); @@ -55,12 +65,20 @@ describe('Custom Properties should work properly', () => { it('Add String custom property for all Entities', () => { Object.values(ENTITIES).forEach((entity) => { + interceptURL( + 'GET', + `/api/v1/metadata/types/name/${entity.name}*`, + 'getEntity' + ); + //Selecting the entity cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`) .scrollIntoView() .should('be.visible') .click(); + verifyResponseStatusCode('@getEntity', 200); + const propertyName = addCustomPropertiesForEntity( entity, 'string', @@ -76,7 +94,8 @@ describe('Custom Properties should work properly', () => { .scrollIntoView() .should('be.visible') .click(); - cy.wait(1000); + + verifyResponseStatusCode('@getEntity', 200); editCreatedProperty(propertyName); @@ -86,11 +105,20 @@ describe('Custom Properties should work properly', () => { it('Add Markdown custom property for all Entities', () => { Object.values(ENTITIES).forEach((entity) => { + interceptURL( + 'GET', + `/api/v1/metadata/types/name/${entity.name}*`, + 'getEntity' + ); + //Selecting the entity cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`) .scrollIntoView() .should('be.visible') .click(); + + verifyResponseStatusCode('@getEntity', 200); + const propertyName = addCustomPropertiesForEntity( entity, 'markdown', @@ -104,7 +132,8 @@ describe('Custom Properties should work properly', () => { .scrollIntoView() .should('be.visible') .click(); - cy.wait(1000); + + verifyResponseStatusCode('@getEntity', 200); editCreatedProperty(propertyName); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/EntityDetails.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/EntityDetails.spec.js index 0dc27fda64a..f74a1f48909 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/EntityDetails.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/EntityDetails.spec.js @@ -12,7 +12,7 @@ */ import moment from 'moment'; -import { searchEntity } from '../../common/common'; +import { descriptionBox, interceptURL, searchEntity, verifyResponseStatusCode } from '../../common/common'; import { DELETE_ENTITY, DELETE_TERM } from '../../constants/constants'; describe('Entity Details Page', () => { @@ -29,18 +29,19 @@ describe('Entity Details Page', () => { .should('be.visible') .should('have.class', 'active') .click(); - - cy.wait(500); - + interceptURL('GET', '/api/v1/feed*', 'getEntityDetails'); //Click on manage button cy.get('[data-testid="table-link"]').first().should('be.visible').click(); + verifyResponseStatusCode('@getEntityDetails', 200); cy.get('[data-testid="manage-button"]') .should('exist') .should('be.visible') .click(); - cy.wait(1000); + cy.get('[data-menu-id*="delete-button"]') + .should('exist') + .should('be.visible'); // check for delete section and delete button is available or not // cy.get('[data-testid="danger-zone"]').scrollIntoView().should('be.visible'); cy.get('[data-testid="delete-button-title"]') @@ -48,8 +49,6 @@ describe('Entity Details Page', () => { .click() .as('deleteBtn'); - cy.wait(1000); - cy.get('[data-testid="hard-delete-option"]') .should('contain', `Permanently Delete ${singuler} “${value.term}”`) .should('be.visible') @@ -82,7 +81,9 @@ describe('Entity Details Page', () => { // open modal and type required text in input box to delete entity cy.get('@deleteBtn').click(); - cy.wait(1000); + cy.get('[data-menu-id*="delete-button"]') + .should('exist') + .should('be.visible'); cy.get('@permanentDelete').click(); cy.get('@textBox').type(DELETE_TERM); cy.get('@confirmBtn').should('not.be.disabled'); @@ -129,13 +130,21 @@ describe('Entity Details Page', () => { .should('have.class', 'active') .click(); + interceptURL('GET', '/api/v1/feed*', 'getEntityDetails'); + cy.get('[data-testid="table-link"]').first().should('be.visible').click(); - cy.wait(500); + verifyResponseStatusCode('@getEntityDetails', 200); + + interceptURL( + 'GET', + '/api/v1/users/loggedInUser/groupTeams', + 'waitForUsers' + ); cy.get('[data-testid="edit-Owner-icon"]').should('be.visible').click(); - cy.wait(500); + verifyResponseStatusCode('@waitForUsers', 200); //Clicking on users tab cy.get('[data-testid="dropdown-tab"]') .contains('Users') @@ -143,12 +152,14 @@ describe('Entity Details Page', () => { .should('be.visible') .click(); + interceptURL('PATCH', '/api/v1/tables/*', 'validateOwner'); //Selecting the user cy.get('[data-testid="list-item"]') .should('exist') .should('be.visible') .click(); - cy.wait(1000); + + verifyResponseStatusCode('@validateOwner', 200); cy.get('[data-testid="owner-link"]') .scrollIntoView() @@ -157,8 +168,6 @@ describe('Entity Details Page', () => { expect(text).equal('Aaron Johnson'); }); - cy.wait(1000); - cy.get('[data-testid="edit-Tier-icon"]') .scrollIntoView() .should('exist') @@ -178,16 +187,17 @@ describe('Entity Details Page', () => { }); cy.get('[data-testid="entity-tags"]').should('contain', 'Tier1'); - cy.wait(1000); // Test out the activity feed and task tab - cy.get('[data-testid="Activity Feeds & Tasks"]').should('be.visible').click() + cy.get('[data-testid="Activity Feeds & Tasks"]') + .should('be.visible') + .click(); // Check for tab count - cy.get('[data-testid=filter-count').should('be.visible').contains("2") + cy.get('[data-testid=filter-count').should('be.visible').contains('2'); - // Check for activity feeds - count should be 2 + // Check for activity feeds - count should be 2 // 1 for tier change and 1 for owner change - cy.get('[data-testid="message-container"]').its('length').should("eq",2) + cy.get('[data-testid="message-container"]').its('length').should('eq', 2); cy.clickOnLogo(); @@ -207,9 +217,11 @@ describe('Entity Details Page', () => { }; const addAnnouncement = (value) => { - const currentDate = Date.now() + const currentDate = Date.now(); const startDate = moment(currentDate, 'x').format('yyyy-MM-DDThh:mm'); - const endDate=moment(currentDate, 'x').add(5, 'days').format('yyyy-MM-DDThh:mm'); + const endDate = moment(currentDate, 'x') + .add(5, 'days') + .format('yyyy-MM-DDThh:mm'); searchEntity(value.term); cy.get(`[data-testid="${value.entity}-tab"]`).should('be.visible').click(); cy.get(`[data-testid="${value.entity}-tab"]`) @@ -217,35 +229,43 @@ describe('Entity Details Page', () => { .should('have.class', 'active') .click(); + interceptURL('GET', '/api/v1/feed*', 'getEntityDetails'); + cy.get('[data-testid="table-link"]').first().should('be.visible').click(); - cy.wait(500); + verifyResponseStatusCode('@getEntityDetails', 200); + + cy.get('[data-testid="manage-button"]').should('be.visible').click(); + cy.get('[data-testid="announcement-button"]').should('be.visible').click(); + cy.get('.ant-empty-description') + .should('be.visible') + .contains('No Announcements, Click on add announcement to add one.'); + cy.get('[data-testid="add-announcement"]').should('be.visible').click(); + cy.get('.ant-modal-header') + .should('be.visible') + .contains('Make an announcement'); + cy.get('.ant-modal-body').should('be.visible'); + cy.get('#title').should('be.visible').type('Announcement Title'); + cy.get('#startDate').should('be.visible').type(startDate); + cy.get('#endtDate').should('be.visible').type(endDate); + cy.get(descriptionBox).type('Description'); + + cy.get('.ant-modal-footer > .ant-btn-primary') + .should('be.visible') + .contains('Submit') + .scrollIntoView() + .click(); - cy.get('[data-testid="manage-button"]').should('be.visible').click() - cy.get('[data-testid="announcement-button"]').should('be.visible').click() - cy.get('.ant-empty-description').should('be.visible').contains("No Announcements, Click on add announcement to add one.") - cy.get('[data-testid="add-announcement"]').should('be.visible').click() - cy.get('.ant-modal-header').should('be.visible').contains("Make an announcement") - cy.get('.ant-modal-body').should('be.visible') - cy.get('#title').should('be.visible').type("Announcement Title") - cy.get('#startDate').should('be.visible').type(startDate) - cy.get('#endtDate').should('be.visible').type(endDate) - cy.get( - '.toastui-editor-md-container > .toastui-editor > .ProseMirror' - ).type("Description"); - - cy.get('.ant-modal-footer > .ant-btn-primary').should('be.visible').contains("Submit").scrollIntoView().click(); - cy.wait(5000); - cy.get('.anticon > svg').should("be.visible").click() + cy.get('.anticon > svg').should('be.visible').click(); // reload page to get the active announcement card - cy.reload() + cy.reload(); // check for announcement card on entity page - cy.get('[data-testid="announcement-card"]').should("be.visible") - + cy.get('[data-testid="announcement-card"]').should('be.visible'); + cy.clickOnLogo(); }; @@ -259,7 +279,7 @@ describe('Entity Details Page', () => { Object.values(DELETE_ENTITY).forEach((value) => { addAnnouncement(value); }); - }) + }); it('Delete entity flow should work properly', () => { Object.values(DELETE_ENTITY).forEach((value) => { 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 d49d3d1a238..e00c5a5ed21 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 @@ -11,7 +11,7 @@ * limitations under the License. */ -import { searchEntity } from '../../common/common'; +import { descriptionBox, interceptURL, searchEntity, verifyResponseStatusCode } from '../../common/common'; import { DELETE_TERM, NEW_GLOSSARY, NEW_GLOSSARY_TERMS, SEARCH_ENTITY_TABLE } from '../../constants/constants'; const createGlossaryTerm = (term) => { @@ -26,7 +26,7 @@ const createGlossaryTerm = (term) => { .scrollIntoView() .should('be.visible') .type(term.name); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') + cy.get(descriptionBox) .scrollIntoView() .should('be.visible') .type(term.description); @@ -46,11 +46,13 @@ const createGlossaryTerm = (term) => { .should('be.visible') .type('https://test.com'); + interceptURL('POST', '/api/v1/glossaryTerms', 'createGlossaryTerms'); cy.get('[data-testid="save-glossary-term"]') .scrollIntoView() .should('be.visible') .click(); - cy.wait(200); + verifyResponseStatusCode('@createGlossaryTerms', 201); + cy.get('#left-panelV1').contains(term.name).should('be.visible'); }; @@ -124,7 +126,7 @@ describe('Glossary page should work properly', () => { .should('be.visible') .type(NEW_GLOSSARY.name); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') + cy.get(descriptionBox) .scrollIntoView() .should('be.visible') .type(NEW_GLOSSARY.description); @@ -178,11 +180,13 @@ describe('Glossary page should work properly', () => { .scrollIntoView() .should('be.visible') .click(); + cy.get('[class*="-control"]') .scrollIntoView() .should('be.visible') .type('personal'); - cy.wait(500); + cy.get('[id*="-option-0"]').should('contain', 'Personal'); + cy.get('[id*="-option-0"]').scrollIntoView().should('be.visible').click(); cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click(); cy.get('[data-testid="glossary-details"]') @@ -193,15 +197,18 @@ describe('Glossary page should work properly', () => { // updating description cy.get('[data-testid="edit-description"]').should('be.visible').click(); cy.get('.tw-modal-container').should('be.visible'); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') - .should('be.visible') - .as('description'); + cy.get(descriptionBox).should('be.visible').as('description'); cy.get('@description').clear(); cy.get('@description').type(newDescription); + + interceptURL('PATCH', '/api/v1/glossaries/*', 'saveGlossary'); cy.get('[data-testid="save"]').click(); + cy.get('.tw-modal-container').should('not.exist'); - cy.wait(1000); + + verifyResponseStatusCode('@saveGlossary', 200); + cy.get('[data-testid="viewer-container"]') .contains(newDescription) .should('be.visible'); @@ -270,15 +277,18 @@ describe('Glossary page should work properly', () => { .scrollIntoView() .should('be.visible') .type('personal'); - cy.wait(500); + cy.get('[id*="-option-0"]').should('contain', 'Personal'); + cy.get('[id*="-option-0"]').scrollIntoView().should('be.visible').click(); + + interceptURL('PATCH', '/api/v1/glossaryTerms/*', 'saveData'); cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click(); + verifyResponseStatusCode('@saveData', 200); cy.get('[data-testid="glossary-term"]') .scrollIntoView() .contains('PersonalData.Personal') .should('be.visible'); - cy.wait(1000); // updating description cy.get('[data-testid="edit-description"]').should('be.visible').click(); cy.get('.tw-modal-container').should('be.visible'); @@ -288,9 +298,10 @@ describe('Glossary page should work properly', () => { cy.get('@description').clear(); cy.get('@description').type(newDescription); cy.get('[data-testid="save"]').click(); - cy.get('.tw-modal-container').should('not.exist'); - cy.wait(1000); + verifyResponseStatusCode('@saveData', 200); + + cy.get('.tw-modal-container').should('not.exist'); cy.get('[data-testid="viewer-container"]') .contains(newDescription) @@ -332,23 +343,30 @@ describe('Glossary page should work properly', () => { .should('be.visible'); searchEntity(entity); - cy.wait(500); + + interceptURL('GET', '/api/v1/feed*', 'getEntityDetails'); + cy.get('[data-testid="table-link"]').first().contains(entity).click(); + verifyResponseStatusCode('@getEntityDetails', 200); + //Add tag to breadcrumb cy.get('[data-testid="tag-container"] [data-testid="tags"]') .eq(0) .should('be.visible') .click(); cy.get('[class*="-control"]').should('be.visible').type(term); - cy.wait(500); + cy.get('[id*="-option-0"]').should('contain', term); cy.get('[id*="-option-0"]').should('be.visible').click(); cy.get( '[data-testid="tags-wrapper"] [data-testid="tag-container"]' ).contains(term); - cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click(); - cy.wait(1000); + interceptURL('GET', '/api/v1/feed/count*', 'saveTag'); + + cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click(); + + verifyResponseStatusCode('@saveTag', 200); cy.get('[data-testid="entity-tags"]') .scrollIntoView() .should('be.visible') @@ -360,13 +378,14 @@ describe('Glossary page should work properly', () => { .should('be.visible') .click(); cy.get('[class*="-control"]').should('be.visible').type(term); - cy.wait(500); + cy.get('[id*="-option-0"]').should('contain', term); cy.get('[id*="-option-0"]').should('be.visible').click(); cy.get( '[data-testid="tags-wrapper"] [data-testid="tag-container"]' ).contains(term); + cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click(); - cy.wait(1000); + verifyResponseStatusCode('@saveTag', 200); cy.get(`[data-testid="tag-${glossary}.${term}"]`) .scrollIntoView() .should('be.visible') @@ -386,14 +405,18 @@ describe('Glossary page should work properly', () => { it('Remove Glossary term from entity should work properly', () => { const term = NEW_GLOSSARY_TERMS.term_1.name; const entity = SEARCH_ENTITY_TABLE.table_3.term; + + interceptURL('GET', '/api/v1/search/query*', 'assetTab'); // go assets tab goToAssetsTab(term); - cy.wait(1000); + verifyResponseStatusCode('@assetTab', 200); + + interceptURL('GET', '/api/v1/feed*', 'entityDetails'); cy.get('[data-testid="column"] > :nth-child(1) > a') .contains(entity) .should('be.visible') .click(); - cy.wait(500); + verifyResponseStatusCode('@entityDetails', 200); // redirect to entity detail page cy.get('[data-testid="entity-tags"]') .find('[data-testid="edit-button"]') @@ -445,17 +468,18 @@ describe('Glossary page should work properly', () => { cy.get('[data-testid="confirmation-text-input"]') .should('be.visible') .type(DELETE_TERM); - + interceptURL('DELETE', '/api/v1/glossaries/*', 'getGlossary'); cy.get('[data-testid="confirm-button"]') .should('be.visible') .should('not.disabled') .click(); + verifyResponseStatusCode('@getGlossary', 200); cy.get('.Toastify__toast-body') .contains('Glossary deleted successfully!') .should('be.visible'); + cy.get('.Toastify__close-button > svg > path').should('be.visible').click(); - cy.wait(500); - cy.contains('Add New Glossary').should('be.visible'); + cy.contains('Add New Glossary').should('be.visible'); }); }); 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 af50cb0de3d..78fef7a7597 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 @@ -11,7 +11,7 @@ * limitations under the License. */ -import { uuid } from '../../common/common'; +import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from '../../common/common'; const roles = { dataConsumer: 'Data Consumer', @@ -130,13 +130,11 @@ describe('Policy page should work properly', () => { cy.get('[data-testid="policy-name"]').should('be.visible').type(policyName); //Enter description - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') - .eq(0) - .type(description); + cy.get(descriptionBox).eq(0).type(description); + //Enter rule name addRule(ruleName, ruleDescription, 1); - cy.wait(1000); //Validate the added policy cy.get('[data-testid="inactive-link"]') .should('be.visible') @@ -178,12 +176,17 @@ describe('Policy page should work properly', () => { }); it('Edit policy description', () => { + interceptURL( + 'GET', + `/api/v1/policies/name/${policyName}*`, + 'getSelectedPolicy' + ); //Click on created policy name cy.get('[data-testid="policy-name"]').contains(policyName).click(); - cy.wait(1000); + verifyResponseStatusCode('@getSelectedPolicy', 200); cy.get('[data-testid="edit-description"]').should('be.visible').click(); //Enter updated description - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') + cy.get(descriptionBox) .should('be.visible') .clear() .type(`${updatedDescription}-${policyName}`); @@ -197,13 +200,20 @@ describe('Policy page should work properly', () => { }); it('Add new rule', () => { + interceptURL( + 'GET', + `/api/v1/policies/name/${policyName}*`, + 'getSelectedPolicy' + ); //Click on created policy name cy.get('[data-testid="policy-name"]').contains(policyName).click(); + verifyResponseStatusCode('@getSelectedPolicy', 200); + interceptURL('GET', '/api/v1/policies/*', 'addRulepage'); //Click on add rule button cy.get('[data-testid="add-rule"]').should('be.visible').click(); - cy.wait(1000); + verifyResponseStatusCode('@addRulepage', 200); addRule(newRuleName, newRuledescription, 0); @@ -213,7 +223,9 @@ describe('Policy page should work properly', () => { .should('contain', ruleName); //Verify other details - cy.get('[data-testid="rule-name"]').last().scrollIntoView() + cy.get('[data-testid="rule-name"]') + .last() + .scrollIntoView() .contains(ruleName) .should('be.visible') .click(); @@ -236,41 +248,53 @@ describe('Policy page should work properly', () => { }); it('Edit rule name for created Rule', () => { + interceptURL( + 'GET', + `/api/v1/policies/name/${policyName}*`, + 'getSelectedPolicy' + ); //Click on created policy name cy.get('[data-testid="policy-name"]').contains(policyName).click(); - cy.wait(2000); - + verifyResponseStatusCode('@getSelectedPolicy', 200); //Click on new rule manage button cy.get(`[data-testid="manage-button-${newRuleName}"]`) .should('be.visible') .click(); + interceptURL('GET', '/api/v1/policies/*', 'editRulepage'); cy.get('[data-testid="edit-rule"]').should('be.visible').click(); - cy.wait(1000); + verifyResponseStatusCode('@editRulepage', 200); + //Enter new name cy.get('[data-testid="rule-name"]').clear().type(updatedRuleName); + + interceptURL('PATCH', '/api/v1/policies/*', 'updateRule'); + cy.get('[data-testid="submit-btn"]') .scrollIntoView() .should('be.visible') .click(); - cy.wait(1000); + + verifyResponseStatusCode('@updateRule', 200); cy.reload(); cy.url().should('include', policyName); - cy.get('[data-testid="rule-name"]').should( - 'contain', - updatedRuleName - ); + cy.get('[data-testid="rule-name"]').should('contain', updatedRuleName); }); it('Delete new rule', () => { + interceptURL( + 'GET', + `/api/v1/policies/name/${policyName}*`, + 'getSelectedPolicy' + ); //Click on created policy name cy.get('[data-testid="policy-name"]').contains(policyName).click(); - cy.wait(1000); + verifyResponseStatusCode('@getSelectedPolicy', 200); //Click on new rule manage button cy.get(`[data-testid="manage-button-${updatedRuleName}"]`) @@ -286,19 +310,25 @@ describe('Policy page should work properly', () => { }); it('Delete last rule and validate', () => { + interceptURL( + 'GET', + `/api/v1/policies/name/${policyName}*`, + 'getSelectedPolicy' + ); //Click on created policy name cy.get('[data-testid="policy-name"]').contains(policyName).click(); - cy.wait(1000); + verifyResponseStatusCode('@getSelectedPolicy', 200); //Click on new rule manage button cy.get(`[data-testid="manage-button-${ruleName}"]`) .should('be.visible') .click(); + interceptURL('PATCH', '/api/v1/policies/*', 'deletelastPolicy'); cy.get('[data-testid="delete-rule"]').should('be.visible').click(); - cy.wait(1000); + verifyResponseStatusCode('@deletelastPolicy', 400); cy.get('.Toastify__toast-body') .should('be.visible') 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 f570bf5d6d9..5e84bb5cd48 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 @@ -11,7 +11,7 @@ * limitations under the License. */ -import { uuid } from '../../common/common'; +import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from '../../common/common'; const roles = { dataConsumer: 'Data Consumer', @@ -52,15 +52,14 @@ const removePolicyFromRole = (policyName) => { describe('Roles page should work properly', () => { beforeEach(() => { cy.goToHomePage(); - cy.intercept('GET', '*api/v1/roles*').as('getRoles'); + + interceptURL('GET', '*api/v1/roles*', 'getRoles'); cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click(); cy.get('[data-menu-id*="roles"]').should('be.visible').click(); - cy.wait('@getRoles', { timeout: 15000 }) - .its('response.statusCode') - .should('equal', 200); + verifyResponseStatusCode('@getRoles', 200); cy.url().should('eq', 'http://localhost:8585/settings/access/roles'); }); @@ -92,10 +91,8 @@ describe('Roles page should work properly', () => { .should('be.visible'); //Entering name cy.get('#name').should('be.visible').type(roleName); - //Entering description - cy.get( - '.toastui-editor-md-container > .toastui-editor > .ProseMirror' - ).type(description); + //Entering descrription + cy.get(descriptionBox).type(description); //Select the policies cy.get('.ant-select').should('be.visible').click(); @@ -170,10 +167,8 @@ describe('Roles page should work properly', () => { .should('be.visible'); //Entering name cy.get('#name').should('be.visible').type(roleName); - //Entering description - cy.get( - '.toastui-editor-md-container > .toastui-editor > .ProseMirror' - ).type(description); + //Entering descrription + cy.get(descriptionBox).type(description); //Do not Select the policies //Save the role cy.get('[data-testid="submit-btn"]').scrollIntoView().click(); @@ -193,9 +188,7 @@ describe('Roles page should work properly', () => { .click(); cy.get('[data-testid="edit-description"]').should('be.visible').click(); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') - .clear() - .type(`${description}-updated`); + cy.get(descriptionBox).clear().type(`${description}-updated`); cy.get('[data-testid="save"]').should('be.visible').click(); cy.get('[data-testid="inactive-link"]').should('be.visible'); 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 bfdec11ba14..0b40849c9f7 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 @@ -11,10 +11,9 @@ * limitations under the License. */ +import { descriptionBox, interceptURL, verifyResponseStatusCode } from '../../common/common'; import { service } from '../../constants/constants'; -const updateOwner = () => {}; - describe('Services page should work properly', () => { beforeEach(() => { cy.goToHomePage(); @@ -29,18 +28,17 @@ describe('Services page should work properly', () => { }); it('Update service description', () => { + interceptURL('GET', '/api/v1/config/airflow', 'getService'); cy.get(`[data-testid="service-name-${service.name}"]`) .should('be.visible') .click(); - cy.wait(1000); + verifyResponseStatusCode('@getService', 200); //need wait here cy.get('[data-testid="edit-description"]') .should('exist') .should('be.visible') .click({ force: true }); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') - .clear() - .type(service.newDescription); + cy.get(descriptionBox).clear().type(service.newDescription); cy.get('[data-testid="save"]').click(); cy.get( '[data-testid="description"] > [data-testid="viewer-container"] > [data-testid="markdown-parser"] > :nth-child(1) > .toastui-editor-contents > p' @@ -50,32 +48,35 @@ describe('Services page should work properly', () => { }); it.skip('Update owner and check description', () => { + interceptURL('GET', '/api/v1/config/airflow', 'getService'); cy.get(`[data-testid="service-name-${service.name}"]`) .should('be.visible') .click(); - cy.wait(1000); - + verifyResponseStatusCode('@getService', 200); + interceptURL('GET', '/api/v1/users/loggedInUser/groupTeams', 'editOwner'); cy.get('[data-testid="edit-Owner-icon"]') .should('exist') .should('be.visible') .click(); + verifyResponseStatusCode('@editOwner', 200); cy.get('[data-testid="dropdown-list"]') - .contains('Teams') + .contains('Users') .should('exist') .should('be.visible') .click(); - cy.wait(1000); + cy.get('[data-testid="list-item"]') .contains(service.Owner) .should('be.visible') .click(); + cy.get('[data-testid="owner-dropdown"]').should('have.text', service.Owner); //Checking if description exists after assigning the owner cy.get(':nth-child(1) > .link-title').click(); //need wait here - cy.wait(1000); + cy.get('[data-testid="viewer-container"]').contains(service.newDescription); }); }); 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 a526e0698e5..6155eb6e86a 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 @@ -11,7 +11,7 @@ * limitations under the License. */ -import { addNewTagToEntity } from '../../common/common'; +import { addNewTagToEntity, descriptionBox, interceptURL, verifyResponseStatusCode } from '../../common/common'; import { NEW_TAG, NEW_TAG_CATEGORY, SEARCH_ENTITY_TABLE } from '../../constants/constants'; describe('Tags page should work', () => { @@ -51,7 +51,7 @@ describe('Tags page should work', () => { cy.get('[data-testid="name"]') .should('be.visible') .type(NEW_TAG_CATEGORY.name); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') + cy.get(descriptionBox) .should('be.visible') .type(NEW_TAG_CATEGORY.description); @@ -81,10 +81,14 @@ describe('Tags page should work', () => { cy.get('[data-testid="add-new-tag-button"]').should('be.visible').click(); cy.get('.tw-modal-container').should('be.visible'); cy.get('[data-testid="name"]').should('be.visible').type(NEW_TAG.name); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') - .should('be.visible') - .type(NEW_TAG.description); + cy.get(descriptionBox).should('be.visible').type(NEW_TAG.description); + + interceptURL('GET', '/api/v1/tags/*', 'createTag'); cy.get('[data-testid="saveButton"]').should('be.visible').click(); + + verifyResponseStatusCode('@createTag', 200); + + cy.get('[data-testid="table-body"]').should('contain', NEW_TAG.name); }); it('Use newly created tag to any entity should work', () => { @@ -143,8 +147,14 @@ describe('Tags page should work', () => { cy.get('[data-testid="body-text"]') .contains(`Are you sure you want to delete the tag "${NEW_TAG.name}"?`) .should('be.visible'); + + interceptURL( + 'DELETE', + `/api/v1/tags/${NEW_TAG_CATEGORY.name}/*`, + 'deleteTag' + ); cy.get('[data-testid="save-button"]').should('be.visible').click(); - cy.wait(100); + verifyResponseStatusCode('@deleteTag', 200); cy.get('.tw-modal-container').should('not.exist'); cy.get('.tableBody-cell').contains(NEW_TAG.name).should('not.exist'); }); 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 8d058eea888..50bee676b0c 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 @@ -11,9 +11,8 @@ * limitations under the License. */ -import { toastNotification, updateOwner, uuid } from '../../common/common'; +import { descriptionBox, interceptURL, toastNotification, updateOwner, uuid, verifyResponseStatusCode } from '../../common/common'; -const orgName = 'Organization'; const updateddescription = 'This is updated description'; const teamName = `team-ct-test-${uuid()}`; @@ -31,16 +30,18 @@ describe('Teams flow should work properly', () => { cy.goToHomePage(); 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(); - cy.wait(1000); + verifyResponseStatusCode('@getTeams', 200); }); it('Add new team', () => { + interceptURL('GET', '/api/v1/teams*', 'addTeam'); //Fetching the add button and clicking on it cy.get('button') .find('span') @@ -48,7 +49,8 @@ describe('Teams flow should work properly', () => { .should('be.visible') .click(); - cy.wait(500); + verifyResponseStatusCode('@addTeam', 200); + //Entering team details cy.get('[data-testid="name"]') .should('exist') @@ -60,10 +62,12 @@ describe('Teams flow should work properly', () => { .should('be.visible') .type(TEAM_DETAILS.displayName); - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') + cy.get(descriptionBox) .should('exist') .should('be.visible') .type(TEAM_DETAILS.description); + interceptURL('POST', '/api/v1/teams', 'saveTeam'); + interceptURL('GET', '/api/v1/team*', 'createTeam'); //Saving the created team cy.get('[form="add-team-form"]') @@ -71,7 +75,8 @@ describe('Teams flow should work properly', () => { .should('be.visible') .click(); - cy.wait(500); + verifyResponseStatusCode('@saveTeam', 201); + verifyResponseStatusCode('@createTeam', 200); cy.reload(); @@ -85,10 +90,10 @@ describe('Teams flow should work properly', () => { it('Add owner to created team', () => { //Clicking on created team cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click(); - updateOwner() + updateOwner(); }); -it('Add user to created team', () => { + it('Add user to created team', () => { //Click on created team cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click(); @@ -98,25 +103,32 @@ it('Add user to created team', () => { .should('be.visible') .click(); + interceptURL('GET', '/api/v1/users?limit=100000', 'addUser'); + interceptURL('GET', '/api/v1/users/*', 'getUsers'); cy.get('[data-testid="add-user"]') .scrollIntoView() .should('exist') .should('be.visible') .click(); - - cy.wait(2000); - + verifyResponseStatusCode('@addUser', 200); + verifyResponseStatusCode('@getUsers', 200); cy.get('[data-testid="searchbar"]').type(TEAM_DETAILS.ownername); cy.wait(500); - cy.get('[data-testid="checkboxAddUser"]').should('be.visible').click(); + cy.get('[data-testid="data-container"]').should( + 'contain', + TEAM_DETAILS.ownername + ); + cy.get('[data-testid="checkboxAddUser"]') + .first() + .should('be.visible') + .click(); //Saving the added user - + interceptURL('PATCH', '/api/v1/teams/*', 'saveUser'); cy.get('[data-testid="AddUserSave"]').should('be.visible').click(); - - cy.wait(500); + verifyResponseStatusCode('@saveUser', 200); //Asseting the added user cy.get('[data-testid="Users"]') .should('exist') @@ -140,8 +152,7 @@ it('Add user to created team', () => { //Click on confirm button cy.get('[data-testid="save-button"]').should('be.visible').click(); - // TODO: Remove cy.wait and wait for API to be completed before querying for new element - cy.wait(2000); + verifyResponseStatusCode('@saveUser', 200); //Verify if user is removed cy.get('[data-testid="Users"]') @@ -149,7 +160,10 @@ it('Add user to created team', () => { .should('be.visible') .click(); - cy.get('[data-testid="add-user"]').should('not.contain', TEAM_DETAILS.ownername); + cy.get('[data-testid="add-user"]').should( + 'not.contain', + TEAM_DETAILS.ownername + ); }); it('Join team should work properly', () => { @@ -166,10 +180,15 @@ it('Add user to created team', () => { }); it('Update description and display name for created team', () => { + interceptURL( + 'GET', + `/api/v1/teams/name/${TEAM_DETAILS.name}*`, + 'getSelectedTeam' + ); //Click on created team name cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click(); - cy.wait(500); + verifyResponseStatusCode('@getSelectedTeam', 200); //Click on edit display name cy.get('[data-testid="edit-synonyms"]').should('be.visible').click(); @@ -180,25 +199,25 @@ it('Add user to created team', () => { .clear() .type(TEAM_DETAILS.updatedname); + interceptURL('PATCH', 'api/v1/teams/*', 'saveTeamName'); + interceptURL('GET', '/api/v1/users*', 'updatedTeam'); //Save the updated display name cy.get('[data-testid="saveAssociatedTag"]') .should('exist') .should('be.visible') .click(); - - cy.wait(1000); + verifyResponseStatusCode('@saveTeamName', 200); //Validate the updated display name cy.get('[data-testid="header"]') .find('.ant-typography') .should('contain', TEAM_DETAILS.updatedname); + verifyResponseStatusCode('@updatedTeam', 200); //Click on edit description button - cy.get('[data-testid="edit-description"] > [data-testid="image"]').should('be.visible').click(); + cy.get('[data-testid="edit-description"]').should('be.visible').click(); //Entering updated description - cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror') - .clear() - .type(updateddescription); + cy.get(descriptionBox).clear().type(updateddescription); cy.get('[data-testid="save"]').should('be.visible').click(); //Validating the updated description @@ -267,9 +286,16 @@ it('Add user to created team', () => { }); it('Leave team flow should work properly', () => { + interceptURL( + 'GET', + `/api/v1/teams/name/${TEAM_DETAILS.name}*`, + 'getSelectedTeam' + ); + //Click on created team cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click(); + verifyResponseStatusCode('@getSelectedTeam', 200); // //Click on Leave team cy.get('[data-testid="leave-team-button"]').should('be.visible').click(); @@ -282,23 +308,28 @@ it('Add user to created team', () => { }); it('Delete created team', () => { + interceptURL( + 'GET', + `/api/v1/teams/name/${TEAM_DETAILS.name}*`, + 'getSelectedTeam' + ); //Click on created team cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click(); - cy.wait(500); + verifyResponseStatusCode('@getSelectedTeam', 200); cy.get('[data-testid="manage-button"]') .should('exist') .should('be.visible') .click(); - cy.wait(1000); + cy.get('[data-menu-id*="delete-button"]').should('be.visible'); + cy.get('[data-testid="delete-button-title"]') .should('exist') .should('be.visible') .click(); - cy.wait(1000); //Click on permanent delete option cy.get('[data-testid="hard-delete-option"]') .should('contain', TEAM_DETAILS.name) @@ -306,12 +337,14 @@ it('Add user to created team', () => { .click(); cy.get('[data-testid="confirmation-text-input"]').type('DELETE'); + + interceptURL('DELETE', '/api/v1/teams/*', 'deleteTeam'); cy.get('[data-testid="confirm-button"]') .should('exist') .should('be.visible') .click(); - cy.wait(500); + verifyResponseStatusCode('@deleteTeam', 200); //Verify the toast message toastNotification('Team deleted successfully!'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Users.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Users.spec.js index ca608b62629..817abc67204 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Users.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Users.spec.js @@ -22,7 +22,7 @@ const adminEmail = `${adminName}@gmail.com`; describe('Users flow should work properly', () => { beforeEach(() => { cy.goToHomePage(); - cy.wait(1000); + cy.get('[data-testid="appbar-item-settings"]') .should('exist') .should('be.visible') @@ -41,17 +41,7 @@ describe('Users flow should work properly', () => { addUser(userName, userEmail); //Validate if user is added in the User tab - cy.clickOnLogo(); - cy.wait(1000); - cy.get('[data-testid="appbar-item-settings"]') - .should('exist') - .should('be.visible') - .click(); - cy.get('.ant-menu-title-content') - .contains('Users') - .should('exist') - .should('be.visible') - .click(); + cy.get('[data-testid="searchbar"]') .should('exist') .should('be.visible') @@ -76,7 +66,7 @@ describe('Users flow should work properly', () => { describe('Admin flow should work properly', () => { beforeEach(() => { cy.goToHomePage(); - cy.wait(1000); + cy.get('[data-testid="appbar-item-settings"]') .should('exist') .should('be.visible') @@ -102,17 +92,7 @@ describe('Admin flow should work properly', () => { addUser(adminName, adminEmail); //Validate if user is added in the User tab - cy.clickOnLogo(); - cy.wait(1000); - cy.get('[data-testid="appbar-item-settings"]') - .should('exist') - .should('be.visible') - .click(); - cy.get('.ant-menu-title-content') - .contains('Admins') - .should('exist') - .should('be.visible') - .click(); + cy.get('[data-testid="searchbar"]') .should('exist') .should('be.visible') diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/myData.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/myData.spec.js index b1bb379e5ac..dd1b3df9280 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/myData.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/myData.spec.js @@ -13,7 +13,7 @@ /// -import { searchEntity, visitEntityTab } from '../../common/common'; +import { interceptURL, searchEntity, verifyResponseStatusCode, visitEntityTab } from '../../common/common'; import { FOLLOWING_TITLE, MYDATA_SUMMARY_OPTIONS, MY_DATA_TITLE, NO_SEARCHED_TERMS, RECENT_SEARCH_TITLE, RECENT_VIEW_TITLE, SEARCH_ENTITY_DASHBOARD, SEARCH_ENTITY_PIPELINE, SEARCH_ENTITY_TABLE, SEARCH_ENTITY_TOPIC } from '../../constants/constants'; const tables = Object.values(SEARCH_ENTITY_TABLE); @@ -86,19 +86,22 @@ describe('MyData page should work', () => { .should('have.class', 'active'); // click on the 1st result and go to entity details page and follow the entity - cy.wait(500); + interceptURL('GET', '/api/v1/feed*', 'getEntityDetails'); cy.get('[data-testid="table-link"]') .first() .contains(termObj.term, { matchCase: false }) .click(); - cy.wait(500); + verifyResponseStatusCode('@getEntityDetails', 200); + + interceptURL('PUT', '/api/v1/*/*/followers', 'waitAfterFollow'); cy.get('[data-testid="follow-button"]').should('be.visible').click(); + verifyResponseStatusCode('@waitAfterFollow', 200); // go to manage tab and search for logged in user and set the owner - + interceptURL('GET', '/api/v1/users/loggedInUser/groupTeams', 'getUsers'); cy.get('[data-testid="edit-Owner-icon"]').should('be.visible').click(); - cy.wait(500); + verifyResponseStatusCode('@getUsers', 200); //Clicking on users tab cy.get('[data-testid="dropdown-tab"]') .contains('Users') @@ -111,7 +114,6 @@ describe('MyData page should work', () => { .should('exist') .should('be.visible') .click(); - cy.wait(1000); cy.get(':nth-child(2) > [data-testid="owner-link"]') .scrollIntoView()