@memlab/e2e 2.0.5 → 2.0.6
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 +3 -3
- package/dist/E2EInteractionManager.js +1 -1
- package/dist/NetworkManager.d.ts +2 -3
- package/dist/NetworkManager.d.ts.map +1 -1
- package/dist/NetworkManager.js +1 -2
- package/dist/code-analysis/Script.d.ts +0 -2
- package/dist/code-analysis/Script.d.ts.map +1 -1
- package/dist/code-analysis/Script.js +1 -17
- package/dist/lib/E2EUtils.d.ts.map +1 -1
- package/dist/lib/E2EUtils.js +0 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
## memlab E2E
|
|
2
2
|
|
|
3
3
|
This is the memlab E2E testing framework for headless/headful Chromium. It is mainly responsible
|
|
4
|
-
for
|
|
4
|
+
for controlling/interacting with browser, recording heap snapshots, and logging other execution metadata.
|
|
5
5
|
|
|
6
6
|
## Online Resources
|
|
7
|
-
* [Official Website and Demo](https://
|
|
8
|
-
* [Documentation](https://
|
|
7
|
+
* [Official Website and Demo](https://meta.github.io/memlab)
|
|
8
|
+
* [Documentation](https://meta.github.io/memlab/docs/intro)
|
|
@@ -37,7 +37,7 @@ class E2EInteractionManager {
|
|
|
37
37
|
this.evalFuncAfterInitLoad = null;
|
|
38
38
|
this.page = page;
|
|
39
39
|
this.browser = browser;
|
|
40
|
-
this.networkManager = new NetworkManager_1.default(
|
|
40
|
+
this.networkManager = new NetworkManager_1.default();
|
|
41
41
|
}
|
|
42
42
|
getChosenCDPSession() {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/NetworkManager.d.ts
CHANGED
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
* @format
|
|
8
8
|
* @oncall memory_lab
|
|
9
9
|
*/
|
|
10
|
-
import type { CDPSession
|
|
10
|
+
import type { CDPSession } from 'puppeteer-core';
|
|
11
11
|
export default class NetworkManager {
|
|
12
12
|
private cdpSession;
|
|
13
|
-
private page;
|
|
14
13
|
private requestCache;
|
|
15
14
|
private scriptManager;
|
|
16
|
-
constructor(
|
|
15
|
+
constructor();
|
|
17
16
|
setCDPSession(session: CDPSession): void;
|
|
18
17
|
private networkLog;
|
|
19
18
|
interceptScript(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkManager.d.ts","sourceRoot":"","sources":["../src/NetworkManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"NetworkManager.d.ts","sourceRoot":"","sources":["../src/NetworkManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAgB/C,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,aAAa,CAAgB;;IAO9B,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAI/C,OAAO,CAAC,UAAU;IAML,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAiH9C"}
|
package/dist/NetworkManager.js
CHANGED
|
@@ -25,9 +25,8 @@ const core_1 = require("@memlab/core");
|
|
|
25
25
|
const ScriptManager_1 = __importDefault(require("./ScriptManager"));
|
|
26
26
|
const patterns = ['*'];
|
|
27
27
|
class NetworkManager {
|
|
28
|
-
constructor(
|
|
28
|
+
constructor() {
|
|
29
29
|
this.cdpSession = null;
|
|
30
|
-
this.page = page;
|
|
31
30
|
this.requestCache = new Map();
|
|
32
31
|
this.scriptManager = new ScriptManager_1.default();
|
|
33
32
|
}
|
|
@@ -18,7 +18,6 @@ export type ClosureScope = {
|
|
|
18
18
|
loc: Optional<SourceLocation>;
|
|
19
19
|
};
|
|
20
20
|
export default class Script {
|
|
21
|
-
private code;
|
|
22
21
|
private ast;
|
|
23
22
|
private closureScopeTree;
|
|
24
23
|
constructor(code: string);
|
|
@@ -26,7 +25,6 @@ export default class Script {
|
|
|
26
25
|
private locToStr;
|
|
27
26
|
private findParentFunctionPath;
|
|
28
27
|
private findParentFunctionClosureScope;
|
|
29
|
-
private findGrandparentFunctionClosureScope;
|
|
30
28
|
private buildClosureScopeTree;
|
|
31
29
|
}
|
|
32
30
|
//# sourceMappingURL=Script.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Script.d.ts","sourceRoot":"","sources":["../../src/code-analysis/Script.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAW,QAAQ,EAAC,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAQV,cAAc,EACf,MAAM,cAAc,CAAC;AAQtB,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,4BAA4B,EAAE,MAAM,EAAE,CAAC;IACvC,cAAc,EAAE,YAAY,EAAE,CAAC;IAC/B,GAAG,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;CAC/B,CAAC;AAmBF,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"Script.d.ts","sourceRoot":"","sources":["../../src/code-analysis/Script.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAW,QAAQ,EAAC,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAQV,cAAc,EACf,MAAM,cAAc,CAAC;AAQtB,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,4BAA4B,EAAE,MAAM,EAAE,CAAC;IACvC,cAAc,EAAE,YAAY,EAAE,CAAC;IAC/B,GAAG,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;CAC/B,CAAC;AAmBF,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAO,CAAC,GAAG,CAAwB;IACnC,OAAO,CAAC,gBAAgB,CAAe;gBAE3B,IAAI,EAAE,MAAM;IAOjB,mBAAmB,IAAI,YAAY;IAI1C,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,sBAAsB;IAmB9B,OAAO,CAAC,8BAA8B;IAiBtC,OAAO,CAAC,qBAAqB;CA+F9B"}
|
|
@@ -24,7 +24,6 @@ function isFunctionType(type) {
|
|
|
24
24
|
}
|
|
25
25
|
class Script {
|
|
26
26
|
constructor(code) {
|
|
27
|
-
this.code = code;
|
|
28
27
|
this.ast = (0, parser_1.parse)(code, {
|
|
29
28
|
sourceType: 'script',
|
|
30
29
|
});
|
|
@@ -64,21 +63,6 @@ class Script {
|
|
|
64
63
|
}
|
|
65
64
|
return parentClosureScope;
|
|
66
65
|
}
|
|
67
|
-
findGrandparentFunctionClosureScope(locToClosureScopeMap, path) {
|
|
68
|
-
const parentPath = this.findParentFunctionPath(path);
|
|
69
|
-
if (!parentPath) {
|
|
70
|
-
throw core_1.utils.haltOrThrow('cannot find parent scope');
|
|
71
|
-
}
|
|
72
|
-
const grandparentPath = this.findParentFunctionPath(parentPath);
|
|
73
|
-
if (!grandparentPath) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
const grandparentClosureScope = locToClosureScopeMap.get(this.locToStr(grandparentPath.node.loc));
|
|
77
|
-
if (!grandparentClosureScope) {
|
|
78
|
-
throw core_1.utils.haltOrThrow('cannot find parent scope');
|
|
79
|
-
}
|
|
80
|
-
return grandparentClosureScope;
|
|
81
|
-
}
|
|
82
66
|
buildClosureScopeTree(ast) {
|
|
83
67
|
const root = {
|
|
84
68
|
functionName: null,
|
|
@@ -113,7 +97,7 @@ class Script {
|
|
|
113
97
|
// 1. This is a var use in the containing scope
|
|
114
98
|
// 2. This is a var defined in the direct parent scope
|
|
115
99
|
// of the containing scope
|
|
116
|
-
// If true, add the
|
|
100
|
+
// If true, add the identifier name to the usedVariablesFromParentScope
|
|
117
101
|
// of the containing scope
|
|
118
102
|
const fillInVarInfo = function (path) {
|
|
119
103
|
// if the identifier is a function name of a function definition
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2EUtils.d.ts","sourceRoot":"","sources":["../../src/lib/E2EUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,aAAa,EAGd,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAQrD,KAAK,gBAAgB,GAAG,CAAC,EAAE,EAAE,KAAK,KAAK,IAAI,CAAC;AAE5C,iBAAS,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CASnD;AAGD,iBAAS,eAAe,CACtB,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,qBAAqB,GAC/B,MAAM,CAcR;AAED,iBAAS,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAajD;AAED,iBAAS,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,GAAG,IAAI,CAgBzE;AAED,iBAAS,kBAAkB,CAAC,SAAS,EAAE,qBAAqB,GAAG,IAAI,CAMlE;AAED,iBAAS,WAAW,CAClB,SAAS,EAAE,qBAAqB,EAChC,GAAG,GAAE,UAAU,GAAG;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAM,GACvC,IAAI,CAeN;AAED,iBAAe,cAAc,CAC3B,IAAI,EAAE,IAAI,EAC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,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,UAAU,CAAC,CAarB;AAED,iBAAS,kBAAkB,CAAC,QAAQ,GAAE,QAAQ,CAAC,SAAS,CAAQ,GAAG,MAAM,CAKxE;;;;;;;;;;;;;;;;;;;;;;AAMD,wBAwBE"}
|
package/dist/lib/E2EUtils.js
CHANGED
|
@@ -111,14 +111,12 @@ function checkURL(page, intendedURL) {
|
|
|
111
111
|
function injectPageReloadChecker(page) {
|
|
112
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
113
|
yield page.evaluate(() => {
|
|
114
|
-
// @ts-expect-error TODO: add Window shim type
|
|
115
114
|
window.__memlab_check_reload = 1;
|
|
116
115
|
});
|
|
117
116
|
});
|
|
118
117
|
}
|
|
119
118
|
function checkPageReload(page) {
|
|
120
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
// @ts-expect-error TODO: add Window shim type
|
|
122
120
|
const flag = yield page.evaluate(() => window.__memlab_check_reload);
|
|
123
121
|
if (flag !== 1) {
|
|
124
122
|
core_2.utils.haltOrThrow('The page is reloaded. MemLab cannot analyze heap across page reloads. ' +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memlab/e2e",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "memlab browser E2E interaction libraries",
|
|
6
6
|
"author": "Liang Gong <lgong@meta.com>",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@babel/parser": "^7.16.4",
|
|
26
26
|
"@babel/template": "^7.16.0",
|
|
27
27
|
"@babel/traverse": "^7.16.3",
|
|
28
|
-
"@memlab/core": "^2.0.
|
|
29
|
-
"@memlab/lens": "^2.0.
|
|
28
|
+
"@memlab/core": "^2.0.6",
|
|
29
|
+
"@memlab/lens": "^2.0.6",
|
|
30
30
|
"ansi": "^0.3.1",
|
|
31
31
|
"babar": "^0.2.0",
|
|
32
32
|
"chalk": "^4.0.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"repository": {
|
|
53
53
|
"type": "git",
|
|
54
|
-
"url": "git+https://github.com/
|
|
54
|
+
"url": "git+https://github.com/meta/memlab.git",
|
|
55
55
|
"directory": "packages/e2e"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"clean-pkg": "rm -rf ./dist && rm -rf ./node_modules && rm -f ./tsconfig.tsbuildinfo"
|
|
62
62
|
},
|
|
63
63
|
"bugs": {
|
|
64
|
-
"url": "https://github.com/
|
|
64
|
+
"url": "https://github.com/meta/memlab/issues"
|
|
65
65
|
},
|
|
66
|
-
"homepage": "https://github.com/
|
|
66
|
+
"homepage": "https://github.com/meta/memlab#readme"
|
|
67
67
|
}
|