21-basic-features-for-guest--access-to-page.spec.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.getByTestid('grw-pagetree-item-container').should('be.visible');
  6. cy.collapseSidebar(true);
  7. cy.screenshot(`${ssPrefix}-sandbox`);
  8. });
  9. it('/Sandbox with anchor hash is successfully loaded', () => {
  10. cy.visit('/Sandbox#Headers');
  11. cy.getByTestid('grw-pagetree-item-container').should('be.visible');
  12. // eslint-disable-next-line cypress/no-unnecessary-waiting
  13. // cy.wait(500);
  14. // hide fab // disable fab for sticky-events warning
  15. // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
  16. cy.collapseSidebar(true, true);
  17. cy.screenshot(`${ssPrefix}-sandbox-headers`);
  18. });
  19. it('/Sandbox/Math is successfully loaded', () => {
  20. cy.visit('/Sandbox/Math');
  21. cy.getByTestid('revision-toc-content').should('be.visible');
  22. cy.get('.math').should('be.visible');
  23. cy.collapseSidebar(true);
  24. cy.screenshot(`${ssPrefix}-sandbox-math`, {
  25. blackout: ['.revision-toc', '[data-hide-in-vrt=true]']
  26. });
  27. });
  28. it('/Sandbox with edit is successfully loaded', () => {
  29. cy.visit('/Sandbox#edit');
  30. // eslint-disable-next-line cypress/no-unnecessary-waiting
  31. cy.wait(1000);
  32. cy.collapseSidebar(true);
  33. cy.screenshot(`${ssPrefix}-sandbox-edit-page`);
  34. })
  35. });
  36. context('Access to /me page', () => {
  37. const ssPrefix = 'access-to-me-page-by-guest-';
  38. it('/me should be redirected to /login', () => {
  39. cy.visit('/me');
  40. cy.getByTestid('login-form').should('be.visible');
  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.getByTestid('trash-page-list').should('be.visible');
  49. cy.collapseSidebar(true);
  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. });