20-basic-features--use-tools.cy.ts 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. context('Modal for page operation', () => {
  2. const ssPrefix = 'modal-for-page-operation-';
  3. beforeEach(() => {
  4. // login
  5. cy.fixture("user-admin.json").then(user => {
  6. cy.login(user.username, user.password);
  7. });
  8. });
  9. it('Page Deletion and PutBack is executed successfully', { scrollBehavior: false }, () => {
  10. cy.visit('/Sandbox/Bootstrap5');
  11. cy.waitUntil(() => {
  12. // do
  13. cy.getByTestid('grw-contextual-sub-nav').within(() => {
  14. cy.getByTestid('open-page-item-control-btn').find('button').click({force: true});
  15. });
  16. //wait until
  17. return cy.getByTestid('page-item-control-menu').then($elem => $elem.is(':visible'))
  18. });
  19. cy.getByTestid('open-page-delete-modal-btn').filter(':visible').click({force: true});
  20. cy.getByTestid('page-delete-modal').should('be.visible').within(() => {
  21. cy.screenshot(`${ssPrefix}-delete-modal`);
  22. cy.getByTestid('delete-page-button').click();
  23. });
  24. cy.getByTestid('trash-page-alert').should('be.visible');
  25. cy.collapseSidebar(true);
  26. cy.screenshot(`${ssPrefix}-bootstrap5-is-in-garbage-box`);
  27. cy.getByTestid('put-back-button').click();
  28. cy.getByTestid('put-back-page-modal').should('be.visible').within(() => {
  29. cy.screenshot(`${ssPrefix}-put-back-modal`);
  30. cy.getByTestid('put-back-execution-button').should('be.visible').click();
  31. });
  32. cy.collapseSidebar(true);
  33. cy.screenshot(`${ssPrefix}-put-backed-bootstrap5-page`);
  34. });
  35. it('PageDuplicateModal is shown successfully', () => {
  36. cy.visit('/Sandbox/5');
  37. cy.waitUntilSkeletonDisappear();
  38. cy.waitUntil(() => {
  39. // do
  40. cy.getByTestid('grw-contextual-sub-nav').within(() => {
  41. cy.getByTestid('open-page-item-control-btn').find('button').click({force: true});
  42. });
  43. // wait until
  44. return cy.getByTestid('page-item-control-menu').then($elem => $elem.is(':visible'))
  45. });
  46. cy.getByTestid('open-page-duplicate-modal-btn').filter(':visible').click({force: true});
  47. cy.getByTestid('page-duplicate-modal').should('be.visible').screenshot(`${ssPrefix}-duplicate-bootstrap5`);
  48. });
  49. it('PageMoveRenameModal is shown successfully', () => {
  50. cy.visit('/Sandbox/Bootstrap5');
  51. cy.waitUntilSkeletonDisappear();
  52. cy.waitUntil(() => {
  53. // do
  54. cy.getByTestid('grw-contextual-sub-nav').within(() => {
  55. cy.getByTestid('open-page-item-control-btn').find('button').click({force: true});
  56. });
  57. // wait until
  58. return cy.getByTestid('page-item-control-menu').then($elem => $elem.is(':visible'))
  59. });
  60. cy.getByTestid('rename-page-btn').filter(':visible').click({force: true});
  61. cy.getByTestid('grw-page-rename-button').should('be.disabled');
  62. cy.getByTestid('page-rename-modal').should('be.visible').screenshot(`${ssPrefix}-rename-bootstrap5`);
  63. });
  64. });
  65. // TODO: Uncomment after https://redmine.weseek.co.jp/issues/103121 is resolved
  66. // context('Open presentation modal', () => {
  67. // const ssPrefix = 'access-to-presentation-modal-';
  68. // beforeEach(() => {
  69. // // login
  70. // cy.fixture("user-admin.json").then(user => {
  71. // cy.login(user.username, user.password);
  72. // });
  73. // cy.collapseSidebar(true);
  74. // });
  75. // it('PresentationModal for "/" is shown successfully', () => {
  76. // cy.visit('/');
  77. // cy.getByTestid('grw-contextual-sub-nav').within(() => {
  78. // cy.getByTestid('open-page-item-control-btn').click({force: true});
  79. // cy.getByTestid('open-presentation-modal-btn').click({force: true});
  80. // });
  81. // // eslint-disable-next-line cypress/no-unnecessary-waiting
  82. // cy.wait(1500);
  83. // cy.screenshot(`${ssPrefix}-open-top`);
  84. // });
  85. // });
  86. context('Page Accessories Modal', () => {
  87. const ssPrefix = 'access-to-page-accessories-modal';
  88. beforeEach(() => {
  89. // login
  90. cy.fixture("user-admin.json").then(user => {
  91. cy.login(user.username, user.password);
  92. });
  93. cy.visit('/');
  94. cy.collapseSidebar(true, true);
  95. cy.waitUntilSkeletonDisappear();
  96. cy.waitUntil(() => {
  97. // do
  98. cy.getByTestid('grw-contextual-sub-nav').within(() => {
  99. cy.getByTestid('open-page-item-control-btn').find('button').click({force: true});
  100. });
  101. //wait until
  102. return cy.getByTestid('page-item-control-menu').then($elem => $elem.is(':visible'))
  103. });
  104. });
  105. it('Page History is shown successfully', () => {
  106. cy.get('.dropdown-menu.show').should('be.visible').within(() => {
  107. cy.getByTestid('open-page-accessories-modal-btn-with-history-tab').click({force: true});
  108. });
  109. cy.getByTestid('page-history').should('be.visible');
  110. cy.waitUntilSpinnerDisappear();
  111. cy.screenshot(`${ssPrefix}-open-page-history-bootstrap5`);
  112. });
  113. it('Page Attachment Data is shown successfully', () => {
  114. cy.get('.dropdown-menu.show').should('be.visible').within(() => {
  115. cy.getByTestid('open-page-accessories-modal-btn-with-attachment-data-tab').click({force: true});
  116. });
  117. cy.waitUntilSpinnerDisappear();
  118. cy.getByTestid('page-attachment').should('be.visible').contains('No attachments yet.');
  119. cy.screenshot(`${ssPrefix}-open-page-attachment-data-bootstrap5`);
  120. });
  121. it('Share Link Management is shown successfully', () => {
  122. cy.get('.dropdown-menu.show').should('be.visible').within(() => {
  123. cy.getByTestid('open-page-accessories-modal-btn-with-share-link-management-data-tab').click({force: true});
  124. });
  125. cy.waitUntilSpinnerDisappear();
  126. cy.getByTestid('page-accessories-modal').should('be.visible');
  127. cy.getByTestid('share-link-management').should('be.visible');
  128. cy.screenshot(`${ssPrefix}-open-share-link-management-bootstrap5`);
  129. });
  130. });
  131. context('Tag Oprations', { scrollBehavior: false }, () =>{
  132. beforeEach(() => {
  133. // login
  134. cy.fixture("user-admin.json").then(user => {
  135. cy.login(user.username, user.password);
  136. });
  137. });
  138. it('Successfully add new tag', () => {
  139. const ssPrefix = 'tag-operations-add-new-tag-'
  140. const tag = 'we';
  141. cy.visit('/Sandbox/Bootstrap5');
  142. cy.collapseSidebar(true);
  143. // Add tag
  144. cy.get('#edit-tags-btn-wrapper-for-tooltip').as('edit-tag-tooltip').should('be.visible');
  145. // open Edit Tags Modal
  146. cy.waitUntil(() => {
  147. // do
  148. cy.get('@edit-tag-tooltip').find('a').click({force: true});
  149. // wait until
  150. return cy.get('#edit-tag-modal').then($elem => $elem.is(':visible'));
  151. });
  152. cy.get('#edit-tag-modal').should('be.visible').screenshot(`${ssPrefix}1-edit-tag-input`);
  153. cy.get('#edit-tag-modal').should('be.visible').within(() => {
  154. cy.get('.rbt-input-main').type(tag);
  155. cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  156. cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  157. // select
  158. cy.get('a#tag-typeahead-asynctypeahead-item-0').click();
  159. // save
  160. cy.get('div.modal-footer > button').click();
  161. });
  162. cy.get('.Toastify__toast').should('be.visible').trigger('mouseover');
  163. cy.getByTestid('grw-tag-labels').contains(tag).should('exist');
  164. cy.screenshot(`${ssPrefix}2-click-done`);
  165. });
  166. });