access-to-page.spec.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. // hide fab
  18. cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
  19. cy.screenshot(`${ssPrefix}-sandbox-headers`);
  20. });
  21. it('/Sandbox/Math is successfully loaded', () => {
  22. cy.visit('/Sandbox/Math');
  23. cy.screenshot(`${ssPrefix}-sandbox-math`);
  24. });
  25. it('/Sandbox with edit is successfully loaded', () => {
  26. cy.visit('/Sandbox#edit');
  27. cy.screenshot(`${ssPrefix}-sandbox-edit-page`);
  28. })
  29. it('/user/admin is successfully loaded', () => {
  30. cy.visit('/user/admin', { });
  31. cy.screenshot(`${ssPrefix}-user-admin`);
  32. });
  33. });
  34. context('Access to /me page', () => {
  35. const ssPrefix = 'access-to-me-page-';
  36. beforeEach(() => {
  37. // login
  38. cy.fixture("user-admin.json").then(user => {
  39. cy.login(user.username, user.password);
  40. });
  41. // collapse sidebar
  42. cy.collapseSidebar(true);
  43. });
  44. it('/me is successfully loaded', () => {
  45. cy.visit('/me', { });
  46. cy.screenshot(`${ssPrefix}-me`);
  47. });
  48. it('Draft page is successfully shown', () => {
  49. cy.visit('/me/drafts');
  50. cy.screenshot(`${ssPrefix}-draft-page`);
  51. });
  52. });
  53. context('Access to special pages', () => {
  54. const ssPrefix = 'access-to-special-pages-';
  55. beforeEach(() => {
  56. // login
  57. cy.fixture("user-admin.json").then(user => {
  58. cy.login(user.username, user.password);
  59. });
  60. // collapse sidebar
  61. cy.collapseSidebar(true);
  62. });
  63. it('/trash is successfully loaded', () => {
  64. cy.visit('/trash', { });
  65. cy.getByTestid('trash-page-list').should('be.visible');
  66. cy.screenshot(`${ssPrefix}-trash`);
  67. });
  68. it('/tags is successfully loaded', () => {
  69. cy.visit('/tags');
  70. // open sidebar
  71. cy.collapseSidebar(false);
  72. // select tags
  73. cy.getByTestid('grw-sidebar-nav-primary-tags').click();
  74. cy.getByTestid('grw-sidebar-content-tags').should('be.visible');
  75. cy.getByTestid('grw-tags-list').should('be.visible');
  76. cy.getByTestid('grw-tags-list').contains('You have no tag, You can set tags on pages');
  77. cy.getByTestid('tags-page').should('be.visible');
  78. cy.screenshot(`${ssPrefix}-tags`);
  79. });
  80. });