access-to-page.spec.ts 2.3 KB

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