@memlab/e2e 1.0.32 → 1.0.33
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2EInteractionManager.d.ts","sourceRoot":"","sources":["../src/E2EInteractionManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EACV,WAAW,EAKX,QAAQ,EACR,aAAa,EAEb,YAAY,EACb,MAAM,cAAc,CAAC;AAOtB,OAA2B,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAM7E,KAAK,mBAAmB,GAAG;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;
|
|
1
|
+
{"version":3,"file":"E2EInteractionManager.d.ts","sourceRoot":"","sources":["../src/E2EInteractionManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EACV,WAAW,EAKX,QAAQ,EACR,aAAa,EAEb,YAAY,EACb,MAAM,cAAc,CAAC;AAOtB,OAA2B,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAM7E,KAAK,mBAAmB,GAAG;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAmCF,MAAM,CAAC,OAAO,OAAO,qBAAqB;IACxC,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,qBAAqB,CAA4B;IACzD,OAAO,CAAC,cAAc,CAAiB;gBAE3B,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO;IAM3B,mBAAmB,IAAI,OAAO,CAAC,UAAU,CAAC;IAsB1C,uBAAuB,IAAI,OAAO,CAAC,UAAU,CAAC;IAQ9C,gBAAgB,CAC3B,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,GAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IASzB,eAAe,IAAI,IAAI;IAIvB,wBAAwB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI;cAI/C,WAAW,CACzB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,aAAkB,GACzB,OAAO,CAAC,IAAI,CAAC;YAmBF,kBAAkB;IAgBnB,oBAAoB,CAC/B,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC;IAgEH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;YA4C5B,SAAS;YAeT,iBAAiB;YAyEjB,gBAAgB;YAoBhB,iBAAiB;YAQjB,+BAA+B;IA0C7C,OAAO,CAAC,cAAc;YAeR,sBAAsB;YActB,MAAM;YAeN,iBAAiB;YAUjB,cAAc;CA4B7B"}
|
|
@@ -312,11 +312,11 @@ class E2EInteractionManager {
|
|
|
312
312
|
return __awaiter(this, void 0, void 0, function* () {
|
|
313
313
|
const writeStream = fs_1.default.createWriteStream(file, { encoding: 'UTF-8' });
|
|
314
314
|
let lastChunk = '';
|
|
315
|
-
const dataHandler =
|
|
315
|
+
const dataHandler = data => {
|
|
316
316
|
writeStream.write(data.chunk);
|
|
317
317
|
lastChunk = data.chunk;
|
|
318
318
|
};
|
|
319
|
-
const progressHandler =
|
|
319
|
+
const progressHandler = data => {
|
|
320
320
|
const percent = ((100 * data.done) / data.total) | 0;
|
|
321
321
|
if (!core_1.config.isContinuousTest) {
|
|
322
322
|
core_1.info.overwrite(`heap snapshot ${percent}% complete`);
|
|
@@ -330,11 +330,22 @@ class E2EInteractionManager {
|
|
|
330
330
|
captureNumericValue: true,
|
|
331
331
|
});
|
|
332
332
|
checkLastSnapshotChunk(lastChunk);
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
this.removeListener(session, 'HeapProfiler.addHeapSnapshotChunk', dataHandler);
|
|
334
|
+
this.removeListener(session, 'HeapProfiler.reportHeapSnapshotProgress', progressHandler);
|
|
335
335
|
writeStream.end();
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
|
+
// this implement may remove all dataHandler of the specified eventType
|
|
339
|
+
removeListener(session, eventType, dataHandler) {
|
|
340
|
+
if (typeof session.removeListener === 'function') {
|
|
341
|
+
session.removeListener(eventType, dataHandler);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (typeof session.removeAllListeners === 'function') {
|
|
345
|
+
session.removeAllListeners(eventType);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
338
349
|
saveHeapSnapshotToFile(file) {
|
|
339
350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
340
351
|
core_1.info.beginSection('heap snapshot');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractionUtils.d.ts","sourceRoot":"","sources":["../../../src/lib/operations/InteractionUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,KAAK,EAAC,IAAI,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"InteractionUtils.d.ts","sourceRoot":"","sources":["../../../src/lib/operations/InteractionUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,KAAK,EAAC,IAAI,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EAEd,MAAM,cAAc,CAAC;AAEtB,iBAAS,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI7C;AAED,iBAAe,4BAA4B,CACzC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,qBAAqB,EACnC,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CA8Cf;AAED,iBAAe,eAAe,CAC5B,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAwBf;AAED,iBAAe,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO1E;AASD,iBAAe,eAAe,CAC5B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,yBAAyB,SAAU,EACnC,QAAQ,UAAQ,GACf,OAAO,CAAC,OAAO,CAAC,CAyClB;AAmBD,iBAAe,cAAc,CAC3B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,QAAQ,UAAQ,GACf,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,iBAAe,cAAc,CAC3B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,QAAQ,UAAQ,GACf,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,iBAAe,oBAAoB,CACjC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,QAAQ,UAAQ,GACf,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,iBAAe,yBAAyB,CACtC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAGnC;;;;;;;;;;;;AAkDD,wBAUE"}
|
|
@@ -190,8 +190,38 @@ function waitForDisappearance(page, selector, optional = false) {
|
|
|
190
190
|
function getElementsContainingText(page, text) {
|
|
191
191
|
return __awaiter(this, void 0, void 0, function* () {
|
|
192
192
|
const xpath = `//*[not(self::script)][contains(text(), '${text}')]`;
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
return findBySelector(page, xpath);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function findBySelector(page, xpath) {
|
|
197
|
+
var _a;
|
|
198
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const _page = page;
|
|
200
|
+
if (typeof _page.$x === 'function') {
|
|
201
|
+
return ((_a = (yield _page.$x(xpath))) !== null && _a !== void 0 ? _a : []);
|
|
202
|
+
}
|
|
203
|
+
// evaluate in browser and return the result as a JSHandle
|
|
204
|
+
// to an array of elements in the browser's context
|
|
205
|
+
const elements = yield page.evaluateHandle(xpath => {
|
|
206
|
+
const xpathResult = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
|
|
207
|
+
const nodes = [];
|
|
208
|
+
let node = xpathResult.iterateNext();
|
|
209
|
+
while (node) {
|
|
210
|
+
nodes.push(node);
|
|
211
|
+
node = xpathResult.iterateNext();
|
|
212
|
+
}
|
|
213
|
+
return nodes;
|
|
214
|
+
}, xpath);
|
|
215
|
+
// Convert the elements to ElementHandle<Element>[]
|
|
216
|
+
const elementHandles = yield elements.getProperties();
|
|
217
|
+
const ret = [];
|
|
218
|
+
for (const elementHandle of elementHandles.values()) {
|
|
219
|
+
const element = elementHandle.asElement();
|
|
220
|
+
if (element != null) {
|
|
221
|
+
ret.push(element);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return ret;
|
|
195
225
|
});
|
|
196
226
|
}
|
|
197
227
|
exports.default = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memlab/e2e",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "memlab browser E2E interaction libraries",
|
|
6
6
|
"author": "Liang Gong <lgong@fb.com>",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"@babel/parser": "^7.16.4",
|
|
26
26
|
"@babel/template": "^7.16.0",
|
|
27
27
|
"@babel/traverse": "^7.16.3",
|
|
28
|
-
"@memlab/core": "^1.1.
|
|
28
|
+
"@memlab/core": "^1.1.33",
|
|
29
29
|
"ansi": "^0.3.1",
|
|
30
30
|
"babar": "^0.2.0",
|
|
31
31
|
"chalk": "^4.0.0",
|
|
32
32
|
"fs-extra": "^4.0.2",
|
|
33
33
|
"minimist": "^1.2.8",
|
|
34
|
-
"puppeteer": "^
|
|
35
|
-
"puppeteer-core": "^
|
|
34
|
+
"puppeteer": "^22.12.1",
|
|
35
|
+
"puppeteer-core": "^22.12.1",
|
|
36
36
|
"string-width": "^4.2.0",
|
|
37
37
|
"util.promisify": "^1.1.1",
|
|
38
38
|
"xvfb": "^0.4.0"
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"@types/jest": "^27.4.1",
|
|
45
45
|
"@types/minimist": "^1.2.5",
|
|
46
46
|
"@types/node": "^12.16.3",
|
|
47
|
-
"@types/puppeteer": "^5.4.4",
|
|
48
47
|
"jest": "^29.6.2",
|
|
49
48
|
"ts-jest": "^29.1.1",
|
|
50
49
|
"typescript": "^4.6.3"
|