access-to-pagelist.spec.ts 3.9 KB

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