@bigbinary/neeto-playwright-commons 1.19.1 → 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 +80 -9
- package/index.cjs.js.map +1 -1
- package/index.d.ts +135 -1
- package/index.js +79 -10
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -791,6 +791,53 @@ const API_KEYS_SELECTORS = {
|
|
|
791
791
|
addApiKeyButton: "add-api-key-button",
|
|
792
792
|
};
|
|
793
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
|
+
|
|
794
841
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
795
842
|
|
|
796
843
|
function getDefaultExportFromCjs (x) {
|
|
@@ -4126,6 +4173,25 @@ class CustomCommands {
|
|
|
4126
4173
|
await test$1.expect(tooltip).toHaveCount(0);
|
|
4127
4174
|
}).toPass({ timeout: 30000 });
|
|
4128
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
|
+
};
|
|
4129
4195
|
this.page = page;
|
|
4130
4196
|
this.responses = [];
|
|
4131
4197
|
this.request = request;
|
|
@@ -35556,7 +35622,7 @@ var punycode_es6 = /*#__PURE__*/Object.freeze({
|
|
|
35556
35622
|
|
|
35557
35623
|
var require$$4$1 = /*@__PURE__*/getAugmentedNamespace(punycode_es6);
|
|
35558
35624
|
|
|
35559
|
-
const crypto$
|
|
35625
|
+
const crypto$2 = require$$0$5;
|
|
35560
35626
|
const Transform$1 = Stream$4.Transform;
|
|
35561
35627
|
|
|
35562
35628
|
let StreamHash$1 = class StreamHash extends Transform$1 {
|
|
@@ -35564,7 +35630,7 @@ let StreamHash$1 = class StreamHash extends Transform$1 {
|
|
|
35564
35630
|
super();
|
|
35565
35631
|
this.attachment = attachment;
|
|
35566
35632
|
this.algo = (algo || 'md5').toLowerCase();
|
|
35567
|
-
this.hash = crypto$
|
|
35633
|
+
this.hash = crypto$2.createHash(algo);
|
|
35568
35634
|
this.byteCount = 0;
|
|
35569
35635
|
}
|
|
35570
35636
|
|
|
@@ -61722,6 +61788,9 @@ const tableUtils = {
|
|
|
61722
61788
|
verifyFreezeColumnAction,
|
|
61723
61789
|
};
|
|
61724
61790
|
|
|
61791
|
+
/**
|
|
61792
|
+
* @deprecated This method is deprecated. Use verifyBreadcrumbs from neetoPlaywrightUtilities instead.
|
|
61793
|
+
*/
|
|
61725
61794
|
const verifyBreadcrumbs = async ({ page, titlesAndRoutes, }) => {
|
|
61726
61795
|
await test$1.expect(page.getByTestId(COMMON_SELECTORS.breadcrumbHeader)).toHaveCount(titlesAndRoutes.length);
|
|
61727
61796
|
await Promise.all(titlesAndRoutes.map(({ title, route }) => test$1.expect(page.getByTestId(COMMON_SELECTORS.breadcrumbHeader).getByRole("link", {
|
|
@@ -143179,7 +143248,7 @@ const Readable = Stream$4.Readable;
|
|
|
143179
143248
|
const BUFFER = Symbol('buffer');
|
|
143180
143249
|
const TYPE = Symbol('type');
|
|
143181
143250
|
|
|
143182
|
-
class Blob {
|
|
143251
|
+
let Blob$1 = class Blob {
|
|
143183
143252
|
constructor() {
|
|
143184
143253
|
this[TYPE] = '';
|
|
143185
143254
|
|
|
@@ -143270,15 +143339,15 @@ class Blob {
|
|
|
143270
143339
|
blob[BUFFER] = slicedBuffer;
|
|
143271
143340
|
return blob;
|
|
143272
143341
|
}
|
|
143273
|
-
}
|
|
143342
|
+
};
|
|
143274
143343
|
|
|
143275
|
-
Object.defineProperties(Blob.prototype, {
|
|
143344
|
+
Object.defineProperties(Blob$1.prototype, {
|
|
143276
143345
|
size: { enumerable: true },
|
|
143277
143346
|
type: { enumerable: true },
|
|
143278
143347
|
slice: { enumerable: true }
|
|
143279
143348
|
});
|
|
143280
143349
|
|
|
143281
|
-
Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
|
|
143350
|
+
Object.defineProperty(Blob$1.prototype, Symbol.toStringTag, {
|
|
143282
143351
|
value: 'Blob',
|
|
143283
143352
|
writable: false,
|
|
143284
143353
|
enumerable: false,
|
|
@@ -143410,7 +143479,7 @@ Body.prototype = {
|
|
|
143410
143479
|
return consumeBody.call(this).then(function (buf) {
|
|
143411
143480
|
return Object.assign(
|
|
143412
143481
|
// Prevent copying
|
|
143413
|
-
new Blob([], {
|
|
143482
|
+
new Blob$1([], {
|
|
143414
143483
|
type: ct.toLowerCase()
|
|
143415
143484
|
}), {
|
|
143416
143485
|
[BUFFER]: buf
|
|
@@ -194227,7 +194296,7 @@ var require$$4 = {
|
|
|
194227
194296
|
const fs = fs$d;
|
|
194228
194297
|
const path = Path;
|
|
194229
194298
|
const os = require$$0$6;
|
|
194230
|
-
const crypto = require$$0$5;
|
|
194299
|
+
const crypto$1 = require$$0$5;
|
|
194231
194300
|
const packageJson = require$$4;
|
|
194232
194301
|
|
|
194233
194302
|
const version = packageJson.version;
|
|
@@ -194513,7 +194582,7 @@ function decrypt (encrypted, keyStr) {
|
|
|
194513
194582
|
ciphertext = ciphertext.subarray(12, -16);
|
|
194514
194583
|
|
|
194515
194584
|
try {
|
|
194516
|
-
const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
|
|
194585
|
+
const aesgcm = crypto$1.createDecipheriv('aes-256-gcm', key, nonce);
|
|
194517
194586
|
aesgcm.setAuthTag(authTag);
|
|
194518
194587
|
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
|
|
194519
194588
|
} catch (error) {
|
|
@@ -194877,6 +194946,7 @@ exports.executeWithThrottledResources = executeWithThrottledResources;
|
|
|
194877
194946
|
exports.extractSubdomainFromError = extractSubdomainFromError;
|
|
194878
194947
|
exports.filterUtils = filterUtils;
|
|
194879
194948
|
exports.generateRandomBypassEmail = generateRandomBypassEmail;
|
|
194949
|
+
exports.generateRandomFile = generateRandomFile;
|
|
194880
194950
|
exports.generateStagingData = generateStagingData;
|
|
194881
194951
|
exports.getByDataQA = getByDataQA;
|
|
194882
194952
|
exports.getGlobalUserState = getGlobalUserState;
|
|
@@ -194898,6 +194968,7 @@ exports.networkConditions = networkConditions;
|
|
|
194898
194968
|
exports.networkThrottlingUsingCDP = networkThrottlingUsingCDP;
|
|
194899
194969
|
exports.readFileSyncIfExists = readFileSyncIfExists;
|
|
194900
194970
|
exports.removeCredentialFile = removeCredentialFile;
|
|
194971
|
+
exports.serializeFileForBrowser = serializeFileForBrowser;
|
|
194901
194972
|
exports.shouldSkipSetupAndTeardown = shouldSkipSetupAndTeardown;
|
|
194902
194973
|
exports.simulateClickWithDelay = simulateClickWithDelay;
|
|
194903
194974
|
exports.simulateTypingWithDelay = simulateTypingWithDelay;
|