use-tools.spec.ts 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. it('Share Link Management is shown successfully', () => {
  107. cy.visit('/Sandbox/Bootstrap4', { });
  108. cy.get('#grw-subnav-container').within(() => {
  109. cy.getByTestid('open-page-item-control-btn').click();
  110. cy.getByTestid('open-page-accessories-modal-btn-with-share-link-management-data-tab').click();
  111. });
  112. cy.getByTestid('page-accessories-modal').should('be.visible');
  113. cy.getByTestid('share-link-management').should('be.visible');
  114. cy.screenshot(`${ssPrefix}-open-share-link-management-bootstrap4`);
  115. });
  116. });
  117. context('Tag Oprations', () =>{
  118. beforeEach(() => {
  119. // login
  120. cy.fixture("user-admin.json").then(user => {
  121. cy.login(user.username, user.password);
  122. });
  123. });
  124. it('Successfully add new tag', () => {
  125. const ssPrefix = 'tag-operations-add-new-tag-'
  126. const tag = 'we';
  127. cy.visit('/');
  128. cy.get('#edit-tags-btn-wrapper-for-tooltip > a').click({force: true});
  129. cy.get('#edit-tag-modal').should('be.visible').screenshot(`${ssPrefix}1-edit-tag-input`);
  130. cy.get('#edit-tag-modal').within(() => {
  131. cy.get('.rbt-input-main').type(tag, {force: true});
  132. cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  133. cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  134. cy.screenshot(`${ssPrefix}2-type-tag-name`);
  135. });
  136. cy.get('#edit-tag-modal').within(() => {
  137. cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  138. cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  139. cy.get('a#tag-typeahead-asynctypeahead-item-0').click({force: true})
  140. cy.screenshot(`${ssPrefix}3-insert-tag-name`, {capture: 'viewport'});
  141. });
  142. cy.get('#edit-tag-modal').within(() => {
  143. cy.get('div.modal-footer > button').click();
  144. });
  145. cy.get('.grw-taglabels-container > form > a').contains(tag).should('exist');
  146. cy.screenshot(`${ssPrefix}4-click-done`, {capture: 'viewport'});
  147. });
  148. it('Successfully duplicate page by generated tag', () => {
  149. const ssPrefix = 'tag-operations-page-duplicate-';
  150. const tag = 'we';
  151. const newPageName = 'our';
  152. cy.visit('/');
  153. cy.get('.grw-taglabels-container > form > a').contains(tag).click();
  154. cy.getByTestid('search-result-base').should('be.visible');
  155. cy.getByTestid('search-result-list').should('be.visible');
  156. cy.getByTestid('search-result-content').should('be.visible');
  157. cy.screenshot(`${ssPrefix}1-click-tag-name`, {capture: 'viewport'});
  158. cy.getByTestid('open-page-item-control-btn').first().click({force: true});
  159. cy.screenshot(`${ssPrefix}2-click-three-dots-menu`, {capture: 'viewport'});
  160. cy.getByTestid('open-page-duplicate-modal-btn').first().click({force: true});
  161. cy.getByTestid('page-duplicate-modal').should('be.visible');
  162. cy.getByTestid('page-duplicate-modal').within(() => {
  163. cy.get('.rbt-input-main').type(newPageName, {force: true});
  164. }).screenshot(`${ssPrefix}3-duplicate-page`, {capture: 'viewport'});
  165. cy.getByTestid('page-duplicate-modal').within(() => {
  166. cy.get('.modal-footer > button.btn').click();
  167. });
  168. cy.visit(`/${newPageName}`);
  169. cy.getByTestid('wiki').should('exist');
  170. cy.screenshot(`${ssPrefix}4-duplicated-page`, {capture: 'viewport'});
  171. });
  172. it('Successfully rename page from generated tag', () => {
  173. const ssPrefix = 'tag-operations-page-rename-';
  174. const tag = 'we';
  175. const oldPageName = '/our';
  176. const newPageName = '/ourus';
  177. cy.visit('/');
  178. cy.get('.grw-taglabels-container > form > a').contains(tag).click();
  179. cy.getByTestid('search-result-base').should('be.visible');
  180. cy.getByTestid('search-result-list').should('be.visible');
  181. cy.getByTestid('search-result-content').should('be.visible');
  182. cy.screenshot(`${ssPrefix}1-click-tag-name`, {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-item-control-btn').click();
  188. });
  189. }
  190. });
  191. });
  192. cy.screenshot(`${ssPrefix}2-click-three-dots-menu`, {capture: 'viewport'});
  193. cy.getByTestid('search-result-list').within(() => {
  194. cy.get('.list-group-item').each(($row) => {
  195. if($row.find('a').text() === oldPageName){
  196. cy.wrap($row).within(() => {
  197. cy.getByTestid('open-page-move-rename-modal-btn').click();
  198. });
  199. }
  200. });
  201. });
  202. cy.getByTestid('page-rename-modal').should('be.visible').within(() => {
  203. cy.get('.rbt-input-main').clear().type(newPageName,{force: true});
  204. }).screenshot(`${ssPrefix}3-insert-new-page-name`);
  205. cy.getByTestid('page-rename-modal').should('be.visible').within(() => {
  206. cy.get('.modal-footer > button').click();
  207. });
  208. cy.visit(`/${newPageName}`);
  209. cy.screenshot(`${ssPrefix}4-new-page-name-applied`, {capture: 'viewport'});
  210. });
  211. });