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

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