access-to-page.spec.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.collapseSidebar(true, true);
  23. cy.get('.math').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.collapseSidebar(true, true);
  29. // eslint-disable-next-line cypress/no-unnecessary-waiting
  30. cy.wait(1000);
  31. cy.screenshot(`${ssPrefix}-sandbox-edit-page`);
  32. })
  33. });
  34. context('Access to /me page', () => {
  35. const ssPrefix = 'access-to-me-page-by-guest-';
  36. beforeEach(() => {
  37. // collapse sidebar
  38. cy.collapseSidebar(true);
  39. });
  40. it('/me should be redirected to /login', () => {
  41. cy.visit('/me', { });
  42. cy.screenshot(`${ssPrefix}-me`);
  43. });
  44. });
  45. context('Access to special pages by guest', () => {
  46. const ssPrefix = 'access-to-special-pages-by-guest-';
  47. it('/trash is successfully loaded', () => {
  48. cy.visit('/trash', { });
  49. cy.collapseSidebar(true, true);
  50. cy.getByTestid('trash-page-list').should('be.visible');
  51. cy.screenshot(`${ssPrefix}-trash`);
  52. });
  53. it('/tags is successfully loaded', () => {
  54. cy.visit('/tags');
  55. // open sidebar
  56. cy.collapseSidebar(false);
  57. // select tags
  58. cy.getByTestid('grw-sidebar-nav-primary-tags').click();
  59. cy.getByTestid('grw-sidebar-content-tags').should('be.visible');
  60. cy.getByTestid('grw-tags-list').should('be.visible');
  61. cy.getByTestid('grw-tags-list').contains('You have no tag, You can set tags on pages');
  62. cy.getByTestid('tags-page').should('be.visible');
  63. cy.screenshot(`${ssPrefix}-tags`);
  64. });
  65. });