home.spec.ts 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. context('Access Home', () => {
  2. const ssPrefix = 'home-';
  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('Visit home', () => {
  12. cy.visit('/dummy');
  13. cy.getByTestid('grw-personal-dropdown').click();
  14. cy.getByTestid('grw-personal-dropdown').find('.dropdown-menu .btn-group > .btn-outline-secondary:eq(0)').click();
  15. cy.get('.grw-users-info').should('be.visible');
  16. // for check download toc data
  17. cy.get('.toc-link').should('be.visible');
  18. cy.screenshot(`${ssPrefix}-visit-home`);
  19. });
  20. });
  21. context('Access User settings', () => {
  22. const ssPrefix = 'access-user-settings-';
  23. beforeEach(() => {
  24. // login
  25. cy.fixture("user-admin.json").then(user => {
  26. cy.login(user.username, user.password);
  27. });
  28. // collapse sidebar
  29. cy.collapseSidebar(true);
  30. cy.visit('/me');
  31. // hide fab // disable fab for sticky-events warning
  32. // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
  33. });
  34. it('Access User information', () => {
  35. // User information
  36. cy.getByTestid('grw-user-settings').should('be.visible');
  37. cy.screenshot(`${ssPrefix}-user-information-1`);
  38. cy.getByTestid('grw-besic-info-settings-update-button').click();
  39. cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  40. cy.screenshot(`${ssPrefix}-user-information-2`);
  41. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  42. cy.get('.toast').should('not.exist');
  43. });
  44. it('Access External account', () => {
  45. cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(1) a').click();
  46. cy.scrollTo('top');
  47. cy.screenshot(`${ssPrefix}-external-account-1`);
  48. cy.getByTestid('grw-external-account-add-button').click();
  49. cy.getByTestid('grw-associate-modal').should('be.visible');
  50. cy.screenshot(`${ssPrefix}-external-account-2`);
  51. cy.getByTestid('grw-associate-modal').find('.modal-footer button').click(); // click add button in modal form
  52. cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  53. cy.screenshot(`${ssPrefix}-external-account-3`);
  54. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  55. cy.get('.toast').should('not.exist');
  56. cy.getByTestid('grw-associate-modal').find('.close').click();
  57. cy.screenshot(`${ssPrefix}-external-account-4`);
  58. cy.get('.toast').should('not.exist');
  59. });
  60. it('Access Password setting', () => {
  61. cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(2) a').click();
  62. cy.scrollTo('top');
  63. cy.screenshot(`${ssPrefix}-password-settings-1`);
  64. cy.getByTestid('grw-password-settings-update-button').click();
  65. cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  66. cy.screenshot(`${ssPrefix}-password-settings-2`);
  67. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  68. cy.get('.toast').should('not.exist');
  69. });
  70. it('Access API setting', () => {
  71. cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(3) a').click();
  72. cy.scrollTo('top');
  73. cy.screenshot(`${ssPrefix}-api-setting-1`);
  74. cy.getByTestid('grw-api-settings-update-button').click();
  75. cy.getByTestid('grw-api-settings-input').should('be.visible');
  76. cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  77. cy.screenshot(`${ssPrefix}-api-setting-2`);
  78. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  79. cy.get('.toast').should('not.exist');
  80. });
  81. it('Access Editor setting', () => {
  82. cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(4) a').click();
  83. cy.scrollTo('top');
  84. cy.getByTestid('grw-editor-settings').should('be.visible');
  85. cy.screenshot(`${ssPrefix}-editor-setting-1`);
  86. cy.getByTestid('grw-editor-settings-update-button').click();
  87. cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  88. cy.screenshot(`${ssPrefix}-editor-setting-2`);
  89. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  90. cy.get('.toast').should('not.exist');
  91. });
  92. it('Access In-app notification setting', () => {
  93. cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(5) a').click();
  94. cy.scrollTo('top');
  95. cy.screenshot(`${ssPrefix}-in-app-notification-setting-1`);
  96. cy.getByTestid('grw-in-app-notification-settings-update-button').click();
  97. cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
  98. cy.screenshot(`${ssPrefix}-in-app-notification-setting-2`);
  99. });
  100. });