@bigbinary/neeto-commons-frontend 2.0.106 → 2.0.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,7 +99,6 @@ interface TableSelectors {
99
99
  spinner: string;
100
100
  nthHeading: (n: number) => string;
101
101
  }
102
- ;
103
102
  type SignUpSelectors = {
104
103
  emailTextField: string;
105
104
  firstNameTextField: string;
@@ -307,6 +306,15 @@ export const authUtils: {
307
306
  * // Current date is 2023-02-07
308
307
  * dateUtils.pastDate(2); // return 2023-02-05
309
308
  * @endexample
309
+ * @example
310
+ *
311
+ * env.isDevelopment; // return true if the environment is development
312
+ * env.isReview; // return true if the environment is review
313
+ * env.isStaging; // return true if the environment is staging
314
+ * env.isProduction; // return true if the environment is production
315
+ * env.isNightly; // return true if it is a nightly run
316
+ * env.tld; // return the top level domain
317
+ * @endexample
310
318
  */
311
319
  export const dateUtils: {
312
320
  currentDate: () => string;
@@ -375,6 +383,14 @@ interface VerifyMyProfileTabPropTypes {
375
383
  alias: string;
376
384
  requestCount?: number;
377
385
  }
386
+ type Environments = {
387
+ isDevelopment: boolean;
388
+ isReview: boolean;
389
+ isStaging: boolean;
390
+ isProduction: boolean;
391
+ isNightly: boolean;
392
+ tld: string;
393
+ };
378
394
  export const memberUtils: {
379
395
  addMemberViaRequest: (props: AddMemberViaRequestPropsType) => void;
380
396
  addMemberViaUI: (props: AddMemberViaUIPropsType) => void;
@@ -424,4 +440,5 @@ export const signUpTexts: SignUpTexts;
424
440
  export const environment: Environment;
425
441
  export const isStagingEnv: boolean;
426
442
  export const helpIconTexts: HelpIconTexts;
427
- export const profileTexts: ProfileTexts;
443
+ export const profileTexts: ProfileTexts;
444
+ export const env: Environments;
package/cypress-utils.js CHANGED
@@ -74,15 +74,25 @@ function _toConsumableArray(arr) {
74
74
 
75
75
  var environment = {
76
76
  development: "development",
77
- staging: "staging"
77
+ staging: "staging",
78
+ review: "review",
79
+ production: "production"
78
80
  };
79
- var isStagingEnv = Cypress.env("configFile") === environment.staging;
80
81
 
81
82
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
82
83
  function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
83
84
  var getCountFromText = function getCountFromText(countText) {
84
85
  return Number(countText.text().trim().split(" ")[0]);
85
86
  };
87
+ var env = {
88
+ isDevelopment: Cypress.env("configFile") === environment.development,
89
+ isReview: Cypress.env("configFile") === environment.review,
90
+ isStaging: Cypress.env("configFile") === environment.staging,
91
+ isProduction: Cypress.env("configFile") === environment.production
92
+ };
93
+ env.isNightlyRun = env.isProduction || env.isStaging;
94
+ env.tld = env.isProduction ? "com" : "net";
95
+ var isStagingEnv = Cypress.env("configFile") === environment.staging;
86
96
  var dataCy = function dataCy(value) {
87
97
  var suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
88
98
  return "[data-cy='".concat(value, "']").concat(suffix);
@@ -132,6 +142,7 @@ var initializeCredentials = function initializeCredentials(stagingData) {
132
142
  var allPath = function allPath() {
133
143
  return "".concat(Cypress.config("baseUrl"), "/**");
134
144
  };
145
+ var tld = env.isProduction ? "com" : "net";
135
146
  var requestApis = {
136
147
  countries: getUrl("countries"),
137
148
  signUp: getUrl("signups/**"),
@@ -144,12 +155,12 @@ var requestApis = {
144
155
  return "/team_members/teams/".concat(id);
145
156
  }
146
157
  },
147
- allChatPath: "https://*.neetochat.net".concat(getUrl("**")),
158
+ allChatPath: "https://*.neetochat.".concat(tld).concat(getUrl("**")),
148
159
  myProfilePath: function myProfilePath(subdomain) {
149
- return "https://".concat(subdomain, ".neetoauth.net/my/profile");
160
+ return "https://".concat(subdomain, ".neetoauth.").concat(tld, "/my/profile");
150
161
  },
151
162
  settingsPath: function settingsPath(subdomain) {
152
- return "https://".concat(subdomain, ".neetoauth.net/settings");
163
+ return "https://".concat(subdomain, ".neetoauth.").concat(tld, "/settings");
153
164
  }
154
165
  };
155
166
  var urlPaths = {
@@ -1070,7 +1081,7 @@ var memberUtils = {
1070
1081
  clickOnColumnIcon: clickOnColumnIcon
1071
1082
  };
1072
1083
 
1073
- var updateSubdmainIfExit = function updateSubdmainIfExit(appName, subdomainName) {
1084
+ var updateSubdomainIfExists = function updateSubdomainIfExists(appName, subdomainName) {
1074
1085
  cy.ifExist(signUpSelectors.subdomainError, function () {
1075
1086
  var lastDigit = Number(subdomainName.charAt(subdomainName.length - 1));
1076
1087
  var newOrganizationName = subdomainName.slice(0, -1) + (lastDigit + 1);
@@ -1089,12 +1100,12 @@ var updateSubdmainIfExit = function updateSubdmainIfExit(appName, subdomainName)
1089
1100
  key: "businessName",
1090
1101
  value: newOrganizationName
1091
1102
  });
1092
- var newBaseUrl = "https://".concat(newOrganizationName, ".").concat(appName, ".net");
1103
+ var newBaseUrl = "https://".concat(newOrganizationName, ".").concat(appName, ".").concat(env.tld);
1093
1104
  Cypress.config("baseUrl", newBaseUrl);
1094
1105
  cy.clearAndType(signUpSelectors.organizationNameTextField, newOrganizationName);
1095
1106
  });
1096
1107
  cy.ifExist(signUpSelectors.subdomainError, function () {
1097
- return updateSubdmainIfExit(appName, newOrganizationName);
1108
+ return updateSubdomainIfExists(appName, newOrganizationName);
1098
1109
  });
1099
1110
  });
1100
1111
  };
@@ -1109,8 +1120,8 @@ var createOrganization = function createOrganization(_ref) {
1109
1120
  var defaultOtp = "123456";
1110
1121
  var appNameInLowerCase = appName.toLowerCase();
1111
1122
  var isNeetoAuth = appNameInLowerCase === "neetoauth";
1112
- if (isNeetoAuth) cy.visit("https://app.neetoauth.net/signups/new");else {
1113
- var startingUrl = "https://www.neeto.com/".concat(appNameInLowerCase, "?env=staging");
1123
+ if (isNeetoAuth) cy.visit("https://app.neetoauth.".concat(env.tld, "/signups/new"));else {
1124
+ var startingUrl = "https://www.neeto.com/".concat(appNameInLowerCase).concat(env.isProduction ? "?env=staging" : "");
1114
1125
  cy.visit(startingUrl);
1115
1126
  cy.get(signUpSelectors.tryFreeButton).invoke("removeAttr", "target").click();
1116
1127
  }
@@ -1139,7 +1150,7 @@ var createOrganization = function createOrganization(_ref) {
1139
1150
  cy.clearAndType(signUpSelectors.organizationNameTextField, businessName);
1140
1151
  cy.clearAndType(signUpSelectors.subdomainNameTextField, subdomainName);
1141
1152
  cy.wait("@subdomainRequest");
1142
- updateSubdmainIfExit(appNameInLowerCase, subdomainName);
1153
+ updateSubdomainIfExists(appNameInLowerCase, subdomainName);
1143
1154
  cy.intercept({
1144
1155
  url: requestApis.signUp,
1145
1156
  times: 1
@@ -1314,5 +1325,5 @@ var navigationUtils = {
1314
1325
  verifyOrganizationTab: verifyOrganizationTab
1315
1326
  };
1316
1327
 
1317
- export { authUtils, chatWidgetSelectors, commonSelectors, commonTexts, createOrganization, dataCy, dateUtils, environment, getTestTitle, getUrl, helpIconSelectors, helpIconTexts, initCustomCommands, initializeCredentials, isStagingEnv, joinHyphenCase, loginSelectors, memberFormErrorTexts, memberFormSelectors, memberSelectors, memberTableTexts, memberTexts, memberUtils, navigationUtils, profileSelectors, profileTexts, setListCount, signUpSelectors, signUpTexts, tableSelectors, verifyCrossSiteScript, verifyListCount };
1328
+ export { authUtils, chatWidgetSelectors, commonSelectors, commonTexts, createOrganization, dataCy, dateUtils, env, environment, getTestTitle, getUrl, helpIconSelectors, helpIconTexts, initCustomCommands, initializeCredentials, isStagingEnv, joinHyphenCase, loginSelectors, memberFormErrorTexts, memberFormSelectors, memberSelectors, memberTableTexts, memberTexts, memberUtils, navigationUtils, profileSelectors, profileTexts, setListCount, signUpSelectors, signUpTexts, tableSelectors, verifyCrossSiteScript, verifyListCount };
1318
1329
  //# sourceMappingURL=cypress-utils.js.map