access-to-pagelist.spec.ts 4.2 KB

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