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

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