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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.waitUntilSpinnerDisappear();
  6. cy.getByTestid('grw-pagetree-item-container').should('be.visible');
  7. cy.collapseSidebar(true, true);
  8. cy.screenshot(`${ssPrefix}-sandbox`);
  9. });
  10. it('/Sandbox with anchor hash is successfully loaded', () => {
  11. cy.visit('/Sandbox#Headers');
  12. cy.getByTestid('grw-pagetree-item-container').should('be.visible');
  13. cy.collapseSidebar(true, true);
  14. // eslint-disable-next-line cypress/no-unnecessary-waiting
  15. // cy.wait(500);
  16. // hide fab // disable fab for sticky-events warning
  17. // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
  18. cy.screenshot(`${ssPrefix}-sandbox-headers`);
  19. });
  20. it('/Sandbox/Math is successfully loaded', () => {
  21. cy.visit('/Sandbox/Math');
  22. cy.getByTestid('revision-toc-content').should('be.visible');
  23. cy.collapseSidebar(true, true);
  24. cy.get('.math').should('be.visible');
  25. cy.screenshot(`${ssPrefix}-sandbox-math`, {
  26. blackout: ['.revision-toc', '[data-hide-in-vrt=true]']
  27. });
  28. });
  29. it('/Sandbox with edit is successfully loaded', () => {
  30. cy.visit('/Sandbox#edit');
  31. cy.collapseSidebar(true, true);
  32. // eslint-disable-next-line cypress/no-unnecessary-waiting
  33. cy.wait(1000);
  34. cy.screenshot(`${ssPrefix}-sandbox-edit-page`);
  35. })
  36. });
  37. context('Access to /me page', () => {
  38. const ssPrefix = 'access-to-me-page-by-guest-';
  39. beforeEach(() => {
  40. // collapse sidebar
  41. cy.collapseSidebar(true);
  42. });
  43. it('/me should be redirected to /login', () => {
  44. cy.visit('/me', { });
  45. cy.screenshot(`${ssPrefix}-me`);
  46. });
  47. });
  48. context('Access to special pages by guest', () => {
  49. const ssPrefix = 'access-to-special-pages-by-guest-';
  50. it('/trash is successfully loaded', () => {
  51. cy.visit('/trash', { });
  52. cy.collapseSidebar(true, true);
  53. cy.getByTestid('trash-page-list').should('be.visible');
  54. cy.screenshot(`${ssPrefix}-trash`);
  55. });
  56. it('/tags is successfully loaded', () => {
  57. cy.visit('/tags');
  58. // open sidebar
  59. cy.collapseSidebar(false);
  60. // select tags
  61. cy.getByTestid('grw-sidebar-nav-primary-tags').click();
  62. cy.getByTestid('grw-sidebar-content-tags').should('be.visible');
  63. cy.getByTestid('grw-tags-list').should('be.visible');
  64. cy.getByTestid('grw-tags-list').contains('You have no tag, You can set tags on pages');
  65. cy.getByTestid('tags-page').should('be.visible');
  66. cy.screenshot(`${ssPrefix}-tags`);
  67. });
  68. });