From 9248a751cdd4b6b63084f60be849bf9f44bf653a Mon Sep 17 00:00:00 2001 From: Joseph Baylon Date: Tue, 6 Oct 2020 10:17:23 -0700 Subject: [PATCH] Cypress/E2E: Stabilize emoji specs (#6657) --- .../emoji/recently_used_emoji_spec.js | 11 ++-- .../messaging/emoji_to_markdown_spec.js | 57 ++++++++++--------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/e2e/cypress/integration/emoji/recently_used_emoji_spec.js b/e2e/cypress/integration/emoji/recently_used_emoji_spec.js index 181640e2bbf0..d2243819fd62 100644 --- a/e2e/cypress/integration/emoji/recently_used_emoji_spec.js +++ b/e2e/cypress/integration/emoji/recently_used_emoji_spec.js @@ -34,22 +34,19 @@ describe('Recent Emoji', () => { // # Click first emoji cy.get('#emojiPicker').should('be.visible'); - cy.get('.emoji-picker__item').eq(firstEmoji).click(); + cy.get('.emoji-picker__item').eq(firstEmoji).click().wait(TIMEOUTS.HALF_SEC); // # Submit post - cy.get('#create_post').submit(); - - // # Wait 500 millisecond - cy.wait(TIMEOUTS.HALF_SEC); + cy.get('#create_post').submit().wait(TIMEOUTS.HALF_SEC); // # Post reaction to post cy.clickPostReactionIcon(); // # Click second emoji - cy.get('.emoji-picker__item').eq(secondEmoji).click(); + cy.get('.emoji-picker__item').eq(secondEmoji).click().wait(TIMEOUTS.HALF_SEC); // # Show emoji list - cy.get('#emojiPickerButton').click(); + cy.get('#emojiPickerButton').click().wait(TIMEOUTS.HALF_SEC); // * Assert first emoji should equal with second recent emoji cy.get('.emoji-picker__item').eq(firstEmoji + 2).find('img').then(($el) => { diff --git a/e2e/cypress/integration/messaging/emoji_to_markdown_spec.js b/e2e/cypress/integration/messaging/emoji_to_markdown_spec.js index 39a8b15330db..e9b15ba4e57a 100644 --- a/e2e/cypress/integration/messaging/emoji_to_markdown_spec.js +++ b/e2e/cypress/integration/messaging/emoji_to_markdown_spec.js @@ -10,11 +10,41 @@ // Stage: @prod // Group: @messaging +import * as TIMEOUTS from '../../fixtures/timeouts'; + +describe('Messaging', () => { + before(() => { + // # Login as test user and visit town-square + cy.apiInitSetup({loginAfter: true}).then(({team}) => { + cy.visit(`/${team.name}/channels/town-square`); + }); + }); + + it('MM-T198 Emojis preceeded by 4 or more spaces are always treated as markdown', () => { + [ + ' :taco:', + ' :taco:', + ' :D', + ' :D', + ].forEach((message) => { + createAndVerifyMessage(message, true); + }); + + [ + ' :taco:', + ' :D', + ].forEach((message) => { + createAndVerifyMessage(message, false); + }); + }); +}); + function createMessages(message, aliases) { cy.postMessage(message); cy.getLastPostId().then((postId) => { cy.get(`#postMessageText_${postId}`).as(aliases[0]); cy.clickPostCommentIcon(postId); + cy.wait(TIMEOUTS.HALF_SEC); }); cy.postMessageReplyInRHS(message); @@ -43,30 +73,3 @@ function createAndVerifyMessage(message, isCode) { }); } } - -describe('Messaging', () => { - before(() => { - // # Login as test user and visit town-square - cy.apiInitSetup({loginAfter: true}).then(({team}) => { - cy.visit(`/${team.name}/channels/town-square`); - }); - }); - - it('MM-T198 Emojis preceeded by 4 or more spaces are always treated as markdown', () => { - [ - ' :taco:', - ' :taco:', - ' :D', - ' :D', - ].forEach((message) => { - createAndVerifyMessage(message, true); - }); - - [ - ' :taco:', - ' :D', - ].forEach((message) => { - createAndVerifyMessage(message, false); - }); - }); -});