access-to-page.spec.ts 2.0 KB

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