use-tools.spec.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. context('Switch Sidebar content', () => {
  2. const ssPrefix = 'switch-sidebar-content';
  3. beforeEach(() => {
  4. // login
  5. cy.fixture("user-admin.json").then(user => {
  6. cy.login(user.username, user.password);
  7. });
  8. });
  9. it('PageTree is successfully shown', () => {
  10. cy.visit('/page');
  11. cy.getByTestid('grw-sidebar-nav-primary-page-tree').click();
  12. cy.screenshot(`${ssPrefix}-pagetree-before-load`, { capture: 'viewport' });
  13. // eslint-disable-next-line cypress/no-unnecessary-waiting
  14. cy.wait(1500);
  15. cy.screenshot(`${ssPrefix}-pagetree-after-load`, { capture: 'viewport' });
  16. });
  17. });
  18. context('Modal for page operation', () => {
  19. const ssPrefix = 'modal-for-page-operation-';
  20. beforeEach(() => {
  21. // login
  22. cy.fixture("user-admin.json").then(user => {
  23. cy.login(user.username, user.password);
  24. });
  25. });
  26. it("PageCreateModal is shown successfully", () => {
  27. cy.visit('/me');
  28. cy.getByTestid('newPageBtn').click();
  29. cy.getByTestid('page-create-modal').should('be.visible').screenshot(`${ssPrefix}-open`);
  30. cy.getByTestid('row-create-page-under-below').find('input.form-control').clear().type('/new-page');
  31. cy.getByTestid('btn-create-page-under-below').click();
  32. cy.getByTestid('page-editor').should('be.visible');
  33. cy.screenshot(`${ssPrefix}-create-clicked`, {capture: 'viewport'});
  34. });
  35. it('PageDeleteModal is shown successfully', () => {
  36. cy.visit('/Sandbox/Bootstrap4');
  37. cy.get('#grw-subnav-container').within(() => {
  38. cy.getByTestid('open-page-item-control-btn').click();
  39. cy.getByTestid('open-page-delete-modal-btn').click();
  40. });
  41. cy.getByTestid('page-delete-modal').should('be.visible').screenshot(`${ssPrefix}-delete-bootstrap4`);
  42. });
  43. it('PageDuplicateModal is shown successfully', () => {
  44. cy.visit('/Sandbox/Bootstrap4', { });
  45. cy.get('#grw-subnav-container').within(() => {
  46. cy.getByTestid('open-page-item-control-btn').click();
  47. cy.getByTestid('open-page-duplicate-modal-btn').click();
  48. });
  49. cy.getByTestid('page-duplicate-modal').should('be.visible').screenshot(`${ssPrefix}-duplicate-bootstrap4`);
  50. });
  51. it('PageMoveRenameModal is shown successfully', () => {
  52. cy.visit('/Sandbox/Bootstrap4', { });
  53. cy.get('#grw-subnav-container').within(() => {
  54. cy.getByTestid('open-page-item-control-btn').click();
  55. cy.getByTestid('open-page-move-rename-modal-btn').click();
  56. });
  57. cy.getByTestid('page-rename-modal').should('be.visible').screenshot(`${ssPrefix}-rename-bootstrap4`);
  58. });
  59. });
  60. context('Open presentation modal', () => {
  61. const ssPrefix = 'access-to-presentation-modal-';
  62. beforeEach(() => {
  63. // login
  64. cy.fixture("user-admin.json").then(user => {
  65. cy.login(user.username, user.password);
  66. });
  67. });
  68. it('PresentationModal for "/" is shown successfully', () => {
  69. cy.visit('/');
  70. cy.get('#grw-subnav-container').within(() => {
  71. cy.getByTestid('open-page-item-control-btn').click({force: true});
  72. cy.getByTestid('open-presentation-modal-btn').click({force: true});
  73. });
  74. // eslint-disable-next-line cypress/no-unnecessary-waiting
  75. cy.wait(1500);
  76. cy.screenshot(`${ssPrefix}-open-top`);
  77. });
  78. it('PresentationModal for "/Sandbox/Bootstrap4" is shown successfully', () => {
  79. cy.visit('/Sandbox/Bootstrap4');
  80. cy.get('#grw-subnav-container').within(() => {
  81. cy.getByTestid('open-page-item-control-btn').click({force: true});
  82. cy.getByTestid('open-presentation-modal-btn').click({force: true});
  83. });
  84. // eslint-disable-next-line cypress/no-unnecessary-waiting
  85. cy.wait(1500);
  86. cy.screenshot(`${ssPrefix}-open-bootstrap4`);
  87. });
  88. });