From d0f9428333091ac8ffc210c566fa508e14c811e7 Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Mon, 7 Aug 2023 19:02:04 +0530 Subject: [PATCH] cypress: worked on flaky ui cypress (#12772) --- .../cypress/e2e/Features/ActivityFeed.spec.js | 46 ++++++++++++++++--- .../e2e/Flow/AddAndRemoveTierAndOwner.spec.js | 5 +- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/ActivityFeed.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/ActivityFeed.spec.js index 935009ecac9..a4abb42a0aa 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/ActivityFeed.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/ActivityFeed.spec.js @@ -32,10 +32,13 @@ const reactOnFeed = (feedSelector, reaction) => { cy.get('[data-testid="add-reactions"]').click(); }); }); - - cy.get( - `#reaction-popover [data-testid="reaction-button"][title="${reaction}"]` - ).click(); + cy.get('.ant-popover-inner-content') + .should('be.visible') + .then(() => { + cy.get( + `#reaction-popover [data-testid="reaction-button"][title="${reaction}"]` + ).click(); + }); }; describe('Activity feed', () => { @@ -130,6 +133,31 @@ describe('Activity feed', () => { }); }); + it('Remove Emoji reaction from feed', () => { + // remove reaction for latest feed + [ + 'thumbsUp', + 'thumbsDown', + 'laugh', + 'hooray', + 'confused', + 'heart', + 'eyes', + 'rocket', + ].map((reaction) => + reactOnFeed( + '[data-testid="activity-feed-widget"] [data-testid="message-container"]:first-child', + reaction + ) + ); + + // Verify if reaction is working or not + cy.get('[data-testid="message-container"]') + .eq(1) + .find('[data-testid="feed-reaction-container"]') + .should('not.exist'); + }); + it('User should be able to reply to feed', () => { interceptURL('GET', '/api/v1/feed/*', 'fetchFeed'); cy.get( @@ -162,7 +190,7 @@ describe('Activity feed', () => { '[data-testid="editor-wrapper"] [contenteditable="true"].ql-editor' ).as('editor'); cy.get('@editor').click(); - cy.get('@editor').type('Cypress has replied here. Thanks! @aa'); + cy.get('@editor').type('Cypress has replied here. Thanks! @aaron_johnson0'); verifyResponseStatusCode('@suggestUser', 200); cy.get('[data-value="@aaron_johnson0"]').click(); @@ -197,6 +225,11 @@ describe('Activity feed', () => { it('Mention should work for the feed reply', () => { interceptURL('GET', '/api/v1/feed/*', 'fetchFeed'); + interceptURL( + 'GET', + '/api/v1/feed?filterType=MENTIONS&userId=*', + 'mentionsFeed' + ); cy.get( '[data-testid="activity-feed-widget"] [data-testid="message-container"]:first-child' ).within(() => { @@ -222,7 +255,6 @@ describe('Activity feed', () => { ).as('editor'); cy.get('@editor').click(); cy.get('@editor').type('Can you resolve this thread for me? @admin'); - // verifyResponseStatusCode('@suggestUser', 200); cy.get('[data-value="@admin"]').click(); cy.get('[data-testid="send-button"]') @@ -244,7 +276,7 @@ describe('Activity feed', () => { cy.get('[data-testid="activity-feed-widget"]') .contains('@Mentions') .click(); - + verifyResponseStatusCode('@mentionsFeed', 200); // Verify mentioned thread should be there int he mentioned tab cy.get( '[data-testid="message-container"] > .activity-feed-card [data-testid="viewer-container"]' diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js index 201212479cc..466060a7349 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js @@ -81,12 +81,13 @@ const addRemoveOwner = (isGlossaryPage) => { }; const addRemoveTier = () => { + interceptURL('GET', '/api/v1/tags?parent=Tier&limit=10', 'fetchTier'); cy.get('[data-testid="edit-tier"]').click(); + verifyResponseStatusCode('@fetchTier', 200); cy.get('[data-testid="radio-btn-Tier1"]').click({ waitForAnimations: true }); - + verifyResponseStatusCode('@patchOwner', 200); cy.get('[data-testid="radio-btn-Tier1"]').should('be.checked'); - verifyResponseStatusCode('@patchOwner', 200); cy.clickOutside(); cy.get('[data-testid="Tier"]').should('contain', TIER);