access-to-page.spec.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. context('Access to page', () => {
  2. const ssPrefix = 'access-to-page-';
  3. beforeEach(() => {
  4. // login
  5. cy.fixture("user-admin.json").then(user => {
  6. cy.login(user.username, user.password);
  7. });
  8. // collapse sidebar
  9. cy.collapseSidebar(true);
  10. });
  11. it('/Sandbox is successfully loaded', () => {
  12. cy.visit('/Sandbox', { });
  13. cy.screenshot(`${ssPrefix}-sandbox`);
  14. });
  15. it('/Sandbox with anchor hash is successfully loaded', () => {
  16. cy.visit('/Sandbox#Headers');
  17. // wait until opacity is 1.
  18. cy.getByTestid('grw-fab-create-page')
  19. .should('be.visible')
  20. .should('have.class', 'fadeInUp')
  21. .should('have.css', 'opacity', '1');
  22. cy.screenshot(`${ssPrefix}-sandbox-headers`);
  23. });
  24. it('/Sandbox/Math is successfully loaded', () => {
  25. cy.visit('/Sandbox/Math');
  26. cy.screenshot(`${ssPrefix}-sandbox-math`);
  27. });
  28. it('/Sandbox with edit is successfully loaded', () => {
  29. cy.visit('/Sandbox#edit');
  30. cy.screenshot(`${ssPrefix}-sandbox-edit-page`);
  31. })
  32. it('/user/admin is successfully loaded', () => {
  33. cy.visit('/user/admin', { });
  34. cy.screenshot(`${ssPrefix}-user-admin`);
  35. });
  36. });
  37. context('Access to /me page', () => {
  38. const ssPrefix = 'access-to-me-page-';
  39. beforeEach(() => {
  40. // login
  41. cy.fixture("user-admin.json").then(user => {
  42. cy.login(user.username, user.password);
  43. });
  44. // collapse sidebar
  45. cy.collapseSidebar(true);
  46. });
  47. it('/me is successfully loaded', () => {
  48. cy.visit('/me', { });
  49. cy.screenshot(`${ssPrefix}-me`);
  50. });
  51. it('Draft page is successfully shown', () => {
  52. cy.visit('/me/drafts');
  53. cy.screenshot(`${ssPrefix}-draft-page`);
  54. });
  55. });
  56. context('Access to special pages', () => {
  57. const ssPrefix = 'access-to-special-pages-';
  58. beforeEach(() => {
  59. // login
  60. cy.fixture("user-admin.json").then(user => {
  61. cy.login(user.username, user.password);
  62. });
  63. // collapse sidebar
  64. cy.collapseSidebar(true);
  65. });
  66. it('/trash is successfully loaded', () => {
  67. cy.visit('/trash', { });
  68. cy.getByTestid('trash-page-list').should('be.visible');
  69. cy.screenshot(`${ssPrefix}-trash`);
  70. });
  71. it('/tags is successfully loaded', () => {
  72. cy.visit('/tags');
  73. // open sidebar
  74. cy.collapseSidebar(false);
  75. // select tags
  76. cy.getByTestid('grw-sidebar-nav-primary-tags').click();
  77. cy.getByTestid('grw-sidebar-content-tags').should('be.visible');
  78. cy.getByTestid('tags-page').should('be.visible');
  79. cy.screenshot(`${ssPrefix}-tags`);
  80. });
  81. });