access-user-settings.spec.ts 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* eslint-disable cypress/no-unnecessary-waiting */
  2. context('Access User settings', () => {
  3. const ssPrefix = 'access-user-settings-';
  4. let connectSid: string | undefined;
  5. before(() => {
  6. // login
  7. cy.fixture("user-admin.json").then(user => {
  8. cy.login(user.username, user.password);
  9. });
  10. cy.getCookie('connect.sid').then(cookie => {
  11. connectSid = cookie?.value;
  12. });
  13. cy.visit('/');
  14. cy.get('.grw-personal-dropdown').click();
  15. cy.get('[href="/me"]').click();
  16. cy.wait(1500);
  17. });
  18. beforeEach(() => {
  19. if (connectSid != null) {
  20. cy.setCookie('connect.sid', connectSid);
  21. }
  22. });
  23. it('Update settings', () => {
  24. // Access User information
  25. cy.get('#personal-setting .tab-pane.active > div:first button').click(); // Click basic info update button
  26. cy.wait(500);
  27. cy.screenshot(`${ssPrefix}-user-information`, { capture: 'viewport' });
  28. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  29. // Access External account
  30. cy.get('#personal-setting .nav-title.nav li:eq(1) a').click(); // click
  31. cy.get('#personal-setting .tab-pane.active h2 button').click(); // click add button
  32. cy.get('.modal-footer button').click(); // click add button in modal form
  33. cy.get('.close[aria-label="Close"]').click(); // close modal form
  34. cy.wait(500);
  35. cy.screenshot(`${ssPrefix}-external-account`, { capture: 'viewport' });
  36. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  37. // Access Password setting
  38. cy.get('#personal-setting .nav-title.nav li:eq(2) a').click();
  39. cy.get('#personal-setting .tab-pane.active button').click(); // click update button
  40. cy.wait(500);
  41. cy.screenshot(`${ssPrefix}-password-setting`, { capture: 'viewport' });
  42. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  43. // Access API setting
  44. cy.get('#personal-setting .nav-title.nav li:eq(2) a').click();
  45. cy.get('#personal-setting .tab-pane.active button').click(); // click update API token button
  46. cy.wait(500);
  47. cy.screenshot(`${ssPrefix}-api-setting`, { capture: 'viewport' });
  48. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  49. // Access Editor setting
  50. cy.get('#personal-setting .nav-title.nav li:eq(3) a').click();
  51. cy.get('#personal-setting .tab-pane.active button').click(); // click update button
  52. cy.wait(500);
  53. cy.screenshot(`${ssPrefix}-editor-setting`, { capture: 'viewport' });
  54. cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
  55. // Access In-app notification setting
  56. cy.get('#personal-setting .nav-title.nav li:eq(4) a').click();
  57. cy.get('#personal-setting .tab-pane.active button').click(); // click update button
  58. cy.wait(500);
  59. cy.screenshot(`${ssPrefix}-in-app-notification-setting`, { capture: 'viewport' });
  60. });
  61. });