@bigbinary/neeto-commons-frontend 2.0.42 → 2.0.44

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.
package/README.md CHANGED
@@ -63,6 +63,7 @@ Category
63
63
  - [BrowserSupport](./docs/react/components.md#browsersupport)
64
64
  - [IpRestriction](./docs/react/components.md#iprestriction)
65
65
  - [PublishBlock](./docs/react/components.md#publishblock)
66
+ - [DateRangeFilter](./docs/react/components.md#daterangefilter)
66
67
  - [KeyboardShortcutsPane](./docs/react/components.md#keyboardshortcutspane)
67
68
  - [ShareViaLink](./docs/react/components.md#sharevialink)
68
69
  - [withImmutableActions](./docs/react/utils.md#withimmutableactions)
@@ -15,6 +15,7 @@ declare namespace Cypress {
15
15
  alias: string;
16
16
  requestCount: number;
17
17
  toastMessage: string;
18
+ verifyToastIcon: boolean;
18
19
  }
19
20
  ): Void;
20
21
  interceptApi(
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var common = require('constants/texts/common');
5
6
  var dayjs = require('dayjs');
6
7
 
7
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -171,7 +172,8 @@ var commonSelectors = {
171
172
  toastMessage: dataCy("toastr-message-container"),
172
173
  toastCloseButton: ".neeto-ui-toastr__close-button",
173
174
  windowAlert: "#alert-box",
174
- body: "body"
175
+ body: "body",
176
+ toastIcon: ".Toastify__toast-icon"
175
177
  };
176
178
  var tableSelectors = {
177
179
  nthColumn: function nthColumn(n) {
@@ -190,126 +192,132 @@ var profileSelectors = {
190
192
 
191
193
  function ownKeys(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; }
192
194
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
193
- Cypress.Commands.add("clearAndType", function (selector, text) {
194
- cy.get(selector).clear().type(text);
195
- });
196
- Cypress.Commands.add("clearAndTypeFast", function (selector, text) {
197
- cy.get(selector).clear().type(text, {
198
- delay: 0
195
+ var initCustomCommands = function initCustomCommands() {
196
+ Cypress.Commands.add("clearAndType", function (selector, text) {
197
+ cy.get(selector).clear().type(text);
199
198
  });
200
- });
201
- Cypress.Commands.add("clearByClickAndTypeFast", function (selector, text) {
202
- cy.get(selector).click().clear().type(text, {
203
- delay: 0
199
+ Cypress.Commands.add("clearAndTypeFast", function (selector, text) {
200
+ cy.get(selector).clear().type(text, {
201
+ delay: 0
202
+ });
204
203
  });
205
- });
206
- Cypress.Commands.add("typeFast", function (selector, text) {
207
- cy.get(selector).type(text, {
208
- delay: 0
204
+ Cypress.Commands.add("clearByClickAndTypeFast", function (selector, text) {
205
+ cy.get(selector).click().clear().type(text, {
206
+ delay: 0
207
+ });
209
208
  });
210
- });
211
- Cypress.Commands.add("typeAndEnter", function (selector, text) {
212
- cy.get(selector).clear().type("".concat(text, "{enter}"));
213
- });
214
- Cypress.Commands.add("verifyToastMessage", function (message) {
215
- cy.get(commonSelectors.toastMessage).should("be.visible").should("have.text", message);
209
+ Cypress.Commands.add("typeFast", function (selector, text) {
210
+ cy.get(selector).type(text, {
211
+ delay: 0
212
+ });
213
+ });
214
+ Cypress.Commands.add("typeAndEnter", function (selector, text) {
215
+ cy.get(selector).clear().type("".concat(text, "{enter}"));
216
+ });
217
+ Cypress.Commands.add("verifyToastMessage", function (message) {
218
+ cy.get(commonSelectors.toastMessage).should("be.visible").should("have.text", message);
216
219
 
217
- // close toast message
218
- cy.get(commonSelectors.toastCloseButton).click();
219
- cy.get(commonSelectors.toastMessage).should("not.exist");
220
- });
221
- Cypress.Commands.add("continueOnAlert", function (args) {
222
- var props = _typeof(args) === "object" ? args : {
223
- alias: args
224
- };
225
- var alias = props.alias,
226
- title = props.title,
227
- description = props.description,
228
- _props$requestCount = props.requestCount,
229
- requestCount = _props$requestCount === void 0 ? 1 : _props$requestCount,
230
- toastMessage = props.toastMessage;
231
- var hasMoreThanOneRequest = requestCount > 1;
232
- title && cy.get(commonSelectors.alertTitle).should("have.text", title);
233
- description && cy.get(commonSelectors.alertModalMessage).should("have.text", description);
234
- cy.interceptApi(alias, requestCount);
235
- cy.get(commonSelectors.alertModalSubmitButton).click();
236
- cy.wait("@".concat(alias));
237
- toastMessage && cy.verifyToastMessage(toastMessage);
238
- hasMoreThanOneRequest && cy.waitForMultipleRequest("@".concat(alias), requestCount - 1);
239
- });
240
- Cypress.Commands.add("interceptApi", function (alias) {
241
- var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
242
- return cy.intercept({
243
- url: requestApis.allPath,
244
- times: times
245
- }).as(alias);
246
- });
247
- Cypress.Commands.add("waitForMultipleRequest", function (alias) {
248
- var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
249
- return cy.wrap(_toConsumableArray(new Array(times))).each(function () {
250
- return cy.wait(alias);
220
+ // close toast message
221
+ cy.get(commonSelectors.toastCloseButton).click();
222
+ cy.get(commonSelectors.toastMessage).should("not.exist");
251
223
  });
252
- });
253
- Cypress.Commands.add("apiRequest", function (options) {
254
- return cy.get("@requestHeaders").then(function (requestHeaders) {
255
- return requestHeaders ? cy.request(_objectSpread(_objectSpread({}, options), {}, {
256
- headers: requestHeaders
257
- })) : cy.log("No request headers found");
224
+ Cypress.Commands.add("verifyToastIcon", function () {
225
+ cy.get(commonSelectors.toastIcon).should("have.text", common.commonTexts.toastIcon);
226
+ cy.get(commonSelectors.toastCloseButton).click();
227
+ cy.get(commonSelectors.toastIcon).should("not.exist");
258
228
  });
259
- });
260
- Cypress.Commands.add("reloadAndWait", function () {
261
- var requestCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
262
- if (requestCount > 0) {
263
- cy.interceptApi("reloadAllRequests", requestCount);
264
- cy.reload();
265
- cy.waitForMultipleRequest("@reloadAllRequests", requestCount);
266
- }
267
- });
268
- Cypress.Commands.add("selectOption", function (containerSelector, optionText) {
269
- cy.openInSameTabOnClick;
270
- cy.get(containerSelector).click().type(optionText);
271
- cy.contains(commonSelectors.selectOption, optionText).invoke("click");
272
- });
273
- Cypress.Commands.add("clickDropdownOption", function (optionText) {
274
- var dropdownSelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : commonSelectors.dropdownIcon;
275
- cy.get(dropdownSelector).click();
276
- cy.get(commonSelectors.dropdownContainer).contains(optionText).invoke("click");
277
- });
278
- Cypress.Commands.add("getText", function (selector) {
279
- return cy.get(selector).invoke("text");
280
- });
281
- Cypress.Commands.add("getValue", function (selector) {
282
- return cy.get(selector).invoke("val");
283
- });
284
- Cypress.Commands.add("getIframe", function (iframeSelector) {
285
- return cy.get(iframeSelector).its("0.contentDocument.body").should("not.be.empty");
286
- });
287
- Cypress.Commands.add("openInSameTabOnClick", function (_ref) {
288
- var url = _ref.url,
289
- alias = _ref.alias,
290
- selector = _ref.selector;
291
- cy.window().then(function (win) {
292
- cy.stub(win, "open").as(alias).callsFake(function (newUrl) {
293
- return win.location.href = newUrl;
229
+ Cypress.Commands.add("continueOnAlert", function (args) {
230
+ var props = _typeof(args) === "object" ? args : {
231
+ alias: args
232
+ };
233
+ var alias = props.alias,
234
+ title = props.title,
235
+ _props$requestCount = props.requestCount,
236
+ requestCount = _props$requestCount === void 0 ? 1 : _props$requestCount,
237
+ verifyToastIcon = props.verifyToastIcon,
238
+ toastMessage = props.toastMessage;
239
+ var hasMoreThanOneRequest = requestCount > 1;
240
+ title && cy.get(commonSelectors.alertTitle).should("have.text", title);
241
+ cy.interceptApi(alias, requestCount);
242
+ cy.get(commonSelectors.alertModalSubmitButton).click();
243
+ cy.wait("@".concat(alias));
244
+ verifyToastIcon && cy.verifyToastIcon();
245
+ toastMessage && cy.verifyToastMessage(toastMessage);
246
+ hasMoreThanOneRequest && cy.waitForMultipleRequest("@".concat(alias), requestCount - 1);
247
+ });
248
+ Cypress.Commands.add("interceptApi", function (alias) {
249
+ var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
250
+ return cy.intercept({
251
+ url: requestApis.allPath,
252
+ times: times
253
+ }).as(alias);
254
+ });
255
+ Cypress.Commands.add("waitForMultipleRequest", function (alias) {
256
+ var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
257
+ return cy.wrap(_toConsumableArray(new Array(times))).each(function () {
258
+ return cy.wait(alias);
294
259
  });
295
260
  });
296
- cy.get(selector).click();
297
- cy.get("@".concat(alias)).should("be.called");
298
- cy.url().should("include", url);
299
- });
300
- Cypress.Commands.add("globalState", function (key) {
301
- return cy.task("getGlobalState", key);
302
- });
303
- Cypress.Commands.add("ifExist", function (selector, callback) {
304
- cy.get(commonSelectors.body).then(function ($body) {
305
- if ($body.find(selector).length) callback();
261
+ Cypress.Commands.add("apiRequest", function (options) {
262
+ return cy.get("@requestHeaders").then(function (requestHeaders) {
263
+ return requestHeaders ? cy.request(_objectSpread(_objectSpread({}, options), {}, {
264
+ headers: requestHeaders
265
+ })) : cy.log("No request headers found");
266
+ });
306
267
  });
307
- });
308
- Cypress.Commands.add("ifNotExist", function (selector, callback) {
309
- cy.get(commonSelectors.body).then(function ($body) {
310
- if (!$body.find(selector).length) callback();
268
+ Cypress.Commands.add("reloadAndWait", function () {
269
+ var requestCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
270
+ if (requestCount > 0) {
271
+ cy.interceptApi("reloadAllRequests", requestCount);
272
+ cy.reload();
273
+ cy.waitForMultipleRequest("@reloadAllRequests", requestCount);
274
+ }
311
275
  });
312
- });
276
+ Cypress.Commands.add("selectOption", function (containerSelector, optionText) {
277
+ cy.get(containerSelector).click().type(optionText);
278
+ cy.contains(commonSelectors.selectOption, optionText).invoke("click");
279
+ });
280
+ Cypress.Commands.add("clickDropdownOption", function (optionText) {
281
+ var dropdownSelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : commonSelectors.dropdownIcon;
282
+ cy.get(dropdownSelector).click();
283
+ cy.get(commonSelectors.dropdownContainer).contains(optionText).invoke("click");
284
+ });
285
+ Cypress.Commands.add("getText", function (selector) {
286
+ return cy.get(selector).invoke("text");
287
+ });
288
+ Cypress.Commands.add("getValue", function (selector) {
289
+ return cy.get(selector).invoke("val");
290
+ });
291
+ Cypress.Commands.add("getIframe", function (iframeSelector) {
292
+ return cy.get(iframeSelector).its("0.contentDocument.body").should("not.be.empty");
293
+ });
294
+ Cypress.Commands.add("openInSameTabOnClick", function (_ref) {
295
+ var url = _ref.url,
296
+ alias = _ref.alias,
297
+ selector = _ref.selector;
298
+ cy.window().then(function (win) {
299
+ cy.stub(win, "open").as(alias).callsFake(function (newUrl) {
300
+ return win.location.href = newUrl;
301
+ });
302
+ });
303
+ cy.get(selector).click();
304
+ cy.get("@".concat(alias)).should("be.called");
305
+ cy.url().should("include", url);
306
+ });
307
+ Cypress.Commands.add("globalState", function (key) {
308
+ return cy.task("getGlobalState", key);
309
+ });
310
+ Cypress.Commands.add("ifExist", function (selector, callback) {
311
+ cy.get(commonSelectors.body).then(function ($body) {
312
+ if ($body.find(selector).length) callback();
313
+ });
314
+ });
315
+ Cypress.Commands.add("ifNotExist", function (selector, callback) {
316
+ cy.get(commonSelectors.body).then(function ($body) {
317
+ if (!$body.find(selector).length) callback();
318
+ });
319
+ });
320
+ };
313
321
 
314
322
  var loginSelectors = {
315
323
  appleAuthenticationButton: dataCy("apple-authentication-button"),
@@ -356,7 +364,8 @@ var signUpSelectors = {
356
364
  signupViaEmailButton: dataCy("signup-via-email-button"),
357
365
  submitButton: dataCy("signup-email-submit-button"),
358
366
  subdomainNameTextField: dataCy("signup-organization-subdomain-text-field"),
359
- subdomainError: dataCy("subdomain-input-error")
367
+ subdomainError: dataCy("subdomain-input-error"),
368
+ tryFreeButton: dataCy("neeto-auth-signup-link")
360
369
  };
361
370
 
362
371
  var commonTexts = {
@@ -372,7 +381,8 @@ var commonTexts = {
372
381
  logout: "Log out",
373
382
  "new": "New",
374
383
  takeAction: "Take action",
375
- unblock: "Unblock"
384
+ unblock: "Unblock",
385
+ toastIcon: "👍"
376
386
  };
377
387
 
378
388
  var memberTexts = {
@@ -695,7 +705,7 @@ var memberUtils = {
695
705
  verifyMemberDetails: verifyMemberDetails
696
706
  };
697
707
 
698
- var updateSubdmainIfExit = function updateSubdmainIfExit(subdomainName) {
708
+ var updateSubdmainIfExit = function updateSubdmainIfExit(appName, subdomainName) {
699
709
  cy.ifExist(signUpSelectors.subdomainError, function () {
700
710
  var lastDigit = Number(subdomainName.charAt(subdomainName.length - 1));
701
711
  var newOrganizationName = subdomainName.slice(0, -1) + (lastDigit + 1);
@@ -714,9 +724,7 @@ var updateSubdmainIfExit = function updateSubdmainIfExit(subdomainName) {
714
724
  key: "businessName",
715
725
  value: newOrganizationName
716
726
  });
717
- var baseUrl = Cypress.config("baseUrl");
718
- var domain = baseUrl.split(".")[1];
719
- var newBaseUrl = "https://".concat(newOrganizationName, ".").concat(domain, ".net");
727
+ var newBaseUrl = "https://".concat(newOrganizationName, ".").concat(appName, ".net");
720
728
  Cypress.config("baseUrl", newBaseUrl);
721
729
  cy.clearAndType(signUpSelectors.organizationNameTextField, newOrganizationName);
722
730
  });
@@ -731,10 +739,15 @@ var createOrganization = function createOrganization(_ref) {
731
739
  subdomainName = _ref.subdomainName,
732
740
  firstName = _ref.firstName,
733
741
  lastName = _ref.lastName,
734
- baseUrl = _ref.baseUrl;
742
+ appName = _ref.appName;
735
743
  var otp = "123456";
736
- cy.visit(baseUrl);
737
- cy.contains(signUpTexts.tryItFree).click();
744
+ var appNameInLowerCase = appName.toLowerCase();
745
+ var isNeetoAuth = appNameInLowerCase === "neetoauth";
746
+ if (isNeetoAuth) cy.visit("https://app.neetoauth.net/signups/new");else {
747
+ var startingUrl = "https://www.neeto.com/".concat(appNameInLowerCase, "?env=staging");
748
+ cy.visit(startingUrl);
749
+ cy.get(signUpSelectors.tryFreeButton).invoke("removeAttr", "target").click();
750
+ }
738
751
  cy.get(signUpSelectors.signupViaEmailButton).should("contain.text", signUpTexts.email).click();
739
752
  cy.clearAndType(signUpSelectors.emailTextField, email);
740
753
  cy.intercept({
@@ -752,7 +765,7 @@ var createOrganization = function createOrganization(_ref) {
752
765
  cy.clearAndType(signUpSelectors.organizationNameTextField, businessName);
753
766
  cy.clearAndType(signUpSelectors.subdomainNameTextField, subdomainName);
754
767
  cy.wait("@subdomainRequest");
755
- updateSubdmainIfExit(subdomainName);
768
+ updateSubdmainIfExit(appNameInLowerCase, subdomainName);
756
769
  cy.intercept({
757
770
  url: requestApis.signUp,
758
771
  times: 1
@@ -794,6 +807,7 @@ exports.dateUtils = dateUtils;
794
807
  exports.environment = environment;
795
808
  exports.getTestTitle = getTestTitle;
796
809
  exports.getUrl = getUrl;
810
+ exports.initCustomCommands = initCustomCommands;
797
811
  exports.initializeCredentials = initializeCredentials;
798
812
  exports.isStagingEnv = isStagingEnv;
799
813
  exports.joinHyphenCase = joinHyphenCase;
@@ -141,6 +141,8 @@ function futureDate(numberOfDays: number = 1): String;
141
141
  function pastDate(numberOfDays: number = 1): String;
142
142
 
143
143
  // Utils: common
144
+ export function initCustomCommands(): Void;
145
+
144
146
  export function dataCy(dataCyId: string): String;
145
147
 
146
148
  export function getTestTitle(): String;
@@ -166,7 +168,7 @@ export function verifyListCount(countSelector: string, count: number): String;
166
168
 
167
169
  // Utils: organization
168
170
  export function createOrganization(props: {
169
- baseUrl: string;
171
+ appName: string;
170
172
  businessName: string;
171
173
  email: string;
172
174
  firstName: string;