use-tools.spec.ts 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. context('Switch Sidebar content', () => {
  2. const ssPrefix = 'switch-sidebar-content';
  3. beforeEach(() => {
  4. // login
  5. cy.fixture("user-admin.json").then(user => {
  6. cy.login(user.username, user.password);
  7. });
  8. });
  9. it('PageTree is successfully shown', () => {
  10. cy.visit('/page');
  11. cy.getByTestid('grw-sidebar-nav-primary-page-tree').click();
  12. // eslint-disable-next-line cypress/no-unnecessary-waiting
  13. cy.wait(1500);
  14. cy.screenshot(`${ssPrefix}-pagetree-after-load`, { capture: 'viewport' });
  15. });
  16. });
  17. context('Modal for page operation', () => {
  18. const ssPrefix = 'modal-for-page-operation-';
  19. beforeEach(() => {
  20. // login
  21. cy.fixture("user-admin.json").then(user => {
  22. cy.login(user.username, user.password);
  23. });
  24. cy.collapseSidebar(true);
  25. });
  26. it("PageCreateModal is shown and closed successfully", () => {
  27. cy.visit('/');
  28. cy.getByTestid('newPageBtn').click();
  29. cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  30. cy.screenshot(`${ssPrefix}new-page-modal-opened`);
  31. cy.get('button.close').click();
  32. });
  33. cy.screenshot(`${ssPrefix}page-create-modal-closed`, {capture: 'viewport'});
  34. });
  35. it("Successfully Create Today's page", () => {
  36. const pageName = 'abcdefg';
  37. cy.visit('/');
  38. cy.getByTestid('newPageBtn').click();
  39. cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  40. cy.get('.page-today-input2').type(pageName);
  41. cy.screenshot(`${ssPrefix}today-add-page-name`);
  42. cy.getByTestid('btn-create-memo').click();
  43. });
  44. cy.getByTestid('page-editor').should('be.visible').screenshot(`${ssPrefix}create-today-page`);
  45. });
  46. it('Successfully create page under specific path', () => {
  47. const pageName = 'testtest';
  48. cy.visit('/');
  49. cy.getByTestid('newPageBtn').click();
  50. cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  51. cy.get('.rbt-input-main').type(pageName);
  52. cy.screenshot(`${ssPrefix}under-path-add-page-name`);
  53. cy.getByTestid('btn-create-page-under-below').click();
  54. });
  55. cy.getByTestid('page-editor').should('be.visible').screenshot(`${ssPrefix}create-page-under-path`);
  56. });
  57. it('Successfully create a template page under the path', () => {
  58. const templatePath = 'testttttt';
  59. cy.visit('/');
  60. cy.getByTestid('newPageBtn').click();
  61. cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  62. cy.get('.rbt-input-main').type(templatePath);
  63. cy.screenshot(`${ssPrefix}create-template-for-children-add-path`);
  64. cy.get('#template-type').click();
  65. cy.get('#template-type').next().find('button:eq(0)').click({force: true});
  66. cy.get('#dd-template-type').next().find('button').click({force: true});
  67. });
  68. cy.get('.toast-error').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  69. cy.screenshot(`${ssPrefix}create-template-for-children-error`, {capture: 'viewport'});
  70. cy.get('.toast-error').should('be.visible').click();
  71. cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  72. cy.get('.rbt-input-main').clear().type('/');
  73. cy.screenshot(`${ssPrefix}create-template-for-descendants-add-path`);
  74. cy.get('#template-type').click();
  75. cy.get('#template-type').next().find('button:eq(1)').click({force: true});
  76. cy.get('#dd-template-type').next().find('button').click({force: true});
  77. });
  78. cy.get('.toast-error').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  79. cy.screenshot(`${ssPrefix}create-template-for-descendants-error`, {capture: 'viewport'});
  80. cy.get('.toast-error').should('be.visible').click();
  81. cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  82. cy.get('button.close').click();
  83. });
  84. cy.screenshot(`${ssPrefix}create-template-close-modal`, {capture: 'viewport'});
  85. });
  86. it('PageDeleteModal is shown successfully', () => {
  87. cy.visit('/Sandbox/Bootstrap4');
  88. cy.get('#grw-subnav-container').within(() => {
  89. cy.getByTestid('open-page-item-control-btn').click();
  90. cy.getByTestid('open-page-delete-modal-btn').click();
  91. });
  92. cy.getByTestid('page-delete-modal').should('be.visible').screenshot(`${ssPrefix}-delete-bootstrap4`);
  93. });
  94. it('PageDuplicateModal is shown successfully', () => {
  95. cy.visit('/Sandbox/Bootstrap4', { });
  96. cy.get('#grw-subnav-container').within(() => {
  97. cy.getByTestid('open-page-item-control-btn').click();
  98. cy.getByTestid('open-page-duplicate-modal-btn').click();
  99. });
  100. cy.getByTestid('page-duplicate-modal').should('be.visible').screenshot(`${ssPrefix}-duplicate-bootstrap4`);
  101. });
  102. it('PageMoveRenameModal is shown successfully', () => {
  103. cy.visit('/Sandbox/Bootstrap4', { });
  104. cy.get('#grw-subnav-container').within(() => {
  105. cy.getByTestid('open-page-item-control-btn').click();
  106. cy.getByTestid('open-page-move-rename-modal-btn').click();
  107. });
  108. cy.getByTestid('page-rename-modal').should('be.visible').screenshot(`${ssPrefix}-rename-bootstrap4`);
  109. });
  110. });
  111. context('Open presentation modal', () => {
  112. const ssPrefix = 'access-to-presentation-modal-';
  113. beforeEach(() => {
  114. // login
  115. cy.fixture("user-admin.json").then(user => {
  116. cy.login(user.username, user.password);
  117. });
  118. });
  119. it('PresentationModal for "/" is shown successfully', () => {
  120. cy.visit('/');
  121. cy.get('#grw-subnav-container').within(() => {
  122. cy.getByTestid('open-page-item-control-btn').click({force: true});
  123. cy.getByTestid('open-presentation-modal-btn').click({force: true});
  124. });
  125. // eslint-disable-next-line cypress/no-unnecessary-waiting
  126. cy.wait(1500);
  127. cy.screenshot(`${ssPrefix}-open-top`);
  128. });
  129. });
  130. context('Page Accessories Modal', () => {
  131. const ssPrefix = 'access-to-page-accessories-modal';
  132. beforeEach(() => {
  133. // login
  134. cy.fixture("user-admin.json").then(user => {
  135. cy.login(user.username, user.password);
  136. });
  137. });
  138. it('Page History is shown successfully', () => {
  139. cy.visit('/Sandbox/Bootstrap4', { });
  140. cy.get('#grw-subnav-container').within(() => {
  141. cy.getByTestid('open-page-item-control-btn').click();
  142. cy.getByTestid('open-page-accessories-modal-btn-with-history-tab').click();
  143. });
  144. cy.getByTestid('page-accessories-modal').should('be.visible')
  145. cy.getByTestid('page-history').should('be.visible')
  146. cy.screenshot(`${ssPrefix}-open-page-history-bootstrap4`);
  147. });
  148. it('Page Attachment Data is shown successfully', () => {
  149. cy.visit('/Sandbox/Bootstrap4', { });
  150. cy.get('#grw-subnav-container').within(() => {
  151. cy.getByTestid('open-page-item-control-btn').click();
  152. cy.getByTestid('open-page-accessories-modal-btn-with-attachment-data-tab').click();
  153. });
  154. cy.getByTestid('page-accessories-modal').should('be.visible')
  155. cy.getByTestid('page-attachment').should('be.visible')
  156. cy.screenshot(`${ssPrefix}-open-page-attachment-data-bootstrap4`);
  157. });
  158. });