20-basic-features--click-page-icons.spec.ts 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. context('Click page icons button', () => {
  2. const ssPrefix = 'click-page-icon-';
  3. beforeEach(() => {
  4. // login
  5. cy.fixture("user-admin.json").then(user => {
  6. cy.login(user.username, user.password);
  7. });
  8. });
  9. it('Successfully subscribe/unsubscribe a page', () => {
  10. cy.visit('/Sandbox');
  11. cy.collapseSidebar(true, true);
  12. // Subscribe
  13. cy.get('#subscribe-button').click({force: true});
  14. cy.get('#subscribe-button').should('have.class', 'active');
  15. // position of the element is not fixed to be displayed, so the element is removed
  16. cy.get('body').then($body => {
  17. if ($body.find('[data-testid="subscribe-button-tooltip"]').length > 0) {
  18. cy.getByTestid('subscribe-button-tooltip').invoke('remove');
  19. }
  20. })
  21. cy.getByTestid('subscribe-button-tooltip').should('not.exist');
  22. cy.waitUntilSkeletonDisappear();
  23. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}1-subscribe-page`) })
  24. // Unsubscribe
  25. cy.get('#subscribe-button').click({force: true});
  26. cy.get('#subscribe-button').should('not.have.class', 'active');
  27. // position of the element is not fixed to be displayed, so the element is removed
  28. cy.get('body').then($body => {
  29. if ($body.find('[data-testid="subscribe-button-tooltip"]').length > 0) {
  30. cy.getByTestid('subscribe-button-tooltip').invoke('remove');
  31. }
  32. })
  33. cy.getByTestid('subscribe-button-tooltip').should('not.exist');
  34. cy.waitUntilSkeletonDisappear();
  35. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}2-unsubscribe-page`) })
  36. });
  37. it('Successfully Like / Dislike a page', () => {
  38. cy.visit('/Sandbox');
  39. cy.collapseSidebar(true);
  40. // like
  41. cy.get('#like-button').click({force: true});
  42. cy.get('#like-button').should('have.class', 'active');
  43. // position of the element is not fixed to be displayed, so the element is removed
  44. cy.get('body').then($body => {
  45. if ($body.find('[data-testid="like-button-tooltip"]').length > 0) {
  46. cy.getByTestid('like-button-tooltip').invoke('remove');
  47. }
  48. })
  49. cy.getByTestid('like-button-tooltip').should('not.exist');
  50. cy.waitUntilSpinnerDisappear();
  51. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}3-like-page`) });
  52. // total liker (user-list-popover is commented out because it is sometimes displayed and sometimes not.)
  53. // cy.get('#po-total-likes').click({force: true});
  54. // cy.get('.user-list-popover').should('be.visible')
  55. // cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}4-likes-counter`) });
  56. // unlike
  57. cy.get('#like-button').click({force: true});
  58. cy.get('#like-button').should('not.have.class', 'active');
  59. // position of the element is not fixed to be displayed, so the element is removed
  60. cy.get('body').then($body => {
  61. if ($body.find('[data-testid="like-button-tooltip"]').length > 0) {
  62. cy.getByTestid('like-button-tooltip').invoke('remove');
  63. }
  64. })
  65. cy.getByTestid('like-button-tooltip').should('not.exist');
  66. cy.waitUntilSpinnerDisappear();
  67. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}5-dislike-page`) });
  68. // total liker (user-list-popover is commented out because it is sometimes displayed and sometimes not.)
  69. // cy.get('#po-total-likes').click({force: true});
  70. // cy.get('.user-list-popover').should('be.visible');
  71. // cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}6-likes-counter`) });
  72. });
  73. it('Successfully Bookmark / Unbookmark a page', () => {
  74. cy.visit('/Sandbox');
  75. cy.collapseSidebar(true);
  76. // bookmark
  77. cy.get('#bookmark-button').click({force: true});
  78. cy.get('#bookmark-button').should('have.class', 'active');
  79. // position of the element is not fixed to be displayed, so the element is removed
  80. cy.get('body').then($body => {
  81. if ($body.find('[data-testid="bookmark-button-tooltip"]').length > 0) {
  82. cy.getByTestid('bookmark-button-tooltip').invoke('remove');
  83. }
  84. })
  85. cy.getByTestid('bookmark-button-tooltip').should('not.exist');
  86. cy.waitUntilSpinnerDisappear();
  87. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}7-bookmark-page`) });
  88. // total bookmarker
  89. cy.get('#po-total-bookmarks').click({force: true});
  90. cy.get('.user-list-popover').should('be.visible');
  91. cy.waitUntilSpinnerDisappear();
  92. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}8-bookmarks-counter`) });
  93. // unbookmark
  94. cy.get('#bookmark-button').click({force: true});
  95. cy.get('#bookmark-button').should('not.have.class', 'active');
  96. // position of the element is not fixed to be displayed, so the element is removed
  97. cy.get('body').then($body => {
  98. if ($body.find('[data-testid="bookmark-button-tooltip"]').length > 0) {
  99. cy.getByTestid('bookmark-button-tooltip').invoke('remove');
  100. }
  101. })
  102. cy.getByTestid('bookmark-button-tooltip').should('not.exist');
  103. cy.waitUntilSpinnerDisappear();
  104. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}9-unbookmark-page`) });
  105. // total bookmarker
  106. cy.get('#po-total-bookmarks').click({force: true});
  107. cy.get('.user-list-popover').should('be.visible');
  108. cy.waitUntilSpinnerDisappear();
  109. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}10-bookmarks-counter`) });
  110. });
  111. // user-list-popover is commented out because it is sometimes displayed and sometimes not
  112. // it('Successfully display list of "seen by user"', () => {
  113. // cy.visit('/Sandbox');
  114. // cy.waitUntilSkeletonDisappear();
  115. // cy.get('#grw-subnav-container').within(() => {
  116. // cy.get('div.grw-seen-user-info').find('button#btn-seen-user').click({force: true});
  117. // });
  118. // // position of the element is not fixed to be displayed, so the element is removed
  119. // cy.get('body').then($body => {
  120. // if ($body.find('[data-testid="seen-user-info-tooltip"]').length > 0) {
  121. // cy.getByTestid('seen-user-info-tooltip').invoke('remove');
  122. // }
  123. // })
  124. // cy.getByTestid('seen-user-info-tooltip').should('not.exist');
  125. // cy.get('.user-list-popover').should('be.visible')
  126. // cy.get('#grw-subnav-container').within(() => {
  127. // cy.screenshot(`${ssPrefix}11-seen-user-list`);
  128. // });
  129. // });
  130. });