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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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-dropdown-btn').click({force: true});
  78. cy.get('#bookmark-dropdown-btn').should('have.class', 'active');
  79. // Close toaster
  80. cy.get('.Toastify__toast').should('be.visible').then(toast => {
  81. cy.wrap(toast).within(() => {
  82. cy.get('.Toastify__close-button').should('be.visible').click();
  83. cy.get('.Toastify__progress-bar').invoke('attr', 'style', 'display: none')
  84. });
  85. });
  86. // position of the element is not fixed to be displayed, so the element is removed
  87. cy.get('body').then($body => {
  88. if ($body.find('[data-testid="bookmark-button-tooltip"]').length > 0) {
  89. cy.getByTestid('bookmark-button-tooltip').invoke('remove');
  90. }
  91. })
  92. cy.getByTestid('bookmark-button-tooltip').should('not.exist');
  93. cy.waitUntilSpinnerDisappear();
  94. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}7-bookmark-page`) });
  95. // total bookmarker
  96. cy.waitUntil(() => {
  97. // do
  98. cy.get('#po-total-bookmarks').click({force: true});
  99. // wait until
  100. return cy.get('body').within(() => {
  101. return Cypress.$('.user-list-popover').is(':visible');
  102. });
  103. });
  104. cy.waitUntilSpinnerDisappear();
  105. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}8-bookmarks-counter`) });
  106. // unbookmark
  107. cy.get('#bookmark-dropdown-btn').click({force: true});
  108. cy.get('.grw-bookmark-folder-menu').should('be.visible');
  109. cy.get('.grw-bookmark-folder-menu-item').first().click({force: true});
  110. cy.get('#bookmark-dropdown-btn').should('not.have.class', 'active');
  111. // Close toaster
  112. cy.get('.Toastify__toast').should('be.visible').then(toast => {
  113. cy.wrap(toast).within(() => {
  114. cy.get('.Toastify__close-button').should('be.visible').click();
  115. cy.get('.Toastify__progress-bar').invoke('attr', 'style', 'display: none')
  116. });
  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="bookmark-button-tooltip"]').length > 0) {
  121. cy.getByTestid('bookmark-button-tooltip').invoke('remove');
  122. }
  123. })
  124. cy.getByTestid('bookmark-button-tooltip').should('not.exist');
  125. cy.waitUntilSpinnerDisappear();
  126. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}9-unbookmark-page`) });
  127. // total bookmarker
  128. cy.waitUntil(() => {
  129. // do
  130. cy.get('#po-total-bookmarks').click({force: true});
  131. // wait until
  132. return cy.get('body').within(() => {
  133. return Cypress.$('.user-list-popover').is(':visible');
  134. });
  135. });
  136. cy.waitUntilSpinnerDisappear();
  137. cy.get('#grw-subnav-container').within(() => { cy.screenshot(`${ssPrefix}10-bookmarks-counter`) });
  138. });
  139. // user-list-popover is commented out because it is sometimes displayed and sometimes not
  140. // it('Successfully display list of "seen by user"', () => {
  141. // cy.visit('/Sandbox');
  142. // cy.waitUntilSkeletonDisappear();
  143. // cy.get('#grw-subnav-container').within(() => {
  144. // cy.get('div.grw-seen-user-info').find('button#btn-seen-user').click({force: true});
  145. // });
  146. // // position of the element is not fixed to be displayed, so the element is removed
  147. // cy.get('body').then($body => {
  148. // if ($body.find('[data-testid="seen-user-info-tooltip"]').length > 0) {
  149. // cy.getByTestid('seen-user-info-tooltip').invoke('remove');
  150. // }
  151. // })
  152. // cy.getByTestid('seen-user-info-tooltip').should('not.exist');
  153. // cy.get('.user-list-popover').should('be.visible')
  154. // cy.get('#grw-subnav-container').within(() => {
  155. // cy.screenshot(`${ssPrefix}11-seen-user-list`);
  156. // });
  157. // });
  158. });