20-basic-features--access-to-pagelist.cy.ts 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. const openPageAccessoriesModal = () => {
  2. cy.visit('/');
  3. cy.collapseSidebar(true);
  4. cy.waitUntilSkeletonDisappear();
  5. // open PageAccessoriesModal
  6. cy.getByTestid('pageListButton').should('be.visible').click();
  7. cy.getByTestid('descendants-page-list-modal').then($elem => $elem.is(':visible'));
  8. // cy.waitUntil(() => {
  9. // // do
  10. // cy.getByTestid('pageListButton').click();
  11. // // wait until
  12. // return cy.getByTestid('descendants-page-list-modal').then($elem => $elem.is(':visible'));
  13. // });
  14. cy.waitUntilSpinnerDisappear();
  15. }
  16. context('Access to pagelist', () => {
  17. const ssPrefix = 'access-to-pagelist-';
  18. beforeEach(() => {
  19. // login
  20. cy.fixture("user-admin.json").then(user => {
  21. cy.login(user.username, user.password);
  22. });
  23. openPageAccessoriesModal();
  24. });
  25. it('Page list modal is successfully opened ', () => {
  26. // Wait until the string "You cannot see this page" is no longer displayed
  27. cy.getByTestid('page-list-item-L').eq(0).within(() => {
  28. cy.get('.material-symbols-outlined').contains('error').should('not.exist');
  29. });
  30. cy.waitUntilSpinnerDisappear();
  31. cy.waitUntilSkeletonDisappear();
  32. cy.screenshot(`${ssPrefix}1-open-pagelist-modal`);
  33. });
  34. it('Successfully open PageItemControl', () => {
  35. cy.waitUntil(() => {
  36. // do
  37. cy.getByTestid('descendants-page-list-modal').within(() => {
  38. cy.getByTestid('page-list-item-L').first().within(() => {
  39. cy.getByTestid('open-page-item-control-btn').click();
  40. });
  41. });
  42. // wait until
  43. return cy.get('.dropdown-menu.show').then($elem => $elem.is(':visible'));
  44. });
  45. cy.get('.dropdown-menu.show').within(() => {
  46. cy.getByTestid('open-page-duplicate-modal-btn').should('be.visible')
  47. });
  48. cy.waitUntilSkeletonDisappear();
  49. cy.waitUntilSpinnerDisappear();
  50. cy.screenshot(`${ssPrefix}2-open-page-item-control-menu`);
  51. });
  52. it('Successfully expand and close modal', () => {
  53. cy.get('.btn-close').eq(0).click();
  54. cy.waitUntilSkeletonDisappear();
  55. cy.waitUntilSpinnerDisappear();
  56. cy.screenshot(`${ssPrefix}7-page-list-modal-size-fullscreen`);
  57. // Check that the modal has been closed
  58. cy.getByTestid('descendants-page-list-modal').should('not.be.visible')
  59. cy.screenshot(`${ssPrefix}8-close-page-list-modal`);
  60. });
  61. });
  62. context('Access to timeline', () => {
  63. const ssPrefix = 'access-to-timeline-';
  64. beforeEach(() => {
  65. // login
  66. cy.fixture("user-admin.json").then(user => {
  67. cy.login(user.username, user.password);
  68. });
  69. openPageAccessoriesModal();
  70. });
  71. it('Timeline list successfully openend', () => {
  72. cy.getByTestid('descendants-page-list-modal').parent().should('have.class','show').within(() => {
  73. cy.get('.nav-title > li').eq(1).find('a').click();
  74. });
  75. // eslint-disable-next-line cypress/no-unnecessary-waiting
  76. cy.wait(500); // wait for loading wiki
  77. cy.screenshot(`${ssPrefix}1-timeline-list`);
  78. });
  79. });