access-to-page.spec.ts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. context('Access to page', () => {
  2. const ssPrefix = 'access-to-page-';
  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('/Sandbox is successfully loaded', () => {
  12. cy.visit('/Sandbox', { });
  13. cy.screenshot(`${ssPrefix}-sandbox`);
  14. });
  15. it('/Sandbox with anchor hash is successfully loaded', () => {
  16. cy.visit('/Sandbox#Headers');
  17. // hide fab
  18. cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
  19. cy.screenshot(`${ssPrefix}-sandbox-headers`);
  20. });
  21. it('/Sandbox/Math is successfully loaded', () => {
  22. cy.visit('/Sandbox/Math');
  23. cy.get('mjx-container').should('be.visible');
  24. cy.screenshot(`${ssPrefix}-sandbox-math`);
  25. });
  26. it('/Sandbox with edit is successfully loaded', () => {
  27. cy.visit('/Sandbox#edit');
  28. cy.screenshot(`${ssPrefix}-sandbox-edit-page`);
  29. })
  30. it('/user/admin is successfully loaded', () => {
  31. cy.visit('/user/admin', { });
  32. cy.screenshot(`${ssPrefix}-user-admin`);
  33. });
  34. });
  35. context('Access to /me page', () => {
  36. const ssPrefix = 'access-to-me-page-';
  37. beforeEach(() => {
  38. // login
  39. cy.fixture("user-admin.json").then(user => {
  40. cy.login(user.username, user.password);
  41. });
  42. // collapse sidebar
  43. cy.collapseSidebar(true);
  44. });
  45. it('/me is successfully loaded', () => {
  46. cy.visit('/me', { });
  47. cy.screenshot(`${ssPrefix}-me`);
  48. });
  49. it('Draft page is successfully shown', () => {
  50. cy.visit('/me/drafts');
  51. cy.screenshot(`${ssPrefix}-draft-page`);
  52. });
  53. });
  54. context('Access to special pages', () => {
  55. const ssPrefix = 'access-to-special-pages-';
  56. beforeEach(() => {
  57. // login
  58. cy.fixture("user-admin.json").then(user => {
  59. cy.login(user.username, user.password);
  60. });
  61. // collapse sidebar
  62. cy.collapseSidebar(true);
  63. });
  64. it('/trash is successfully loaded', () => {
  65. cy.visit('/trash', { });
  66. cy.getByTestid('trash-page-list').should('be.visible');
  67. cy.screenshot(`${ssPrefix}-trash`);
  68. });
  69. it('/tags is successfully loaded', () => {
  70. cy.visit('/tags');
  71. // open sidebar
  72. cy.collapseSidebar(false);
  73. // select tags
  74. cy.getByTestid('grw-sidebar-nav-primary-tags').click();
  75. cy.getByTestid('grw-sidebar-content-tags').should('be.visible');
  76. cy.getByTestid('grw-tags-list').should('be.visible');
  77. cy.getByTestid('grw-tags-list').contains('You have no tag, You can set tags on pages');
  78. cy.getByTestid('tags-page').should('be.visible');
  79. cy.screenshot(`${ssPrefix}-tags`);
  80. });
  81. });
  82. context('Access to Template Editing Mode', () => {
  83. const ssPrefix = 'access-to-modal-';
  84. beforeEach(() => {
  85. // login
  86. cy.fixture("user-admin.json").then(user => {
  87. cy.login(user.username, user.password);
  88. });
  89. // collapse sidebar
  90. cy.collapseSidebar(true);
  91. });
  92. it('Access to Template Editor mode for only child pages successfully', () => {
  93. cy.visit('/Sandbox/Bootstrap4', { });
  94. cy.get('#grw-subnav-container').within(() => {
  95. cy.getByTestid('open-page-item-control-btn').click();
  96. cy.getByTestid('open-page-template-modal-btn').click();
  97. });
  98. cy.getByTestid('page-template-modal').should('be.visible')
  99. cy.screenshot(`${ssPrefix}-open-page-template-bootstrap4`);
  100. cy.getByTestid('template-button-children').click();
  101. cy.url().should('include', '/_template#edit');
  102. cy.screenshot();
  103. });
  104. it('Access to Template Editor mode including decendants successfully', () => {
  105. cy.visit('/Sandbox/Bootstrap4', { });
  106. cy.get('#grw-subnav-container').within(() => {
  107. cy.getByTestid('open-page-item-control-btn').click();
  108. cy.getByTestid('open-page-template-modal-btn').click();
  109. });
  110. cy.getByTestid('page-template-modal').should('be.visible')
  111. // cy.screenshot(`${ssPrefix}-open-page-template-bootstrap4`);
  112. cy.getByTestid('template-button-decendants').click();
  113. cy.url().should('include', '/__template#edit');
  114. cy.screenshot();
  115. });
  116. });
  117. context('Access to /me/all-in-app-notifications', () => {
  118. const ssPrefix = 'in-app-notifications-';
  119. beforeEach(() => {
  120. // login
  121. cy.fixture("user-admin.json").then(user => {
  122. cy.login(user.username, user.password);
  123. });
  124. // collapse sidebar
  125. cy.collapseSidebar(true);
  126. });
  127. it('All In-App Notification list is successfully loaded', () => {
  128. cy.visit('/');
  129. cy.get('.notification-wrapper > a').click();
  130. cy.get('.notification-wrapper > .dropdown-menu > a').click();
  131. cy.screenshot(`${ssPrefix}-see-all`, { capture: 'viewport' });
  132. cy.get('.grw-custom-nav-tab > div > ul > li:nth-child(2) > a').click();
  133. cy.screenshot(`${ssPrefix}-see-unread`, { capture: 'viewport' });
  134. });
  135. })