access-to-page.spec.ts 5.0 KB

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