access-to-page.spec.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.collapseSidebar(true, true);
  6. cy.screenshot(`${ssPrefix}-sandbox`);
  7. });
  8. it('/Sandbox with anchor hash is successfully loaded', () => {
  9. cy.visit('/Sandbox#Headers');
  10. cy.collapseSidebar(true, true);
  11. // eslint-disable-next-line cypress/no-unnecessary-waiting
  12. cy.wait(500);
  13. // hide fab // disable fab for sticky-events warning
  14. // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
  15. cy.screenshot(`${ssPrefix}-sandbox-headers`);
  16. });
  17. it('/Sandbox/Math is successfully loaded', () => {
  18. cy.visit('/Sandbox/Math');
  19. cy.collapseSidebar(true, true);
  20. // eslint-disable-next-line cypress/no-unnecessary-waiting
  21. cy.wait(2000); // wait for 2 seconds for renderer
  22. // cy.get('.math').should('be.visible');
  23. // cy.get('.katex-html').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. cy.getByTestid('tags-page').should('be.visible');
  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.screenshot(`${ssPrefix}-tags`);
  64. });
  65. });