access-to-page.spec.ts 2.3 KB

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