access-to-page.spec.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. context('Access to page by guest', () => {
  2. const ssPrefix = 'access-to-page-by-guest-';
  3. beforeEach(() => {
  4. // collapse sidebar
  5. cy.collapseSidebar(true);
  6. });
  7. it('/Sandbox is successfully loaded', () => {
  8. cy.visit('/Sandbox', { });
  9. cy.screenshot(`${ssPrefix}-sandbox`);
  10. });
  11. it('/Sandbox with anchor hash is successfully loaded', () => {
  12. cy.visit('/Sandbox#Headers');
  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.get('mjx-container').should('be.visible');
  20. cy.screenshot(`${ssPrefix}-sandbox-math`);
  21. });
  22. it('/Sandbox with edit is successfully loaded', () => {
  23. cy.visit('/Sandbox#edit');
  24. cy.screenshot(`${ssPrefix}-sandbox-edit-page`);
  25. })
  26. });
  27. context('Access to /me page', () => {
  28. const ssPrefix = 'access-to-me-page-by-guest-';
  29. beforeEach(() => {
  30. // collapse sidebar
  31. cy.collapseSidebar(true);
  32. });
  33. it('/me should be redirected to /login', () => {
  34. cy.visit('/me', { });
  35. cy.screenshot(`${ssPrefix}-me`);
  36. });
  37. });
  38. context('Access to special pages by guest', () => {
  39. const ssPrefix = 'access-to-special-pages-by-guest-';
  40. beforeEach(() => {
  41. // collapse sidebar
  42. cy.collapseSidebar(true);
  43. });
  44. it('/trash is successfully loaded', () => {
  45. cy.visit('/trash', { });
  46. cy.getByTestid('trash-page-list').should('be.visible');
  47. cy.screenshot(`${ssPrefix}-trash`);
  48. });
  49. it('/tags is successfully loaded', () => {
  50. cy.visit('/tags');
  51. // open sidebar
  52. cy.collapseSidebar(false);
  53. // select tags
  54. cy.getByTestid('grw-sidebar-nav-primary-tags').click();
  55. cy.getByTestid('grw-sidebar-content-tags').should('be.visible');
  56. cy.getByTestid('grw-tags-list').should('be.visible');
  57. cy.getByTestid('grw-tags-list').contains('You have no tag, You can set tags on pages');
  58. cy.getByTestid('tags-page').should('be.visible');
  59. cy.screenshot(`${ssPrefix}-tags`);
  60. });
  61. });