access-to-page.spec.ts 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. context('Access to page by guest', () => {
  2. const ssPrefix = 'access-to-page-by-guest-';
  3. it('/Sandbox is successfully loaded', () => {
  4. cy.visit('/Sandbox');
  5. cy.waitUntilSpinnerDisappear();
  6. cy.getByTestid('grw-pagetree-item-container').should('be.visible');
  7. cy.collapseSidebar(true, true);
  8. cy.screenshot(`${ssPrefix}-sandbox`);
  9. });
  10. it('/Sandbox with anchor hash is successfully loaded', () => {
  11. cy.visit('/Sandbox#Headers');
  12. cy.getByTestid('grw-pagetree-item-container').should('be.visible');
  13. cy.collapseSidebar(true, true);
  14. // eslint-disable-next-line cypress/no-unnecessary-waiting
  15. // cy.wait(500);
  16. // hide fab // disable fab for sticky-events warning
  17. // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
  18. cy.screenshot(`${ssPrefix}-sandbox-headers`);
  19. });
  20. it('/Sandbox/Math is successfully loaded', () => {
  21. cy.visit('/Sandbox/Math');
  22. cy.getByTestid('revision-toc-content').should('be.visible');
  23. cy.collapseSidebar(true, true);
  24. cy.get('.math').should('be.visible');
  25. cy.screenshot(`${ssPrefix}-sandbox-math`);
  26. });
  27. it('/Sandbox with edit is successfully loaded', () => {
  28. cy.visit('/Sandbox#edit');
  29. cy.collapseSidebar(true, true);
  30. // eslint-disable-next-line cypress/no-unnecessary-waiting
  31. cy.wait(1000);
  32. cy.screenshot(`${ssPrefix}-sandbox-edit-page`);
  33. })
  34. });
  35. context('Access to /me page', () => {
  36. const ssPrefix = 'access-to-me-page-by-guest-';
  37. beforeEach(() => {
  38. // collapse sidebar
  39. cy.collapseSidebar(true);
  40. });
  41. it('/me should be redirected to /login', () => {
  42. cy.visit('/me', { });
  43. cy.screenshot(`${ssPrefix}-me`);
  44. });
  45. });
  46. context('Access to special pages by guest', () => {
  47. const ssPrefix = 'access-to-special-pages-by-guest-';
  48. it('/trash is successfully loaded', () => {
  49. cy.visit('/trash', { });
  50. cy.collapseSidebar(true, true);
  51. cy.getByTestid('trash-page-list').should('be.visible');
  52. cy.screenshot(`${ssPrefix}-trash`);
  53. });
  54. it('/tags is successfully loaded', () => {
  55. cy.visit('/tags');
  56. // open sidebar
  57. cy.collapseSidebar(false);
  58. // select tags
  59. cy.getByTestid('grw-sidebar-nav-primary-tags').click();
  60. cy.getByTestid('grw-sidebar-content-tags').should('be.visible');
  61. cy.getByTestid('grw-tags-list').should('be.visible');
  62. cy.getByTestid('grw-tags-list').contains('You have no tag, You can set tags on pages');
  63. cy.getByTestid('tags-page').should('be.visible');
  64. cy.screenshot(`${ssPrefix}-tags`);
  65. });
  66. });