use-tools.spec.ts 3.1 KB

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