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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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.waitUntil(() => {
  95. // do
  96. cy.getByTestid('grw-contextual-sub-nav').should('be.visible').within(() => {
  97. cy.getByTestid('open-page-item-control-btn').find('button').first().as('btn').click();
  98. });
  99. // wait until
  100. return cy.get('body').within(() => {
  101. return Cypress.$('.dropdown-menu.show').is(':visible');
  102. });
  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.collapseSidebar(true, true);
  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.collapseSidebar(true);
  121. cy.screenshot(`${ssPrefix}-open-page-attachment-data-bootstrap4`);
  122. });
  123. it('Share Link Management is shown successfully', () => {
  124. cy.get('.dropdown-menu.show').should('be.visible').within(() => {
  125. cy.getByTestid('open-page-accessories-modal-btn-with-share-link-management-data-tab').click({force: true});
  126. });
  127. cy.waitUntilSpinnerDisappear();
  128. cy.getByTestid('page-accessories-modal').should('be.visible');
  129. cy.getByTestid('share-link-management').should('be.visible');
  130. cy.collapseSidebar(true);
  131. cy.screenshot(`${ssPrefix}-open-share-link-management-bootstrap4`);
  132. });
  133. });
  134. context('Tag Oprations', { scrollBehavior: false }, () =>{
  135. beforeEach(() => {
  136. // login
  137. cy.fixture("user-admin.json").then(user => {
  138. cy.login(user.username, user.password);
  139. });
  140. });
  141. it('Successfully add new tag', () => {
  142. const ssPrefix = 'tag-operations-add-new-tag-'
  143. const tag = 'we';
  144. cy.visit('/Sandbox/Bootstrap4');
  145. // Add tag
  146. cy.get('#edit-tags-btn-wrapper-for-tooltip').as('edit-tag-tooltip').should('be.visible');
  147. // open Edit Tags Modal
  148. cy.waitUntil(() => {
  149. // do
  150. cy.get('@edit-tag-tooltip').find('a').click({force: true});
  151. // wait until
  152. return cy.get('#edit-tag-modal').then($elem => $elem.is(':visible'));
  153. });
  154. cy.collapseSidebar(true);
  155. cy.get('#edit-tag-modal').should('be.visible').screenshot(`${ssPrefix}1-edit-tag-input`);
  156. cy.get('#edit-tag-modal').should('be.visible').within(() => {
  157. cy.get('.rbt-input-main').type(tag);
  158. cy.get('#tag-typeahead-asynctypeahead').should('be.visible');
  159. cy.get('#tag-typeahead-asynctypeahead-item-0').should('be.visible');
  160. // select
  161. cy.get('a#tag-typeahead-asynctypeahead-item-0').click();
  162. // save
  163. cy.get('div.modal-footer > button').click();
  164. });
  165. cy.get('.Toastify__toast').should('be.visible').trigger('mouseover');
  166. cy.get('.grw-taglabels-container > .grw-tag-labels > a').contains(tag).should('exist');
  167. cy.screenshot(`${ssPrefix}2-click-done`);
  168. });
  169. });