use-tools.spec.ts 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. // });
  25. // it("PageCreateModal is shown successfully", () => {
  26. // cy.visit('/me');
  27. // cy.getByTestid('newPageBtn').click();
  28. // cy.getByTestid('page-create-modal').should('be.visible').screenshot(`${ssPrefix}-open`);
  29. // cy.getByTestid('row-create-page-under-below').find('input.form-control').clear().type('/new-page');
  30. // cy.getByTestid('btn-create-page-under-below').click();
  31. // cy.getByTestid('page-editor').should('be.visible');
  32. // cy.screenshot(`${ssPrefix}-create-clicked`, {capture: 'viewport'});
  33. // });
  34. // it('PageDeleteModal is shown successfully', () => {
  35. // cy.visit('/Sandbox/Bootstrap4');
  36. // cy.get('#grw-subnav-container').within(() => {
  37. // cy.getByTestid('open-page-item-control-btn').click();
  38. // cy.getByTestid('open-page-delete-modal-btn').click();
  39. // });
  40. // cy.getByTestid('page-delete-modal').should('be.visible').screenshot(`${ssPrefix}-delete-bootstrap4`);
  41. // });
  42. // it('PageDuplicateModal is shown successfully', () => {
  43. // cy.visit('/Sandbox/Bootstrap4', { });
  44. // cy.get('#grw-subnav-container').within(() => {
  45. // cy.getByTestid('open-page-item-control-btn').click();
  46. // cy.getByTestid('open-page-duplicate-modal-btn').click();
  47. // });
  48. // cy.getByTestid('page-duplicate-modal').should('be.visible').screenshot(`${ssPrefix}-duplicate-bootstrap4`);
  49. // });
  50. // it('PageMoveRenameModal is shown successfully', () => {
  51. // cy.visit('/Sandbox/Bootstrap4', { });
  52. // cy.get('#grw-subnav-container').within(() => {
  53. // cy.getByTestid('open-page-item-control-btn').click();
  54. // cy.getByTestid('open-page-move-rename-modal-btn').click({force: true});
  55. // });
  56. // cy.getByTestid('page-rename-modal').should('be.visible').screenshot(`${ssPrefix}-rename-bootstrap4`);
  57. // });
  58. // });
  59. // context('Open presentation modal', () => {
  60. // const ssPrefix = 'access-to-presentation-modal-';
  61. // beforeEach(() => {
  62. // // login
  63. // cy.fixture("user-admin.json").then(user => {
  64. // cy.login(user.username, user.password);
  65. // });
  66. // });
  67. // it('PresentationModal for "/" is shown successfully', () => {
  68. // cy.visit('/');
  69. // cy.get('#grw-subnav-container').within(() => {
  70. // cy.getByTestid('open-page-item-control-btn').click({force: true});
  71. // cy.getByTestid('open-presentation-modal-btn').click({force: true});
  72. // });
  73. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  74. // cy.wait(1500);
  75. // cy.screenshot(`${ssPrefix}-open-top`);
  76. // });
  77. // });
  78. // context('Page Accessories Modal', () => {
  79. // const ssPrefix = 'access-to-page-accessories-modal';
  80. // beforeEach(() => {
  81. // // login
  82. // cy.fixture("user-admin.json").then(user => {
  83. // cy.login(user.username, user.password);
  84. // });
  85. // });
  86. // it('Page History 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-accessories-modal-btn-with-history-tab').click();
  91. // });
  92. // cy.getByTestid('page-accessories-modal').should('be.visible')
  93. // cy.getByTestid('page-history').should('be.visible')
  94. // cy.screenshot(`${ssPrefix}-open-page-history-bootstrap4`);
  95. // });
  96. // it('Page Attachment Data is shown successfully', () => {
  97. // cy.visit('/Sandbox/Bootstrap4', { });
  98. // cy.get('#grw-subnav-container').within(() => {
  99. // cy.getByTestid('open-page-item-control-btn').click();
  100. // cy.getByTestid('open-page-accessories-modal-btn-with-attachment-data-tab').click();
  101. // });
  102. // cy.getByTestid('page-accessories-modal').should('be.visible')
  103. // cy.getByTestid('page-attachment').should('be.visible')
  104. // cy.screenshot(`${ssPrefix}-open-page-attachment-data-bootstrap4`);
  105. // });
  106. // });
  107. context('Tag Oprations', () =>{
  108. beforeEach(() => {
  109. // login
  110. cy.fixture("user-admin.json").then(user => {
  111. cy.login(user.username, user.password);
  112. });
  113. });
  114. it('Successfully add new tag', () => {
  115. const ssPrefix = 'tag-operations-add-new-tag-'
  116. const tag = 'we';
  117. cy.visit('/');
  118. cy.get('#edit-tags-btn-wrapper-for-tooltip > a').click({force: true});
  119. cy.get('#edit-tag-modal').should('be.visible').screenshot(`${ssPrefix}1-edit-tag-input`);
  120. cy.get('#edit-tag-modal').within(() => {
  121. cy.get('.rbt-input-main').type(tag, {force: true});
  122. cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  123. cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  124. cy.screenshot(`${ssPrefix}2-type-tag-name`);
  125. });
  126. cy.get('#edit-tag-modal').within(() => {
  127. cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  128. cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  129. cy.get('a#tag-typeahead-asynctypeahead-item-0').click({force: true})
  130. cy.screenshot(`${ssPrefix}3-insert-tag-name`, {capture: 'viewport'});
  131. });
  132. cy.get('#edit-tag-modal').within(() => {
  133. cy.get('div.modal-footer > button').click();
  134. });
  135. cy.get('.grw-taglabels-container > form > a').contains(tag).should('exist');
  136. cy.screenshot(`${ssPrefix}4-click-done`, {capture: 'viewport'});
  137. });
  138. it('Successfully duplicate page by generated tag', () => {
  139. const ssPrefix = 'tag-operations-page-duplicate-';
  140. const tag = 'we';
  141. const newPageName = 'our';
  142. cy.visit('/');
  143. cy.get('.grw-taglabels-container > form > a').contains(tag).click();
  144. cy.getByTestid('search-result-base').should('be.visible');
  145. cy.getByTestid('search-result-list').should('be.visible');
  146. cy.getByTestid('search-result-content').should('be.visible');
  147. cy.screenshot(`${ssPrefix}1-click-tag-name`, {capture: 'viewport'});
  148. cy.getByTestid('open-page-item-control-btn').first().click({force: true});
  149. cy.screenshot(`${ssPrefix}2-click-three-dots-menu`, {capture: 'viewport'});
  150. cy.getByTestid('open-page-duplicate-modal-btn').first().click({force: true});
  151. cy.getByTestid('page-duplicate-modal').should('be.visible');
  152. cy.getByTestid('page-duplicate-modal').within(() => {
  153. cy.get('.rbt-input-main').type(newPageName, {force: true});
  154. }).screenshot(`${ssPrefix}3-duplicate-page`, {capture: 'viewport'});
  155. cy.getByTestid('page-duplicate-modal').within(() => {
  156. cy.get('.modal-footer > button.btn').click();
  157. });
  158. cy.visit(`/${newPageName}`);
  159. cy.get('#wiki').should('not.be.empty');
  160. cy.screenshot(`${ssPrefix}4-duplicated-page`, {capture: 'viewport'});
  161. });
  162. it('Successfully rename page from generated tag', () => {
  163. const ssPrefix = 'tag-operations-page-rename-';
  164. const tag = 'we';
  165. const oldPageName = '/our';
  166. const newPageName = '/ourus';
  167. cy.visit('/');
  168. cy.get('.grw-taglabels-container > form > a').contains(tag).click();
  169. cy.getByTestid('search-result-base').should('be.visible');
  170. cy.getByTestid('search-result-list').should('be.visible');
  171. cy.getByTestid('search-result-content').should('be.visible');
  172. cy.screenshot(`${ssPrefix}1-click-tag-name`, {capture: 'viewport'});
  173. cy.getByTestid('search-result-list').within(() => {
  174. cy.get('.list-group-item').each(($row) => {
  175. if($row.find('a').text() === oldPageName){
  176. cy.wrap($row).within(() => {
  177. cy.getByTestid('open-page-item-control-btn').click();
  178. });
  179. }
  180. });
  181. });
  182. cy.screenshot(`${ssPrefix}2-click-three-dots-menu`, {capture: 'viewport'});
  183. cy.getByTestid('search-result-list').within(() => {
  184. cy.get('.list-group-item').each(($row) => {
  185. if($row.find('a').text() === oldPageName){
  186. cy.wrap($row).within(() => {
  187. cy.getByTestid('open-page-move-rename-modal-btn').click();
  188. });
  189. }
  190. });
  191. });
  192. cy.getByTestid('page-rename-modal').should('be.visible').within(() => {
  193. cy.get('.rbt-input-main').clear().type(newPageName,{force: true});
  194. }).screenshot(`${ssPrefix}3-insert-new-page-name`);
  195. cy.getByTestid('page-rename-modal').should('be.visible').within(() => {
  196. cy.get('.modal-footer > button').click();
  197. });
  198. cy.visit(`/${newPageName}`);
  199. cy.screenshot(`${ssPrefix}4-new-page-name-applied`, {capture: 'viewport'});
  200. });
  201. });