Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. import {getRandomInt} from '../../utils';
  2.  
  3. describe('Recent Emoji', () => {
  4. before(() => {
  5. // 1. Login and go to /
  6. cy.login('user-1');
  7. cy.visit('/');
  8. });
  9.  
  10. it('M14014 Recently used emojis are shown 1st', async () => {
  11. // 2. Select first emoji and submit as a post
  12. const firstEmoji = getRandomInt(400);
  13. cy.get('#emojiPickerButton').should('be.visible').click();
  14. cy.get('.emoji-picker__item').eq(firstEmoji).click();
  15. cy.get('#create_post').submit();
  16.  
  17. // 3. Select seond emoji as reaction to the last post
  18. const secondEmoji = getRandomInt(400);
  19. cy.clickPostReactionIcon();
  20. cy.get('.emoji-picker__item').eq(secondEmoji).click();
  21.  
  22. // 4. Wait for some time to make sure that post emoji or reaction is saved in the server
  23. cy.wait(500); // eslint-disable-line
  24.  
  25. // 11. Open emoji list
  26. cy.get('#emojiPickerButton').click();
  27.  
  28. // * Assert first emoji to be listed as second to the recent emoji
  29. cy.get('.emoji-picker__item').eq(firstEmoji).find('img').then(($el) => {
  30. cy.get('.emoji-picker__item').eq(1).find('img').should('have.attr', 'src', $el.attr('src'));
  31. });
  32.  
  33. // * Assert recent emoji should equal with last post emoji
  34. // * Assert second emoji to be listed as first to the recent emoji
  35. cy.get('.emoji-picker__item').eq(secondEmoji).find('img').then(($el) => {
  36. cy.get('.emoji-picker__item').eq(0).find('img').should('have.attr', 'src', $el.attr('src'));
  37. });
  38. });
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement