@bigbinary/neeto-playwright-commons 1.19.0 → 1.19.2

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/index.cjs.js CHANGED
@@ -49,6 +49,36 @@ function _interopNamespaceDefault(e) {
49
49
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs$d);
50
50
  var Path__namespace = /*#__PURE__*/_interopNamespaceDefault(Path);
51
51
 
52
+ let MemberApis$1 = class MemberApis {
53
+ constructor(neetoPlaywrightUtilities) {
54
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
55
+ this.create = (body) => this.neetoPlaywrightUtilities.apiRequest({
56
+ method: "post",
57
+ url: this.teamsBaseUrl,
58
+ body: { user: body },
59
+ });
60
+ this.jobStatus = (jobId) => this.neetoPlaywrightUtilities.apiRequest({
61
+ url: `${this.teamsBaseUrl}/creation_status/${jobId}`,
62
+ });
63
+ this.fetch = (params) => this.neetoPlaywrightUtilities.apiRequest({
64
+ method: "get",
65
+ url: this.teamsBaseUrl,
66
+ params,
67
+ });
68
+ this.update = (memberId, body) => this.neetoPlaywrightUtilities.apiRequest({
69
+ method: "put",
70
+ url: `${this.teamsBaseUrl}/${memberId}`,
71
+ body: { team: body },
72
+ });
73
+ this.bulkUpdate = (body) => this.neetoPlaywrightUtilities.apiRequest({
74
+ method: "patch",
75
+ url: `${this.teamsBaseUrl}/bulk_update`,
76
+ body: { users: body },
77
+ });
78
+ this.teamsBaseUrl = "/team_members/teams";
79
+ }
80
+ };
81
+
52
82
  const ENVIRONMENT = {
53
83
  development: "development",
54
84
  staging: "staging",
@@ -761,6 +791,53 @@ const API_KEYS_SELECTORS = {
761
791
  addApiKeyButton: "add-api-key-button",
762
792
  };
763
793
 
794
+ const mimeTypeMap = {
795
+ csv: "text/csv",
796
+ avi: "video/x-msvideo",
797
+ doc: "application/msword",
798
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
799
+ flv: "video/x-flv",
800
+ html: "text/html",
801
+ mp3: "audio/mpeg",
802
+ mp4: "video/mp4",
803
+ mpg: "video/mpeg",
804
+ pdf: "application/pdf",
805
+ rtf: "application/rtf",
806
+ txt: "text/plain",
807
+ webm: "video/webm",
808
+ xls: "application/vnd.ms-excel",
809
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
810
+ wma: "audio/x-ms-wma",
811
+ zip: "application/zip",
812
+ jpg: "image/jpeg",
813
+ jpeg: "image/jpeg",
814
+ png: "image/png",
815
+ gif: "image/gif",
816
+ };
817
+ const fillRandomBytes = (byteArray) => {
818
+ const CHUNK_SIZE = 65536; //Maximum allowed per call by crypto.getRandomValues.
819
+ for (let i = 0; i < byteArray.length; i += CHUNK_SIZE) {
820
+ crypto.getRandomValues(byteArray.subarray(i, i + CHUNK_SIZE));
821
+ }
822
+ };
823
+ const serializeFileForBrowser = async (file) => {
824
+ const buffer = await file.arrayBuffer();
825
+ return {
826
+ name: file.name,
827
+ type: file.type,
828
+ lastModified: file.lastModified,
829
+ buffer: Array.from(new Uint8Array(buffer)),
830
+ };
831
+ };
832
+ const generateRandomFile = ({ sizeInKB, fileType, fileName = `sample.${fileType}`, }) => {
833
+ const mimeType = mimeTypeMap[fileType];
834
+ const byteArray = new Uint8Array(sizeInKB * 1024);
835
+ fillRandomBytes(byteArray);
836
+ const blob = new Blob([byteArray], { type: mimeType });
837
+ const file = new File([blob], fileName, { type: mimeType });
838
+ return { file, fileName };
839
+ };
840
+
764
841
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
765
842
 
766
843
  function getDefaultExportFromCjs (x) {
@@ -4096,6 +4173,25 @@ class CustomCommands {
4096
4173
  await test$1.expect(tooltip).toHaveCount(0);
4097
4174
  }).toPass({ timeout: 30000 });
4098
4175
  };
4176
+ this.verifyBreadcrumbs = async (titlesAndRoutes) => {
4177
+ const breadcrumbHeader = this.page.getByTestId(COMMON_SELECTORS.breadcrumbHeader);
4178
+ await test$1.expect(breadcrumbHeader).toHaveCount(titlesAndRoutes.length);
4179
+ await Promise.all(titlesAndRoutes.map(({ title, route }) => test$1.expect(breadcrumbHeader.getByRole("link", {
4180
+ name: title,
4181
+ exact: true,
4182
+ })).toHaveAttribute("href", route)));
4183
+ };
4184
+ this.uploadFileViaDispatchV2 = async ({ droppableZone = this.page.getByTestId(COMMON_SELECTORS.fileUploadBody), dispatchEvent = "drop", file, }) => {
4185
+ const serializedFile = await serializeFileForBrowser(file);
4186
+ const dataTransfer = await droppableZone.evaluateHandle(async (_, { name, type, buffer, lastModified }) => {
4187
+ const uint8Array = new Uint8Array(buffer);
4188
+ const file = new File([uint8Array], name, { type, lastModified });
4189
+ const dataTransfer = new DataTransfer();
4190
+ dataTransfer.items.add(file);
4191
+ return dataTransfer;
4192
+ }, serializedFile);
4193
+ await droppableZone.dispatchEvent(dispatchEvent, { dataTransfer });
4194
+ };
4099
4195
  this.page = page;
4100
4196
  this.responses = [];
4101
4197
  this.request = request;
@@ -35526,7 +35622,7 @@ var punycode_es6 = /*#__PURE__*/Object.freeze({
35526
35622
 
35527
35623
  var require$$4$1 = /*@__PURE__*/getAugmentedNamespace(punycode_es6);
35528
35624
 
35529
- const crypto$1 = require$$0$5;
35625
+ const crypto$2 = require$$0$5;
35530
35626
  const Transform$1 = Stream$4.Transform;
35531
35627
 
35532
35628
  let StreamHash$1 = class StreamHash extends Transform$1 {
@@ -35534,7 +35630,7 @@ let StreamHash$1 = class StreamHash extends Transform$1 {
35534
35630
  super();
35535
35631
  this.attachment = attachment;
35536
35632
  this.algo = (algo || 'md5').toLowerCase();
35537
- this.hash = crypto$1.createHash(algo);
35633
+ this.hash = crypto$2.createHash(algo);
35538
35634
  this.byteCount = 0;
35539
35635
  }
35540
35636
 
@@ -61692,6 +61788,9 @@ const tableUtils = {
61692
61788
  verifyFreezeColumnAction,
61693
61789
  };
61694
61790
 
61791
+ /**
61792
+ * @deprecated This method is deprecated. Use verifyBreadcrumbs from neetoPlaywrightUtilities instead.
61793
+ */
61695
61794
  const verifyBreadcrumbs = async ({ page, titlesAndRoutes, }) => {
61696
61795
  await test$1.expect(page.getByTestId(COMMON_SELECTORS.breadcrumbHeader)).toHaveCount(titlesAndRoutes.length);
61697
61796
  await Promise.all(titlesAndRoutes.map(({ title, route }) => test$1.expect(page.getByTestId(COMMON_SELECTORS.breadcrumbHeader).getByRole("link", {
@@ -143149,7 +143248,7 @@ const Readable = Stream$4.Readable;
143149
143248
  const BUFFER = Symbol('buffer');
143150
143249
  const TYPE = Symbol('type');
143151
143250
 
143152
- class Blob {
143251
+ let Blob$1 = class Blob {
143153
143252
  constructor() {
143154
143253
  this[TYPE] = '';
143155
143254
 
@@ -143240,15 +143339,15 @@ class Blob {
143240
143339
  blob[BUFFER] = slicedBuffer;
143241
143340
  return blob;
143242
143341
  }
143243
- }
143342
+ };
143244
143343
 
143245
- Object.defineProperties(Blob.prototype, {
143344
+ Object.defineProperties(Blob$1.prototype, {
143246
143345
  size: { enumerable: true },
143247
143346
  type: { enumerable: true },
143248
143347
  slice: { enumerable: true }
143249
143348
  });
143250
143349
 
143251
- Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
143350
+ Object.defineProperty(Blob$1.prototype, Symbol.toStringTag, {
143252
143351
  value: 'Blob',
143253
143352
  writable: false,
143254
143353
  enumerable: false,
@@ -143380,7 +143479,7 @@ Body.prototype = {
143380
143479
  return consumeBody.call(this).then(function (buf) {
143381
143480
  return Object.assign(
143382
143481
  // Prevent copying
143383
- new Blob([], {
143482
+ new Blob$1([], {
143384
143483
  type: ct.toLowerCase()
143385
143484
  }), {
143386
143485
  [BUFFER]: buf
@@ -194197,7 +194296,7 @@ var require$$4 = {
194197
194296
  const fs = fs$d;
194198
194297
  const path = Path;
194199
194298
  const os = require$$0$6;
194200
- const crypto = require$$0$5;
194299
+ const crypto$1 = require$$0$5;
194201
194300
  const packageJson = require$$4;
194202
194301
 
194203
194302
  const version = packageJson.version;
@@ -194483,7 +194582,7 @@ function decrypt (encrypted, keyStr) {
194483
194582
  ciphertext = ciphertext.subarray(12, -16);
194484
194583
 
194485
194584
  try {
194486
- const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
194585
+ const aesgcm = crypto$1.createDecipheriv('aes-256-gcm', key, nonce);
194487
194586
  aesgcm.setAuthTag(authTag);
194488
194587
  return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
194489
194588
  } catch (error) {
@@ -194789,6 +194888,7 @@ exports.MEMBER_TEXTS = MEMBER_TEXTS;
194789
194888
  exports.MERGE_TAGS_SELECTORS = MERGE_TAGS_SELECTORS;
194790
194889
  exports.MailerUtils = MailerUtils;
194791
194890
  exports.Member = Member;
194891
+ exports.MemberApis = MemberApis$1;
194792
194892
  exports.NEETO_AUTH_BASE_URL = NEETO_AUTH_BASE_URL;
194793
194893
  exports.NEETO_EDITOR_SELECTORS = NEETO_EDITOR_SELECTORS;
194794
194894
  exports.NEETO_FILTERS_SELECTORS = NEETO_FILTERS_SELECTORS;
@@ -194846,6 +194946,7 @@ exports.executeWithThrottledResources = executeWithThrottledResources;
194846
194946
  exports.extractSubdomainFromError = extractSubdomainFromError;
194847
194947
  exports.filterUtils = filterUtils;
194848
194948
  exports.generateRandomBypassEmail = generateRandomBypassEmail;
194949
+ exports.generateRandomFile = generateRandomFile;
194849
194950
  exports.generateStagingData = generateStagingData;
194850
194951
  exports.getByDataQA = getByDataQA;
194851
194952
  exports.getGlobalUserState = getGlobalUserState;
@@ -194867,6 +194968,7 @@ exports.networkConditions = networkConditions;
194867
194968
  exports.networkThrottlingUsingCDP = networkThrottlingUsingCDP;
194868
194969
  exports.readFileSyncIfExists = readFileSyncIfExists;
194869
194970
  exports.removeCredentialFile = removeCredentialFile;
194971
+ exports.serializeFileForBrowser = serializeFileForBrowser;
194870
194972
  exports.shouldSkipSetupAndTeardown = shouldSkipSetupAndTeardown;
194871
194973
  exports.simulateClickWithDelay = simulateClickWithDelay;
194872
194974
  exports.simulateTypingWithDelay = simulateTypingWithDelay;