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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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/Bootstrap4');
  11. cy.waitUntil(() => {
  12. // do
  13. cy.get('#grw-subnav-container').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}-bootstrap4-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-bootstrap4-page`);
  34. });
  35. it('PageDuplicateModal is shown successfully', () => {
  36. cy.visit('/Sandbox/Bootstrap4');
  37. cy.waitUntilSkeletonDisappear();
  38. cy.waitUntil(() => {
  39. // do
  40. cy.get('#grw-subnav-container').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-bootstrap4`);
  48. });
  49. it('PageMoveRenameModal is shown successfully', () => {
  50. cy.visit('/Sandbox/Bootstrap4');
  51. cy.waitUntilSkeletonDisappear();
  52. cy.waitUntil(() => {
  53. // do
  54. cy.get('#grw-subnav-container').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('open-page-move-rename-modal-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-bootstrap4`);
  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.get('#grw-subnav-container').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.waitUntil(() => {
  96. // do
  97. cy.getByTestid('grw-contextual-sub-nav').should('be.visible').within(() => {
  98. cy.getByTestid('open-page-item-control-btn').find('button').first().as('btn').click();
  99. });
  100. // wait until
  101. return cy.get('body').within(() => {
  102. return Cypress.$('.dropdown-menu.show').is(':visible');
  103. });
  104. });
  105. });
  106. it('Page History is shown successfully', () => {
  107. cy.get('.dropdown-menu.show').should('be.visible').within(() => {
  108. cy.getByTestid('open-page-accessories-modal-btn-with-history-tab').click({force: true});
  109. });
  110. cy.getByTestid('page-history').should('be.visible');
  111. cy.waitUntilSpinnerDisappear();
  112. cy.screenshot(`${ssPrefix}-open-page-history-bootstrap4`);
  113. });
  114. it('Page Attachment Data is shown successfully', () => {
  115. cy.get('.dropdown-menu.show').should('be.visible').within(() => {
  116. cy.getByTestid('open-page-accessories-modal-btn-with-attachment-data-tab').click({force: true});
  117. });
  118. cy.waitUntilSpinnerDisappear();
  119. cy.getByTestid('page-attachment').should('be.visible').contains('No attachments yet.');
  120. cy.screenshot(`${ssPrefix}-open-page-attachment-data-bootstrap4`);
  121. });
  122. it('Share Link Management is shown successfully', () => {
  123. cy.get('.dropdown-menu.show').should('be.visible').within(() => {
  124. cy.getByTestid('open-page-accessories-modal-btn-with-share-link-management-data-tab').click({force: true});
  125. });
  126. cy.waitUntilSpinnerDisappear();
  127. cy.getByTestid('page-accessories-modal').should('be.visible');
  128. cy.getByTestid('share-link-management').should('be.visible');
  129. cy.screenshot(`${ssPrefix}-open-share-link-management-bootstrap4`);
  130. });
  131. });
  132. context('Tag Oprations', { scrollBehavior: false }, () =>{
  133. beforeEach(() => {
  134. // login
  135. cy.fixture("user-admin.json").then(user => {
  136. cy.login(user.username, user.password);
  137. });
  138. });
  139. it('Successfully add new tag', () => {
  140. const ssPrefix = 'tag-operations-add-new-tag-'
  141. const tag = 'we';
  142. cy.visit('/Sandbox/Bootstrap4');
  143. cy.collapseSidebar(true);
  144. // Add tag
  145. cy.get('#edit-tags-btn-wrapper-for-tooltip').as('edit-tag-tooltip').should('be.visible');
  146. // open Edit Tags Modal
  147. cy.waitUntil(() => {
  148. // do
  149. cy.get('@edit-tag-tooltip').find('a').click({force: true});
  150. // wait until
  151. return cy.get('#edit-tag-modal').then($elem => $elem.is(':visible'));
  152. });
  153. cy.get('#edit-tag-modal').should('be.visible').screenshot(`${ssPrefix}1-edit-tag-input`);
  154. cy.get('#edit-tag-modal').should('be.visible').within(() => {
  155. cy.get('.rbt-input-main').type(tag);
  156. cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  157. cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  158. // select
  159. cy.get('a#tag-typeahead-asynctypeahead-item-0').click();
  160. // save
  161. cy.get('div.modal-footer > button').click();
  162. });
  163. cy.get('.Toastify__toast').should('be.visible').trigger('mouseover');
  164. cy.get('.grw-taglabels-container > .grw-tag-labels > a').contains(tag).should('exist');
  165. cy.screenshot(`${ssPrefix}2-click-done`);
  166. });
  167. });