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

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