access-to-page.spec.ts 2.4 KB

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