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

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