AtSettings.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const { I } = inject();
  2. module.exports = {
  3. GENERAL_SETTINGS: {
  4. SHOW_LABELS: "Show labels inside the regions",
  5. AUTO_SELECT_REGION: "Select regions after creating",
  6. },
  7. LAYOUT_SETTINGS: {
  8. VERTICAL_LAYOUT: "Move sidepanel to the bottom",
  9. },
  10. _openButtonLocator: locate('button[aria-label="Settings"]'),
  11. _closeButtonLocator: locate('button[aria-label="Close"]'),
  12. _modalLocator: locate(".ant-modal"),
  13. _tabLocator: locate(".ant-tabs-tab"),
  14. _activeTabLocator: locate(".ant-tabs-tab-active"),
  15. open() {
  16. I.click(this._openButtonLocator);
  17. I.seeElement(this._modalLocator);
  18. I.waitTicks(3);
  19. },
  20. close() {
  21. I.click(this._closeButtonLocator);
  22. I.waitToHide(this._modalLocator);
  23. I.waitTicks(3);
  24. },
  25. _setSettings(settings = {}) {
  26. for (const [setting, value] of Object.entries(settings)) {
  27. if (value) {
  28. I.dontSeeCheckboxIsChecked(setting);
  29. I.checkOption(setting);
  30. I.seeCheckboxIsChecked(setting);
  31. } else {
  32. I.seeCheckboxIsChecked(setting);
  33. I.uncheckOption(setting);
  34. I.dontSeeCheckboxIsChecked(setting);
  35. }
  36. }
  37. },
  38. goToTab(tabName) {
  39. I.click(this._tabLocator.withText(tabName));
  40. I.seeElement(this._activeTabLocator.withText(tabName));
  41. },
  42. setGeneralSettings(settings = {}) {
  43. this.goToTab("General");
  44. this._setSettings(settings);
  45. },
  46. setLayoutSettings(settings = {}) {
  47. this.goToTab("Layout");
  48. this._setSettings(settings);
  49. },
  50. };