use-tools.spec.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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();
  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.screenshot(`${ssPrefix}click-plus-button`, {capture: 'viewport'});
  119. cy.get('#edit-tags-btn-wrapper-for-tooltip > a').click({force: true});
  120. cy.get('#edit-tag-modal').should('be.visible');
  121. cy.screenshot(`${ssPrefix}edit-tag-input`, {capture: 'viewport'});
  122. cy.get('#edit-tag-modal').within(() => {
  123. cy.get('.rbt-input-main').type(tag, {force: true});
  124. cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  125. cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  126. cy.screenshot(`${ssPrefix}type-tag-name`, {capture: 'viewport'});
  127. });
  128. cy.get('#edit-tag-modal').within(() => {
  129. cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  130. cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  131. cy.get('a#tag-typeahead-asynctypeahead-item-0').click({force: true})
  132. cy.screenshot(`${ssPrefix}insert-tag-name`, {capture: 'viewport'});
  133. });
  134. cy.get('#edit-tag-modal').within(() => {
  135. cy.get('div.modal-footer > button').click();
  136. });
  137. cy.get('.grw-taglabels-container > form > a').contains(tag).should('exist');
  138. cy.screenshot(`${ssPrefix}click-done`, {capture: 'viewport'});
  139. });
  140. it('Successfully duplicate page by generated tag', () => {
  141. const ssPrefix = 'tag-operations-page-duplicate-';
  142. const tag = 'we';
  143. const newPageName = 'our';
  144. cy.visit('/');
  145. cy.get('.grw-taglabels-container > form > a').contains(tag).click();
  146. cy.getByTestid('search-result-base').should('be.visible');
  147. cy.getByTestid('search-result-list').should('be.visible');
  148. cy.getByTestid('search-result-content').should('be.visible');
  149. cy.screenshot(`${ssPrefix}click-tag-name`, {capture: 'viewport'});
  150. cy.getByTestid('open-page-item-control-btn').first().click();
  151. cy.screenshot(`${ssPrefix}click-three-dots-menu`, {capture: 'viewport'});
  152. cy.getByTestid('open-page-duplicate-modal-btn').first().click({force: true});
  153. cy.getByTestid('page-duplicate-modal').should('be.visible');
  154. cy.getByTestid('page-duplicate-modal').within(() => {
  155. cy.get('.rbt-input-main').type(newPageName, {force: true});
  156. });
  157. cy.screenshot(`${ssPrefix}duplicate-page`, {capture: 'viewport'});
  158. cy.getByTestid('page-duplicate-modal').within(() => {
  159. cy.get('.modal-footer > button.btn').click();
  160. });
  161. cy.visit(`/${newPageName}`);
  162. cy.get('#wiki').should('not.be.empty');
  163. cy.screenshot(`${ssPrefix}duplicated-page`, {capture: 'viewport'});
  164. });
  165. it('Successfully rename page from generated tag', () => {
  166. const ssPrefix = 'tag-operations-page-rename-';
  167. const tag = 'we';
  168. const oldPageName = '/our';
  169. const newPageName = '/ourus';
  170. cy.visit('/');
  171. cy.get('.grw-taglabels-container > form > a').contains(tag).click();
  172. cy.getByTestid('search-result-base').should('be.visible');
  173. cy.getByTestid('search-result-list').should('be.visible');
  174. cy.getByTestid('search-result-content').should('be.visible');
  175. cy.screenshot(`${ssPrefix}click-tag-name`, {capture: 'viewport'});
  176. cy.getByTestid('search-result-list').within(() => {
  177. cy.get('.list-group-item').each(($row) => {
  178. if($row.find('a').text() === oldPageName){
  179. cy.wrap($row).within(() => {
  180. cy.getByTestid('open-page-item-control-btn').click();
  181. });
  182. }
  183. });
  184. });
  185. cy.screenshot(`${ssPrefix}-click-three-dots-menu`, {capture: 'viewport'});
  186. cy.getByTestid('search-result-list').within(() => {
  187. cy.get('.list-group-item').each(($row) => {
  188. if($row.find('a').text() === oldPageName){
  189. cy.wrap($row).within(() => {
  190. cy.getByTestid('open-page-move-rename-modal-btn').click();
  191. });
  192. }
  193. });
  194. });
  195. cy.getByTestid('page-rename-modal').should('be.visible').within(() => {
  196. cy.get('.rbt-input-main').clear({force: true})
  197. cy.get('.rbt-input-main').click().focused().type(newPageName, {force: true})
  198. .should('have.value', newPageName);
  199. });
  200. cy.screenshot(`${ssPrefix}insert-new-page-name`, {capture: 'viewport'});
  201. cy.getByTestid('page-rename-modal').should('be.visible').within(() => {
  202. cy.get('.modal-footer > button').click();
  203. });
  204. cy.visit(`/${newPageName}`);
  205. cy.screenshot(`${ssPrefix}new-page-name-applied`, {capture: 'viewport'});
  206. });
  207. it('Successfully order pages with tag', () => {
  208. const ssPrefix = 'tag-operations-tag-order-';
  209. const tag = 'we';
  210. cy.visit('/');
  211. cy.get('.grw-taglabels-container > form > a').contains(tag).click();
  212. cy.getByTestid('search-result-base').should('be.visible');
  213. cy.getByTestid('search-result-list').should('be.visible');
  214. cy.getByTestid('search-result-content').should('be.visible');
  215. cy.screenshot(`${ssPrefix}click-tag-name`, {capture: 'viewport'});
  216. cy.get('.grw-search-page-nav').within(() => {
  217. cy.get('button.dropdown-toggle').first().click({force: true});
  218. cy.get('.dropdown-menu-right').should('be.visible');
  219. cy.get('.dropdown-menu-right > button:nth-child(1)').click({force: true});
  220. });
  221. cy.getByTestid('search-result-base').should('be.visible');
  222. cy.getByTestid('search-result-list').should('be.visible');
  223. cy.getByTestid('search-result-content').should('be.visible');
  224. cy.screenshot(`${ssPrefix}by-relevance`);
  225. cy.get('.grw-search-page-nav').within(() => {
  226. cy.get('button.dropdown-toggle').first().click({force: true});
  227. cy.get('.dropdown-menu-right').should('be.visible');
  228. cy.get('.dropdown-menu-right > button:nth-child(2)').click({force: true});
  229. });
  230. cy.getByTestid('search-result-base').should('be.visible');
  231. cy.getByTestid('search-result-list').should('be.visible');
  232. cy.getByTestid('search-result-content').should('be.visible');
  233. cy.screenshot(`${ssPrefix}by-creation-date`);
  234. cy.get('.grw-search-page-nav').within(() => {
  235. cy.get('button.dropdown-toggle').first().click({force: true});
  236. cy.get('.dropdown-menu-right').should('be.visible');
  237. cy.get('.dropdown-menu-right > button:nth-child(3)').click({force: true});
  238. });
  239. cy.getByTestid('search-result-base').should('be.visible');
  240. cy.getByTestid('search-result-list').should('be.visible');
  241. cy.getByTestid('search-result-content').should('be.visible');
  242. cy.screenshot(`${ssPrefix}by-last-update-date`);
  243. });
  244. });