cypress: worked on flaky ui cypress (#12772)

This commit is contained in:
Shailesh Parmar 2023-08-07 19:02:04 +05:30 committed by GitHub
parent 73a8741619
commit d0f9428333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 9 deletions

View File

@ -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"]'

View File

@ -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);