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