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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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);
  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.collapseSidebar(true);
  37. cy.screenshot(`${ssPrefix}-sandbox-math`);
  38. });
  39. it('/Sandbox with edit is successfully loaded', () => {
  40. cy.visit('/Sandbox');
  41. cy.waitUntilSkeletonDisappear();
  42. cy.get('#grw-subnav-container').should('be.visible').within(() => {
  43. // eslint-disable-next-line cypress/no-unnecessary-waiting
  44. cy.wait(2000);
  45. cy.getByTestid('editor-button').should('be.visible').click();
  46. })
  47. cy.getByTestid('navbar-editor').should('be.visible');
  48. cy.get('.grw-editor-navbar-bottom').should('be.visible');
  49. cy.getByTestid('save-page-btn').should('be.visible');
  50. cy.get('.grw-grant-selector').should('be.visible')
  51. cy.screenshot(`${ssPrefix}-Sandbox-edit-page`);
  52. })
  53. it('/user/admin is successfully loaded', () => {
  54. cy.visit('/user/admin');
  55. cy.waitUntilSkeletonDisappear();
  56. // for check download toc data
  57. cy.get('.toc-link').should('be.visible');
  58. // eslint-disable-next-line cypress/no-unnecessary-waiting
  59. cy.wait(2000); // wait for calcViewHeight and rendering
  60. cy.collapseSidebar(true);
  61. cy.screenshot(`${ssPrefix}-user-admin`);
  62. });
  63. });
  64. context('Access to /me page', () => {
  65. const ssPrefix = 'access-to-me-page-';
  66. beforeEach(() => {
  67. // login
  68. cy.fixture("user-admin.json").then(user => {
  69. cy.login(user.username, user.password);
  70. });
  71. });
  72. it('/me is successfully loaded', () => {
  73. cy.visit('/me');
  74. cy.getByTestid('grw-user-settings').should('be.visible');
  75. cy.collapseSidebar(true);
  76. cy.screenshot(`${ssPrefix}-me`);
  77. });
  78. // it('Draft page is successfully shown', () => {
  79. // cy.visit('/me/drafts');
  80. // cy.screenshot(`${ssPrefix}-draft-page`);
  81. // });
  82. });
  83. context('Access to special pages', () => {
  84. const ssPrefix = 'access-to-special-pages-';
  85. beforeEach(() => {
  86. // login
  87. cy.fixture("user-admin.json").then(user => {
  88. cy.login(user.username, user.password);
  89. });
  90. });
  91. it('/trash is successfully loaded', () => {
  92. cy.visit('/trash');
  93. cy.getByTestid('trash-page-list').contains('There are no pages under this page.');
  94. cy.collapseSidebar(true);
  95. cy.screenshot(`${ssPrefix}-trash`);
  96. });
  97. it('/tags is successfully loaded', { scrollBehavior: false } ,() => {
  98. // open sidebar
  99. // cy.collapseSidebar(false);
  100. cy.visit('/tags');
  101. // cy.getByTestid('grw-sidebar-content-tags').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.getByTestid('tags-page').within(() => {
  106. cy.getByTestid('grw-tags-list').should('be.visible');
  107. cy.getByTestid('grw-tags-list').contains('You have no tag, You can set tags on pages');
  108. });
  109. cy.collapseSidebar(true);
  110. cy.screenshot(`${ssPrefix}-tags`);
  111. });
  112. });
  113. context('Access to Template Editing Mode', () => {
  114. const ssPrefix = 'access-to-modal-';
  115. beforeEach(() => {
  116. // login
  117. cy.fixture("user-admin.json").then(user => {
  118. cy.login(user.username, user.password);
  119. });
  120. });
  121. // TODO: 109057
  122. // it('Access to Template Editor mode for only child pages successfully', () => {
  123. // cy.visit('/Sandbox/Bootstrap4', { });
  124. // cy.waitUntilSkeletonDisappear();
  125. // cy.get('#grw-subnav-container').within(() => {
  126. // cy.getByTestid('open-page-item-control-btn').should('be.visible');
  127. // cy.getByTestid('open-page-item-control-btn').click();
  128. // cy.getByTestid('open-page-template-modal-btn').should('be.visible');
  129. // cy.getByTestid('open-page-template-modal-btn').click();
  130. // });
  131. // cy.getByTestid('page-template-modal').should('be.visible');
  132. // cy.screenshot(`${ssPrefix}-open-page-template-bootstrap4`);
  133. // 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.
  134. // Wait for Todo: 109057 is solved and fix or leave the code below for better test code.
  135. // cy.getByTestid('template-button-children').as('template-button-children');
  136. // cy.get('@template-button-children').should('be.visible').click();
  137. // cy.waitUntilSkeletonDisappear();
  138. // cy.getByTestid('navbar-editor').should('be.visible').then(()=>{
  139. // cy.url().should('include', '/_template#edit');
  140. // cy.screenshot();
  141. // });
  142. // });
  143. // TODO: 109057
  144. // it('Access to Template Editor mode including decendants successfully', () => {
  145. // cy.visit('/Sandbox/Bootstrap4', { });
  146. // cy.waitUntilSkeletonDisappear();
  147. // cy.get('#grw-subnav-container').within(() => {
  148. // cy.getByTestid('open-page-item-control-btn').should('be.visible');
  149. // cy.getByTestid('open-page-item-control-btn').click();
  150. // cy.getByTestid('open-page-template-modal-btn').should('be.visible');
  151. // cy.getByTestid('open-page-template-modal-btn').click();
  152. // });
  153. // cy.getByTestid('page-template-modal').should('be.visible');
  154. // 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.
  155. // Wait for Todo: 109057 is solved and fix or leave the code below for better test code.
  156. // cy.getByTestid('template-button-decendants').as('template-button-decendants');
  157. // cy.get('@template-button-decendants').should('be.visible').click();
  158. // cy.waitUntilSkeletonDisappear();
  159. // cy.getByTestid('navbar-editor').should('be.visible').then(()=>{
  160. // cy.url().should('include', '/__template#edit');
  161. // cy.screenshot();
  162. // });
  163. // });
  164. });
  165. context('Access to /me/all-in-app-notifications', () => {
  166. const ssPrefix = 'in-app-notifications-';
  167. beforeEach(() => {
  168. // login
  169. cy.fixture("user-admin.json").then(user => {
  170. cy.login(user.username, user.password);
  171. });
  172. });
  173. it('All In-App Notification list is successfully loaded', { scrollBehavior: false },() => {
  174. cy.visit('/');
  175. cy.get('.notification-wrapper').click();
  176. cy.get('.notification-wrapper > .dropdown-menu > a').click();
  177. cy.getByTestid('grw-in-app-notification-page').should('be.visible');
  178. cy.getByTestid('grw-in-app-notification-page-spinner').should('not.exist');
  179. cy.collapseSidebar(true);
  180. cy.screenshot(`${ssPrefix}-see-all`);
  181. cy.get('.grw-custom-nav-tab > div > ul > li:nth-child(2) > a').click();
  182. cy.getByTestid('grw-in-app-notification-page-spinner').should('not.exist');
  183. cy.collapseSidebar(true);
  184. cy.screenshot(`${ssPrefix}-see-unread`);
  185. });
  186. })