20-basic-features--access-to-page.spec.ts 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. context('Access to page', () => {
  2. const ssPrefix = 'access-to-page-';
  3. beforeEach(() => {
  4. // login
  5. cy.fixture("user-admin.json").then(user => {
  6. cy.login(user.username, user.password);
  7. });
  8. });
  9. it('/Sandbox is successfully loaded', () => {
  10. cy.visit('/Sandbox');
  11. cy.waitUntilSkeletonDisappear();
  12. // for check download toc data
  13. cy.get('.toc-link').eq(0).contains('Table of Contents');
  14. cy.collapseSidebar(true, true);
  15. cy.screenshot(`${ssPrefix}-sandbox`);
  16. });
  17. // TODO: https://redmine.weseek.co.jp/issues/109939
  18. it('/Sandbox with anchor hash is successfully loaded', () => {
  19. cy.visit('/Sandbox#Headers');
  20. cy.waitUntilSkeletonDisappear();
  21. // for check download toc data
  22. cy.get('.toc-link').should('be.visible');
  23. // hide fab // disable fab for sticky-events warning
  24. // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
  25. // remove animation for screenshot
  26. // remove 'blink' class because ::after element cannot be operated
  27. // https://stackoverflow.com/questions/5041494/selecting-and-manipulating-css-pseudo-elements-such-as-before-and-after-usin/21709814#21709814
  28. cy.get('#mdcont-headers').invoke('removeClass', 'blink');
  29. cy.screenshot(`${ssPrefix}-sandbox-headers`);
  30. });
  31. it('/Sandbox/Math is successfully loaded', () => {
  32. cy.visit('/Sandbox/Math');
  33. cy.waitUntilSkeletonDisappear();
  34. // for check download toc data
  35. cy.get('.toc-link').should('be.visible');
  36. cy.get('.math').should('be.visible');
  37. cy.screenshot(`${ssPrefix}-sandbox-math`);
  38. });
  39. it('/Sandbox with edit is successfully loaded', () => {
  40. cy.visit('/Sandbox#edit');
  41. cy.waitUntilSkeletonDisappear();
  42. cy.getByTestid('navbar-editor').should('be.visible');
  43. cy.get('.grw-editor-navbar-bottom').should('be.visible');
  44. cy.getByTestid('save-page-btn').should('be.visible');
  45. cy.get('.grw-grant-selector').should('be.visible');
  46. cy.collapseSidebar(true);
  47. cy.screenshot(`${ssPrefix}-Sandbox-edit-page`);
  48. })
  49. it('/user/admin is successfully loaded', () => {
  50. cy.visit('/user/admin');
  51. cy.waitUntilSkeletonDisappear();
  52. // for check download toc data
  53. cy.get('.toc-link').should('be.visible');
  54. // eslint-disable-next-line cypress/no-unnecessary-waiting
  55. cy.wait(2000); // wait for calcViewHeight and rendering
  56. cy.collapseSidebar(true);
  57. cy.screenshot(`${ssPrefix}-user-admin`);
  58. });
  59. });
  60. context('Access to /me page', () => {
  61. const ssPrefix = 'access-to-me-page-';
  62. beforeEach(() => {
  63. // login
  64. cy.fixture("user-admin.json").then(user => {
  65. cy.login(user.username, user.password);
  66. });
  67. });
  68. it('/me is successfully loaded', () => {
  69. cy.visit('/me');
  70. cy.getByTestid('grw-user-settings').should('be.visible');
  71. cy.collapseSidebar(true);
  72. cy.screenshot(`${ssPrefix}-me`);
  73. });
  74. // it('Draft page is successfully shown', () => {
  75. // cy.visit('/me/drafts');
  76. // cy.screenshot(`${ssPrefix}-draft-page`);
  77. // });
  78. });
  79. context('Access to special pages', () => {
  80. const ssPrefix = 'access-to-special-pages-';
  81. beforeEach(() => {
  82. // login
  83. cy.fixture("user-admin.json").then(user => {
  84. cy.login(user.username, user.password);
  85. });
  86. });
  87. it('/trash is successfully loaded', () => {
  88. cy.visit('/trash');
  89. cy.getByTestid('trash-page-list').contains('There are no pages under this page.');
  90. cy.collapseSidebar(true);
  91. cy.screenshot(`${ssPrefix}-trash`);
  92. });
  93. it('/tags is successfully loaded', { scrollBehavior: false } ,() => {
  94. // open sidebar
  95. // cy.collapseSidebar(false);
  96. cy.visit('/tags');
  97. // cy.getByTestid('grw-sidebar-content-tags').within(() => {
  98. // cy.getByTestid('grw-tags-list').should('be.visible');
  99. // cy.getByTestid('grw-tags-list').contains('You have no tag, You can set tags on pages');
  100. // })
  101. cy.getByTestid('tags-page').within(() => {
  102. cy.getByTestid('grw-tags-list').should('be.visible');
  103. cy.getByTestid('grw-tags-list').contains('You have no tag, You can set tags on pages');
  104. });
  105. cy.collapseSidebar(true);
  106. cy.screenshot(`${ssPrefix}-tags`);
  107. });
  108. });
  109. context('Access to Template Editing Mode', () => {
  110. const ssPrefix = 'access-to-modal-';
  111. beforeEach(() => {
  112. // login
  113. cy.fixture("user-admin.json").then(user => {
  114. cy.login(user.username, user.password);
  115. });
  116. });
  117. // TODO: 109057
  118. // it('Access to Template Editor mode for only child pages successfully', () => {
  119. // cy.visit('/Sandbox/Bootstrap4', { });
  120. // cy.waitUntilSkeletonDisappear();
  121. // cy.get('#grw-subnav-container').within(() => {
  122. // cy.getByTestid('open-page-item-control-btn').should('be.visible');
  123. // cy.getByTestid('open-page-item-control-btn').click();
  124. // cy.getByTestid('open-page-template-modal-btn').should('be.visible');
  125. // cy.getByTestid('open-page-template-modal-btn').click();
  126. // });
  127. // cy.getByTestid('page-template-modal').should('be.visible');
  128. // cy.screenshot(`${ssPrefix}-open-page-template-bootstrap4`);
  129. // Todo: `@`alias may be changed. This code was made in an attempt to solve the error of element being dettached from the dom which couldn't be solved at this time.
  130. // Wait for Todo: 109057 is solved and fix or leave the code below for better test code.
  131. // cy.getByTestid('template-button-children').as('template-button-children');
  132. // cy.get('@template-button-children').should('be.visible').click();
  133. // cy.waitUntilSkeletonDisappear();
  134. // cy.getByTestid('navbar-editor').should('be.visible').then(()=>{
  135. // cy.url().should('include', '/_template#edit');
  136. // cy.screenshot();
  137. // });
  138. // });
  139. // TODO: 109057
  140. // it('Access to Template Editor mode including decendants successfully', () => {
  141. // cy.visit('/Sandbox/Bootstrap4', { });
  142. // cy.waitUntilSkeletonDisappear();
  143. // cy.get('#grw-subnav-container').within(() => {
  144. // cy.getByTestid('open-page-item-control-btn').should('be.visible');
  145. // cy.getByTestid('open-page-item-control-btn').click();
  146. // cy.getByTestid('open-page-template-modal-btn').should('be.visible');
  147. // cy.getByTestid('open-page-template-modal-btn').click();
  148. // });
  149. // cy.getByTestid('page-template-modal').should('be.visible');
  150. // Todo: `@`alias may be changed. This code was made in an attempt to solve the error of element being dettached from the dom which couldn't be solved at this time.
  151. // Wait for Todo: 109057 is solved and fix or leave the code below for better test code.
  152. // cy.getByTestid('template-button-decendants').as('template-button-decendants');
  153. // cy.get('@template-button-decendants').should('be.visible').click();
  154. // cy.waitUntilSkeletonDisappear();
  155. // cy.getByTestid('navbar-editor').should('be.visible').then(()=>{
  156. // cy.url().should('include', '/__template#edit');
  157. // cy.screenshot();
  158. // });
  159. // });
  160. });
  161. context('Access to /me/all-in-app-notifications', () => {
  162. const ssPrefix = 'in-app-notifications-';
  163. beforeEach(() => {
  164. // login
  165. cy.fixture("user-admin.json").then(user => {
  166. cy.login(user.username, user.password);
  167. });
  168. });
  169. it('All In-App Notification list is successfully loaded', { scrollBehavior: false },() => {
  170. cy.visit('/');
  171. cy.get('.notification-wrapper').click();
  172. cy.get('.notification-wrapper > .dropdown-menu > a').click();
  173. cy.getByTestid('grw-in-app-notification-page').should('be.visible');
  174. cy.getByTestid('grw-in-app-notification-page-spinner').should('not.exist');
  175. cy.collapseSidebar(true);
  176. cy.screenshot(`${ssPrefix}-see-all`);
  177. cy.get('.grw-custom-nav-tab > div > ul > li:nth-child(2) > a').click();
  178. cy.getByTestid('grw-in-app-notification-page-spinner').should('not.exist');
  179. cy.collapseSidebar(true);
  180. cy.screenshot(`${ssPrefix}-see-unread`);
  181. });
  182. })