20-basic-features--use-tools.spec.ts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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.collapseSidebar(false);
  11. // cy.visit('/page');
  12. // cy.waitUntilSkeletonDisappear();
  13. // cy.getByTestid('grw-sidebar-nav-primary-page-tree').click();
  14. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  15. // cy.wait(1500);
  16. // cy.screenshot(`${ssPrefix}-pagetree-after-load`);
  17. // });
  18. // });
  19. context('Modal for page operation', () => {
  20. const ssPrefix = 'modal-for-page-operation-';
  21. beforeEach(() => {
  22. // login
  23. cy.fixture("user-admin.json").then(user => {
  24. cy.login(user.username, user.password);
  25. });
  26. cy.collapseSidebar(true);
  27. });
  28. // it("PageCreateModal is shown and closed successfully", () => {
  29. // cy.visit('/');
  30. // cy.waitUntilSkeletonDisappear();
  31. // cy.getByTestid('newPageBtn').click();
  32. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  33. // cy.wait(500) // Wait for animation to finish when the Create Page button is pressed
  34. // cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  35. // cy.screenshot(`${ssPrefix}new-page-modal-opened`);
  36. // cy.get('button.close').click();
  37. // });
  38. // cy.screenshot(`${ssPrefix}page-create-modal-closed`);
  39. // });
  40. // it("Successfully Create Today's page", () => {
  41. // const pageName = "Today's page";
  42. // cy.visit('/');
  43. // cy.waitUntilSkeletonDisappear();
  44. // cy.getByTestid('newPageBtn').click();
  45. // cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  46. // cy.get('.page-today-input2').type(pageName);
  47. // cy.screenshot(`${ssPrefix}today-add-page-name`);
  48. // cy.getByTestid('btn-create-memo').click();
  49. // });
  50. // cy.getByTestid('page-editor').should('be.visible');
  51. // cy.getByTestid('save-page-btn').click();
  52. // cy.get('.layout-root').should('not.have.class', 'editing');
  53. // cy.getByTestid('grw-contextual-sub-nav').should('be.visible');
  54. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  55. // cy.wait(300);
  56. // // Do not use "cy.waitUntilSkeletonDisappear()"
  57. // cy.get('.grw-skeleton').should('not.exist');
  58. // cy.screenshot(`${ssPrefix}create-today-page`);
  59. // });
  60. // it('Successfully create page under specific path', () => {
  61. // const pageName = 'child';
  62. // cy.visit('/Sandbox');
  63. // cy.waitUntilSkeletonDisappear();
  64. // cy.getByTestid('newPageBtn').click();
  65. // cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  66. // cy.get('.rbt-input-main').should('have.value', '/Sandbox/');
  67. // cy.get('.rbt-input-main').type(pageName);
  68. // cy.screenshot(`${ssPrefix}under-path-add-page-name`);
  69. // cy.getByTestid('btn-create-page-under-below').click();
  70. // });
  71. // cy.getByTestid('page-editor').should('be.visible');
  72. // cy.getByTestid('save-page-btn').click();
  73. // cy.get('.layout-root').should('not.have.class', 'editing');
  74. // cy.getByTestid('grw-contextual-sub-nav').should('be.visible');
  75. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  76. // cy.wait(300);
  77. // // Do not use "cy.waitUntilSkeletonDisappear()"
  78. // cy.get('.grw-skeleton').should('not.exist');
  79. // cy.screenshot(`${ssPrefix}create-page-under-specific-page`);
  80. // });
  81. // it('Trying to create template page under the root page fail', () => {
  82. // cy.visit('/');
  83. // cy.waitUntilSkeletonDisappear();
  84. // cy.getByTestid('newPageBtn').click();
  85. // cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  86. // cy.getByTestid('grw-page-create-modal-path-name').should('have.text', '/');
  87. // cy.get('#template-type').click();
  88. // cy.get('#template-type').next().find('button:eq(0)').click({force: true});
  89. // cy.getByTestid('grw-btn-edit-page').should('be.visible').click();
  90. // });
  91. // cy.get('.toast-error').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  92. // cy.screenshot(`${ssPrefix}create-template-for-children-error`);
  93. // cy.get('.toast-error').should('be.visible').click();
  94. // cy.get('.toast-error').should('not.exist');
  95. // cy.getByTestid('page-create-modal').should('be.visible').within(() => {
  96. // cy.get('#template-type').click();
  97. // cy.get('#template-type').next().find('button:eq(1)').click({force: true});
  98. // cy.getByTestid('grw-btn-edit-page').should('be.visible').click();
  99. // });
  100. // cy.get('.toast-error').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  101. // cy.screenshot(`${ssPrefix}create-template-for-descendants-error`);
  102. // });
  103. it('Page Deletion and PutBack is executed successfully', () => {
  104. cy.visit('/Sandbox/Bootstrap4');
  105. cy.waitUntilSkeletonDisappear();
  106. cy.get('#grw-subnav-container').within(() => {
  107. cy.getByTestid('open-page-item-control-btn').click({force: true});
  108. cy.getByTestid('open-page-delete-modal-btn').click({force: true});
  109. });
  110. cy.getByTestid('page-delete-modal').should('be.visible').within(() => {
  111. cy.screenshot(`${ssPrefix}-delete-modal`);
  112. cy.getByTestid('delete-page-button').click();
  113. });
  114. cy.getByTestid('trash-page-alert').should('be.visible');
  115. cy.screenshot(`${ssPrefix}-bootstrap4-is-in-garbage-box`)
  116. });
  117. // it('PageDuplicateModal is shown successfully', () => {
  118. // cy.visit('/Sandbox/Bootstrap4');
  119. // cy.waitUntilSkeletonDisappear();
  120. // cy.get('#grw-subnav-container').within(() => {
  121. // cy.getByTestid('open-page-item-control-btn').click({force: true});
  122. // cy.getByTestid('open-page-duplicate-modal-btn').click({force: true});
  123. // });
  124. // cy.getByTestid('page-duplicate-modal').should('be.visible').screenshot(`${ssPrefix}-duplicate-bootstrap4`);
  125. // });
  126. // it('PageMoveRenameModal is shown successfully', () => {
  127. // cy.visit('/Sandbox/Bootstrap4');
  128. // cy.waitUntilSkeletonDisappear();
  129. // cy.get('#grw-subnav-container').within(() => {
  130. // cy.getByTestid('open-page-item-control-btn').click({force: true});
  131. // cy.getByTestid('open-page-move-rename-modal-btn').click({force: true});
  132. // });
  133. // cy.getByTestid('grw-page-rename-button').should('be.disabled');
  134. // cy.getByTestid('page-rename-modal').should('be.visible').screenshot(`${ssPrefix}-rename-bootstrap4`);
  135. // });
  136. });
  137. // TODO: Uncomment after https://redmine.weseek.co.jp/issues/103121 is resolved
  138. // context('Open presentation modal', () => {
  139. // const ssPrefix = 'access-to-presentation-modal-';
  140. // beforeEach(() => {
  141. // // login
  142. // cy.fixture("user-admin.json").then(user => {
  143. // cy.login(user.username, user.password);
  144. // });
  145. // cy.collapseSidebar(true);
  146. // });
  147. // it('PresentationModal for "/" is shown successfully', () => {
  148. // cy.visit('/');
  149. // cy.get('#grw-subnav-container').within(() => {
  150. // cy.getByTestid('open-page-item-control-btn').click({force: true});
  151. // cy.getByTestid('open-presentation-modal-btn').click({force: true});
  152. // });
  153. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  154. // cy.wait(1500);
  155. // cy.screenshot(`${ssPrefix}-open-top`);
  156. // });
  157. // });
  158. // context('Page Accessories Modal', () => {
  159. // const ssPrefix = 'access-to-page-accessories-modal';
  160. // beforeEach(() => {
  161. // // login
  162. // cy.fixture("user-admin.json").then(user => {
  163. // cy.login(user.username, user.password);
  164. // });
  165. // cy.collapseSidebar(true);
  166. // });
  167. // it('Page History is shown successfully', () => {
  168. // cy.visit('/Sandbox/Bootstrap4');
  169. // cy.waitUntilSkeletonDisappear();
  170. // cy.get('#grw-subnav-container').within(() => {
  171. // cy.getByTestid('open-page-item-control-btn').within(() => {
  172. // cy.get('button.btn-page-item-control').click({force: true});
  173. // });
  174. // cy.getByTestid('open-page-accessories-modal-btn-with-history-tab').click({force: true});
  175. // });
  176. // cy.getByTestid('page-history').should('be.visible')
  177. // cy.screenshot(`${ssPrefix}-open-page-history-bootstrap4`);
  178. // });
  179. // it('Page Attachment Data is shown successfully', () => {
  180. // cy.visit('/Sandbox/Bootstrap4');
  181. // cy.waitUntilSkeletonDisappear();
  182. // cy.get('#grw-subnav-container').within(() => {
  183. // cy.getByTestid('open-page-item-control-btn').within(() => {
  184. // cy.get('button.btn-page-item-control').click({force: true});
  185. // });
  186. // cy.getByTestid('open-page-accessories-modal-btn-with-attachment-data-tab').click({force: true});
  187. // });
  188. // cy.getByTestid('page-attachment').should('be.visible').contains('No attachments yet.');
  189. // cy.screenshot(`${ssPrefix}-open-page-attachment-data-bootstrap4`);
  190. // });
  191. // it('Share Link Management is shown successfully', () => {
  192. // cy.visit('/Sandbox/Bootstrap4');
  193. // cy.waitUntilSkeletonDisappear();
  194. // cy.get('#grw-subnav-container').within(() => {
  195. // cy.getByTestid('open-page-item-control-btn').within(() => {
  196. // cy.get('button.btn-page-item-control').click({force: true});
  197. // });
  198. // cy.getByTestid('open-page-accessories-modal-btn-with-share-link-management-data-tab').should('be.visible');
  199. // cy.getByTestid('open-page-accessories-modal-btn-with-share-link-management-data-tab').click();
  200. // });
  201. // cy.getByTestid('page-accessories-modal').should('be.visible');
  202. // cy.getByTestid('share-link-management').should('be.visible');
  203. // cy.screenshot(`${ssPrefix}-open-share-link-management-bootstrap4`);
  204. // });
  205. // });
  206. // context('Tag Oprations', { scrollBehavior: false }, () =>{
  207. // beforeEach(() => {
  208. // // login
  209. // cy.fixture("user-admin.json").then(user => {
  210. // cy.login(user.username, user.password);
  211. // });
  212. // cy.collapseSidebar(true);
  213. // });
  214. // it('Successfully add new tag', () => {
  215. // const ssPrefix = 'tag-operations-add-new-tag-'
  216. // const tag = 'we';
  217. // cy.visit('/Sandbox');
  218. // cy.waitUntilSkeletonDisappear();
  219. // cy.get('#edit-tags-btn-wrapper-for-tooltip > a').should('be.visible');
  220. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  221. // cy.wait(200);
  222. // cy.get('#edit-tags-btn-wrapper-for-tooltip > a').click();
  223. // cy.get('#edit-tag-modal').should('be.visible').screenshot(`${ssPrefix}1-edit-tag-input`);
  224. // cy.get('#edit-tag-modal').within(() => {
  225. // cy.get('.rbt-input-main').type(tag, {force: true});
  226. // cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  227. // cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  228. // cy.screenshot(`${ssPrefix}2-type-tag-name`);
  229. // });
  230. // cy.get('#edit-tag-modal').within(() => {
  231. // cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  232. // cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  233. // cy.get('a#tag-typeahead-asynctypeahead-item-0').click({force: true})
  234. // cy.screenshot(`${ssPrefix}3-insert-tag-name`);
  235. // });
  236. // cy.get('#edit-tag-modal').within(() => {
  237. // cy.get('div.modal-footer > button').click();
  238. // });
  239. // cy.get('.toast').should('be.visible').trigger('mouseover');
  240. // cy.get('.grw-taglabels-container > .grw-tag-labels > a').contains(tag).should('exist');
  241. // /* eslint-disable cypress/no-unnecessary-waiting */
  242. // cy.wait(150); // wait for toastr to change its color occured by mouseover
  243. // cy.screenshot(`${ssPrefix}4-click-done`);
  244. // });
  245. // it('Successfully duplicate page by generated tag', () => {
  246. // const ssPrefix = 'tag-operations-page-duplicate-';
  247. // const tag = 'we';
  248. // const newPageName = 'our';
  249. // cy.visit('/Sandbox');
  250. // cy.waitUntilSkeletonDisappear();
  251. // cy.get('.grw-tag-label').should('be.visible').contains(tag).click();
  252. // // Search result page
  253. // cy.getByTestid('search-result-base').should('be.visible');
  254. // cy.getByTestid('search-result-list').should('be.visible');
  255. // cy.getByTestid('search-result-content', { timeout: 60000 }).should('be.visible');
  256. // cy.get('#revision-loader', { timeout: 60000 }).contains('Table of Contents', { timeout: 60000 });
  257. // // force to add 'active' to pass VRT: https://github.com/weseek/growi/pull/6603
  258. // cy.getByTestid('page-list-item-L').first().invoke('addClass', 'active');
  259. // cy.screenshot(`${ssPrefix}1-click-tag-name`);
  260. // cy.getByTestid('search-result-list').should('be.visible').then(($el)=>{
  261. // cy.wrap($el).within(()=>{
  262. // cy.getByTestid('open-page-item-control-btn').first().click();
  263. // });
  264. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  265. // cy.wait(1500); // for wait rendering pagelist info
  266. // cy.screenshot(`${ssPrefix}2-click-three-dots-menu`);
  267. // cy.wrap($el).within(()=>{
  268. // cy.getByTestid('open-page-item-control-btn').first().within(()=>{
  269. // cy.getByTestid('open-page-duplicate-modal-btn').click();
  270. // })
  271. // });
  272. // })
  273. // cy.getByTestid('page-duplicate-modal').should('be.visible').within(() => {
  274. // cy.get('.rbt-input-main').type(`-${newPageName}`, {force: true});
  275. // }).screenshot(`${ssPrefix}3-duplicate-page`);
  276. // cy.getByTestid('page-duplicate-modal').within(() => {
  277. // cy.intercept('POST', '/_api/v3/pages/duplicate').as('duplicate');
  278. // cy.get('.modal-footer > button.btn').click();
  279. // // Wait for completion of request to '/_api/v3/pages/duplicate'
  280. // cy.wait('@duplicate')
  281. // });
  282. // cy.visit(`Sandbox-${newPageName}`);
  283. // cy.waitUntilSkeletonDisappear();
  284. // cy.screenshot(`${ssPrefix}4-duplicated-page`);
  285. // });
  286. // it('Successfully rename page from generated tag', () => {
  287. // const ssPrefix = 'tag-operations-page-rename-';
  288. // const tag = 'we';
  289. // const oldPageName = '/Sandbox-our';
  290. // const newPageName = '/Sandbox-us';
  291. // cy.visit(oldPageName);
  292. // cy.waitUntilSkeletonDisappear();
  293. // cy.get('.grw-tag-label').should('be.visible').contains(tag).click();
  294. // // Search result page
  295. // cy.getByTestid('search-result-base').should('be.visible');
  296. // cy.getByTestid('search-result-list').should('be.visible');
  297. // cy.getByTestid('search-result-content', { timeout: 60000 }).should('be.visible');
  298. // cy.get('#revision-loader', { timeout: 60000 }).contains('Table of Contents', { timeout: 60000 });
  299. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  300. // cy.wait(300);
  301. // cy.screenshot(`${ssPrefix}1-click-tag-name`);
  302. // cy.getByTestid('search-result-list').within(() => {
  303. // cy.get('.list-group-item').each(($row) => {
  304. // if($row.find('a').text() === oldPageName){
  305. // cy.wrap($row).within(() => {
  306. // cy.getByTestid('open-page-item-control-btn').first().click();
  307. // cy.getByTestid('page-item-control-menu').should('have.class', 'show').then(() => {
  308. // // empty sentence in page list empty: https://github.com/weseek/growi/pull/6880
  309. // cy.getByTestid('revision-short-body-in-page-list-item-L').invoke('text', '');
  310. // });
  311. // cy.getByTestid('page-item-control-menu').within(()=>{
  312. // cy.getByTestid('open-page-delete-modal-btn');
  313. // cy.screenshot(`${ssPrefix}2-open-page-item-control-menu`);
  314. // })
  315. // });
  316. // }
  317. // });
  318. // });
  319. // cy.getByTestid('search-result-list').within(() => {
  320. // cy.get('.list-group-item').each(($row) => {
  321. // if($row.find('a').text() === oldPageName){
  322. // cy.wrap($row).within(() => {
  323. // cy.getByTestid('open-page-move-rename-modal-btn').click({force: true});
  324. // });
  325. // }
  326. // });
  327. // });
  328. // cy.getByTestid('page-rename-modal').should('be.visible').within(() => {
  329. // cy.get('.rbt-input-main').clear().type(newPageName,{force: true});
  330. // }).screenshot(`${ssPrefix}3-insert-new-page-name`);
  331. // cy.getByTestid('page-rename-modal').should('be.visible').within(() => {
  332. // cy.intercept('PUT', '/_api/v3/pages/rename').as('rename');
  333. // cy.getByTestid('grw-page-rename-button').should('not.be.disabled').click();
  334. // // Wait for completion of request to '/_api/v3/pages/rename'
  335. // cy.wait('@rename')
  336. // });
  337. // cy.visit(newPageName);
  338. // cy.waitUntilSkeletonDisappear();
  339. // cy.getByTestid('grw-tag-labels').should('be.visible')
  340. // cy.screenshot(`${ssPrefix}4-new-page-name-applied`);
  341. // });
  342. // });
  343. // context('Shortcuts', () => {
  344. // const ssPrefix = 'shortcuts';
  345. // beforeEach(() => {
  346. // // login
  347. // cy.fixture("user-admin.json").then(user => {
  348. // cy.login(user.username, user.password);
  349. // });
  350. // });
  351. // it('Successfully updating a page using a shortcut on a previously created page', () => {
  352. // const body1 = 'hello';
  353. // const body2 = 'world';
  354. // const savePageShortcutKey = '{ctrl+s}'
  355. // cy.visit('/Sandbox/child');
  356. // cy.waitUntilSkeletonDisappear();
  357. // cy.get('#grw-subnav-container').within(() => {
  358. // cy.getByTestid('editor-button').should('be.visible').click();
  359. // })
  360. // cy.get('.layout-root').should('have.class', 'editing');
  361. // cy.get('.grw-editor-navbar-bottom').should('be.visible');
  362. // // 1st
  363. // cy.get('.CodeMirror').type(body1);
  364. // cy.get('.CodeMirror').contains(body1);
  365. // cy.get('.page-editor-preview-body').contains(body1);
  366. // cy.get('.CodeMirror').type(savePageShortcutKey);
  367. // cy.get('.toast').should('be.visible').trigger('mouseover');
  368. // cy.screenshot(`${ssPrefix}-update-page-1`);
  369. // cy.get('.toast-close-button').click();
  370. // cy.get('.toast').should('not.exist');
  371. // // 2nd
  372. // cy.get('.CodeMirror').type(body2);
  373. // cy.get('.CodeMirror').contains(body2);
  374. // cy.get('.page-editor-preview-body').contains(body2);
  375. // cy.get('.CodeMirror').type(savePageShortcutKey);
  376. // cy.get('.toast').should('be.visible').trigger('mouseover');
  377. // cy.screenshot(`${ssPrefix}-update-page-2`);
  378. // });
  379. // });