@memlab/e2e 1.0.11 → 1.0.13
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/LICENSE +21 -0
- package/dist/BaseSynthesizer.js +3 -2
- package/dist/E2EInteractionManager.js +10 -1
- package/dist/lib/E2EUtils.js +2 -1
- package/package.json +3 -2
- package/static/example/next.config.js +5 -0
- package/static/example/scenarios/detached-dom.js +5 -0
- package/static/example/scenarios/oversized-object.js +5 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/BaseSynthesizer.js
CHANGED
|
@@ -125,7 +125,7 @@ class BaseSynthesizer {
|
|
|
125
125
|
return 1;
|
|
126
126
|
}
|
|
127
127
|
// get the URL of the target app
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
129
129
|
getBaseURL(_options = {}) {
|
|
130
130
|
return 'https://www.facebook.com';
|
|
131
131
|
}
|
|
@@ -134,7 +134,7 @@ class BaseSynthesizer {
|
|
|
134
134
|
return url;
|
|
135
135
|
}
|
|
136
136
|
// get URL parameters
|
|
137
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
137
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
138
138
|
getURLParameters(_options = {}) {
|
|
139
139
|
return '';
|
|
140
140
|
}
|
|
@@ -335,6 +335,7 @@ class BaseSynthesizer {
|
|
|
335
335
|
numOfWarmup: this.getActualNumberOfWarmup(),
|
|
336
336
|
dataBuilder: null,
|
|
337
337
|
isPageLoaded: (_a = scenario.isPageLoaded) !== null && _a !== void 0 ? _a : this.getPageLoadChecker(),
|
|
338
|
+
scenario,
|
|
338
339
|
};
|
|
339
340
|
}
|
|
340
341
|
synthesisSimple(start, target, options = {}) {
|
|
@@ -102,7 +102,10 @@ class E2EInteractionManager {
|
|
|
102
102
|
const url = `${baseURL}${subUrl}` + getURLParameter(tab, visitPlan);
|
|
103
103
|
logTabProgress(i, visitPlan);
|
|
104
104
|
yield maybeWaitForConsoleInput(i + 1);
|
|
105
|
-
const opArgs = {
|
|
105
|
+
const opArgs = {
|
|
106
|
+
isPageLoaded: visitPlan.isPageLoaded,
|
|
107
|
+
scenario: visitPlan.scenario,
|
|
108
|
+
};
|
|
106
109
|
yield applyAsyncWithRetry(this.getPageStatistics, this, [url, tab, opArgs], {
|
|
107
110
|
retry: runConfig.interactionFailRetry,
|
|
108
111
|
});
|
|
@@ -176,6 +179,7 @@ class E2EInteractionManager {
|
|
|
176
179
|
});
|
|
177
180
|
}
|
|
178
181
|
getPageStatistics(url, tabInfo, opArgs = {}) {
|
|
182
|
+
var _a;
|
|
179
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
184
|
if (core_1.config.verbose) {
|
|
181
185
|
core_1.info.lowLevel('url: ' + url);
|
|
@@ -197,6 +201,11 @@ class E2EInteractionManager {
|
|
|
197
201
|
checkURL(this.page, url);
|
|
198
202
|
// inject marker, which checks if the page is reloaded
|
|
199
203
|
if (tabInfo.idx === 1) {
|
|
204
|
+
// call setup callback if the scenario has one
|
|
205
|
+
const setup = (_a = opArgs.scenario) === null || _a === void 0 ? void 0 : _a.setup;
|
|
206
|
+
if (setup) {
|
|
207
|
+
yield setup(this.page);
|
|
208
|
+
}
|
|
200
209
|
yield injectPageReloadChecker(this.page);
|
|
201
210
|
}
|
|
202
211
|
else {
|
package/dist/lib/E2EUtils.js
CHANGED
|
@@ -121,7 +121,8 @@ function checkPageReload(page) {
|
|
|
121
121
|
const flag = yield page.evaluate(() => window.__memlab_check_reload);
|
|
122
122
|
if (flag !== 1) {
|
|
123
123
|
core_1.utils.haltOrThrow('The page is reloaded. MemLab cannot analyze heap across page reloads. ' +
|
|
124
|
-
'Please remove window.reload() calls
|
|
124
|
+
'Please remove window.reload() calls, page.goto() calls, ' +
|
|
125
|
+
'or any reload logic.');
|
|
125
126
|
}
|
|
126
127
|
});
|
|
127
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memlab/e2e",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "memlab browser E2E interaction libraries",
|
|
6
6
|
"author": "Liang Gong <lgong@fb.com>",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"types": "dist/index.d.ts",
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
20
|
-
"static"
|
|
20
|
+
"static",
|
|
21
|
+
"LICENSE"
|
|
21
22
|
],
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@memlab/core": "^1.1.10",
|