20-basic-features--access-to-pagelist.spec.ts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. context('Access to pagelist', () => {
  2. const ssPrefix = 'access-to-pagelist-';
  3. beforeEach(() => {
  4. // login
  5. cy.fixture("user-admin.json").then(user => {
  6. cy.login(user.username, user.password);
  7. });
  8. // collapse sidebar
  9. cy.collapseSidebar(true);
  10. });
  11. it('Page list modal is successfully opened ', () => {
  12. cy.visit('/');
  13. cy.waitUntilSkeletonDisappear();
  14. cy.getByTestid('pageListButton').click({force: true});
  15. cy.getByTestid('page-accessories-modal').parent().should('have.class','show');
  16. cy.getByTestid('page-list-item-L').should('be.visible');
  17. // Wait until the string "You cannot see this page" is no longer displayed
  18. cy.getByTestid('page-list-item-L').eq(0).within(() => {
  19. cy.get('.icon-exclamation').should('not.exist');
  20. });
  21. cy.screenshot(`${ssPrefix}1-open-pagelist-modal`);
  22. });
  23. it('Successfully duplicate a page from page list', () => {
  24. cy.visit('/');
  25. cy.getByTestid('pageListButton').click({force: true});
  26. cy.getByTestid('page-accessories-modal').parent().should('have.class','show').within(() => {
  27. cy.getByTestid('open-page-item-control-btn').first().click();
  28. cy.getByTestid('page-item-control-menu').should('have.class', 'show').first().within(() => {
  29. // eslint-disable-next-line cypress/no-unnecessary-waiting
  30. cy.wait(300);
  31. cy.screenshot(`${ssPrefix}2-open-page-item-control-menu`);
  32. cy.getByTestid('open-page-duplicate-modal-btn').click();
  33. });
  34. });
  35. cy.getByTestid('page-duplicate-modal').should('be.visible').screenshot(`${ssPrefix}3-duplicate-page-modal-opened`);
  36. cy.getByTestid('page-duplicate-modal').should('be.visible').within(() => {
  37. cy.get('.rbt-input-main').type('-duplicate', {force: true})
  38. }).screenshot(`${ssPrefix}4-input-duplicated-page-name`);
  39. cy.getByTestid('page-duplicate-modal').should('be.visible').within(() => {
  40. cy.get('.modal-footer > button').click();
  41. });
  42. cy.get('body').type('{esc}');
  43. cy.getByTestid('pageListButton').click({force: true});
  44. cy.getByTestid('page-accessories-modal').parent().should('have.class','show').within(() => {
  45. cy.get('.list-group-item').eq(0).within(() => {
  46. cy.screenshot(`${ssPrefix}5-duplicated-page`);
  47. });
  48. });
  49. });
  50. it('Successfully expand and close modal', () => {
  51. cy.visit('/');
  52. cy.waitUntilSkeletonDisappear();
  53. cy.getByTestid('pageListButton').click({force: true});
  54. cy.getByTestid('page-accessories-modal').parent().should('have.class','show');
  55. cy.getByTestid('page-list-item-L').should('be.visible');
  56. // Wait until the string "You cannot see this page" is no longer displayed
  57. cy.getByTestid('page-list-item-L').eq(0).within(() => {
  58. cy.get('.icon-exclamation').should('not.exist');
  59. });
  60. cy.screenshot(`${ssPrefix}6-page-list-modal-size-normal`);
  61. cy.getByTestid('page-accessories-modal').parent().should('have.class','show').within(() => {
  62. cy.get('button.close').eq(0).click();
  63. });
  64. cy.screenshot(`${ssPrefix}7-page-list-modal-size-fullscreen`);
  65. cy.getByTestid('page-accessories-modal').parent().should('have.class','show').within(() => {
  66. cy.get('button.close').eq(1).click();
  67. });
  68. cy.screenshot(`${ssPrefix}8-close-page-list-modal`);
  69. });
  70. });
  71. context('Access to timeline', () => {
  72. const ssPrefix = 'access-to-timeline-';
  73. beforeEach(() => {
  74. // login
  75. cy.fixture("user-admin.json").then(user => {
  76. cy.login(user.username, user.password);
  77. });
  78. // collapse sidebar
  79. cy.collapseSidebar(true);
  80. });
  81. it('Timeline list successfully openend', () => {
  82. cy.visit('/');
  83. cy.getByTestid('pageListButton').click({force: true});
  84. cy.getByTestid('page-accessories-modal').parent().should('have.class','show').within(() => {
  85. cy.get('.nav-title > li').eq(1).find('a').click();
  86. });
  87. // eslint-disable-next-line cypress/no-unnecessary-waiting
  88. cy.wait(500); // wait for loading wiki
  89. cy.screenshot(`${ssPrefix}1-timeline-list`, {capture: 'viewport'});
  90. });
  91. it('Successfully expand and close modal', () => {
  92. cy.visit('/');
  93. cy.getByTestid('pageListButton').click({force: true});
  94. cy.getByTestid('page-accessories-modal').parent().should('have.class','show').within(() => {
  95. cy.get('.nav-title > li').eq(1).find('a').click();
  96. cy.get('button.close').eq(0).click();
  97. });
  98. cy.get('.modal').should('be.visible');
  99. // eslint-disable-next-line cypress/no-unnecessary-waiting
  100. cy.wait(500); // wait for loading wiki
  101. cy.screenshot(`${ssPrefix}2-timeline-list-fullscreen`, {capture: 'viewport'});
  102. cy.getByTestid('page-accessories-modal').parent().should('have.class','show').within(() => {
  103. cy.get('button.close').eq(1).click();
  104. });
  105. cy.screenshot(`${ssPrefix}3-close-modal`, {capture: 'viewport'});
  106. });
  107. });