From 8b0df23b95be929106a6cb94365a79c906427d1d Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Thu, 1 Jun 2023 21:27:26 +0530 Subject: [PATCH] cypress: fixed flaky cypress for service specs (#11850) * cypress: fixed flaky cypress for service specs * updated teams cypress --- .../resources/ui/cypress/common/common.js | 21 ++++++++++++------- .../ui/cypress/e2e/Pages/Teams.spec.js | 15 +++++++++++-- 2 files changed, 26 insertions(+), 10 deletions(-) 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 a871baea9c3..93732bfa23e 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -129,10 +129,11 @@ export const handleIngestionRetry = ( if (retryCount !== 0) { cy.wait('@allPermissions').then(() => { - verifyResponseStatusCode('@serviceDetails', 200); - verifyResponseStatusCode('@ingestionPipelines', 200); - verifyResponseStatusCode('@pipelineStatuses', 200, { - responseTimeout: 50000, + cy.wait('@serviceDetails').then(() => { + verifyResponseStatusCode('@ingestionPipelines', 200); + verifyResponseStatusCode('@pipelineStatuses', 200, { + responseTimeout: 50000, + }); }); }); } @@ -473,7 +474,11 @@ export const editOwnerforCreatedService = ( '/api/v1/system/config/pipeline-service-client', 'airflow' ); - interceptURL('GET', '/api/v1/databases?service=*&fields=*', 'database'); + interceptURL( + 'GET', + `/api/v1/*?service=${service_Name}&fields=*`, + 'assetsDetail' + ); // click on created service cy.get(`[data-testid="service-name-${service_Name}"]`) .should('exist') @@ -483,9 +488,9 @@ export const editOwnerforCreatedService = ( verifyResponseStatusCode('@getSelectedService', 200); verifyResponseStatusCode('@waitForIngestion', 200); verifyResponseStatusCode('@airflow', 200); - if (isDatabaseService(service_type)) { - verifyResponseStatusCode('@database', 200); - } + + verifyResponseStatusCode('@assetsDetail', 200); + interceptURL('GET', '/api/v1/users?&isBot=false&limit=15', 'waitForUsers'); // Click on edit owner button 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 1861a49ef91..1324ecd4ba2 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,6 +11,9 @@ * limitations under the License. */ +// eslint-disable-next-line spaced-comment +/// + import { addTeam, descriptionBox, @@ -94,7 +97,8 @@ describe('Teams flow should work properly', () => { verifyResponseStatusCode('@getUserDetails', 200); verifyResponseStatusCode('@getTeam', 200); - cy.get('[data-testid="edit-email"]').should('be.visible').click(); + cy.get('[data-testid="edit-email"]').should('be.visible').scrollIntoView(); + cy.get('[data-testid="edit-email"]').click(); cy.get('[data-testid="email-input"]') .should('be.visible') .clear() @@ -121,11 +125,18 @@ describe('Teams flow should work properly', () => { .click(); verifyResponseStatusCode('@getUserDetails', 200); verifyResponseStatusCode('@permissions', 200); - cy.get('[data-testid="add-new-user"]').should('be.visible').click(); + cy.get('[data-testid="add-new-user"]') + .should('be.visible') + .scrollIntoView(); + cy.get('[data-testid="add-new-user"]').click(); verifyResponseStatusCode('@getUsers', 200); cy.get('[data-testid="selectable-list"]') .find(`[title="${TEAM_DETAILS.username}"]`) .click(); + cy.get('[data-testid="selectable-list"]') + .find(`[title="${TEAM_DETAILS.username}"] input[type='checkbox']`) + .should('be.checked'); + cy.get('[data-testid="selectable-list-update-btn"]') .should('be.visible') .click();