@memlab/e2e 1.0.13 → 1.0.16

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.
Files changed (104) hide show
  1. package/README.md +2 -2
  2. package/dist/BaseSynthesizer.d.ts +1 -1
  3. package/dist/E2EInteractionManager.d.ts +2 -1
  4. package/dist/E2EInteractionManager.js +17 -7
  5. package/dist/NetworkManager.d.ts +21 -0
  6. package/dist/NetworkManager.js +110 -0
  7. package/dist/ScriptManager.d.ts +24 -0
  8. package/dist/ScriptManager.js +104 -0
  9. package/dist/TestRunnerLoader.d.ts +1 -1
  10. package/dist/TestRunnerLoader.js +1 -1
  11. package/dist/TypesThirdParty.d.ts +1 -1
  12. package/dist/TypesThirdParty.js +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/instrumentation/BaseAstTransform.d.ts +16 -0
  16. package/dist/instrumentation/BaseAstTransform.js +31 -0
  17. package/dist/instrumentation/ScriptRewriteManager.d.ts +17 -0
  18. package/dist/instrumentation/ScriptRewriteManager.js +45 -0
  19. package/dist/instrumentation/TransformLoader.d.ts +14 -0
  20. package/dist/instrumentation/TransformLoader.js +21 -0
  21. package/dist/instrumentation/transforms/InjectSourceInfoTranform.d.ts +17 -0
  22. package/dist/instrumentation/transforms/InjectSourceInfoTranform.js +62 -0
  23. package/dist/instrumentation/transforms/InjectSourceInfoTransform.d.ts +17 -0
  24. package/dist/instrumentation/transforms/InjectSourceInfoTransform.js +63 -0
  25. package/dist/lib/E2EUtils.d.ts +1 -1
  26. package/dist/lib/E2EUtils.js +1 -1
  27. package/dist/lib/SynthesisUtils.d.ts +1 -1
  28. package/dist/lib/SynthesisUtils.js +1 -1
  29. package/dist/lib/operations/BackOperation.d.ts +1 -1
  30. package/dist/lib/operations/BackOperation.js +1 -1
  31. package/dist/lib/operations/BackspaceOperation.d.ts +1 -1
  32. package/dist/lib/operations/BackspaceOperation.js +1 -1
  33. package/dist/lib/operations/BaseOperation.d.ts +1 -1
  34. package/dist/lib/operations/BaseOperation.js +1 -1
  35. package/dist/lib/operations/CachePageContent.d.ts +1 -1
  36. package/dist/lib/operations/CachePageContent.js +1 -1
  37. package/dist/lib/operations/ClickOperation.d.ts +1 -1
  38. package/dist/lib/operations/ClickOperation.js +1 -1
  39. package/dist/lib/operations/CompoundOperation.d.ts +1 -1
  40. package/dist/lib/operations/CompoundOperation.js +1 -1
  41. package/dist/lib/operations/EnterOperation.d.ts +1 -1
  42. package/dist/lib/operations/EnterOperation.js +1 -1
  43. package/dist/lib/operations/EscOperation.d.ts +1 -1
  44. package/dist/lib/operations/EscOperation.js +1 -1
  45. package/dist/lib/operations/HoverOperation.d.ts +1 -1
  46. package/dist/lib/operations/HoverOperation.js +1 -1
  47. package/dist/lib/operations/InteractionUtils.d.ts +1 -1
  48. package/dist/lib/operations/InteractionUtils.js +1 -1
  49. package/dist/lib/operations/Operations.d.ts +1 -1
  50. package/dist/lib/operations/Operations.js +1 -1
  51. package/dist/lib/operations/RevertOperation.d.ts +1 -1
  52. package/dist/lib/operations/RevertOperation.js +1 -1
  53. package/dist/lib/operations/RunJSCode.d.ts +1 -1
  54. package/dist/lib/operations/RunJSCode.js +1 -1
  55. package/dist/lib/operations/ScrollOperation.d.ts +1 -1
  56. package/dist/lib/operations/ScrollOperation.js +1 -1
  57. package/dist/lib/operations/TargetExtraOperation.d.ts +1 -1
  58. package/dist/lib/operations/TargetExtraOperation.js +1 -1
  59. package/dist/lib/operations/TestPlanner.d.ts +1 -1
  60. package/dist/lib/operations/TestPlanner.js +1 -1
  61. package/dist/lib/operations/TypeOperation.d.ts +1 -1
  62. package/dist/lib/operations/TypeOperation.js +1 -1
  63. package/dist/lib/operations/UploadOperation.d.ts +1 -1
  64. package/dist/lib/operations/UploadOperation.js +1 -1
  65. package/dist/lib/operations/WaitForElementOperation.d.ts +1 -1
  66. package/dist/lib/operations/WaitForElementOperation.js +1 -1
  67. package/dist/lib/operations/WaitOperation.d.ts +1 -1
  68. package/dist/lib/operations/WaitOperation.js +1 -1
  69. package/dist/lib/operations/WithCachedPageContent.d.ts +1 -1
  70. package/dist/lib/operations/WithCachedPageContent.js +1 -1
  71. package/dist/lib/operations/XVirtualFrameBuffer.d.ts +1 -1
  72. package/dist/lib/operations/XVirtualFrameBuffer.js +1 -1
  73. package/dist/plugins/DefaultScenarioSynthesizer.d.ts +1 -1
  74. package/dist/plugins/DefaultScenarioSynthesizer.js +1 -1
  75. package/dist/plugins/TestSPAVisitSynthesizer.d.ts +1 -1
  76. package/dist/plugins/TestSPAVisitSynthesizer.js +2 -2
  77. package/dist/plugins/scenarios/test-airbnb.d.ts +1 -1
  78. package/dist/plugins/scenarios/test-airbnb.js +1 -1
  79. package/dist/plugins/scenarios/test-databricks.d.ts +1 -1
  80. package/dist/plugins/scenarios/test-databricks.js +1 -1
  81. package/dist/plugins/scenarios/test-ebay.d.ts +1 -1
  82. package/dist/plugins/scenarios/test-ebay.js +1 -1
  83. package/dist/plugins/scenarios/test-google-maps.d.ts +1 -1
  84. package/dist/plugins/scenarios/test-google-maps.js +1 -1
  85. package/dist/plugins/scenarios/test-shopify.d.ts +1 -1
  86. package/dist/plugins/scenarios/test-shopify.js +1 -1
  87. package/dist/plugins/scenarios/test-youtube.d.ts +1 -1
  88. package/dist/plugins/scenarios/test-youtube.js +1 -1
  89. package/package.json +11 -5
  90. package/static/example/components/layout.jsx +1 -1
  91. package/static/example/leak-filters/filter-by-retained-size.js +7 -1
  92. package/static/example/next.config.js +4 -3
  93. package/static/example/pages/_app.js +1 -1
  94. package/static/example/pages/_document.js +1 -1
  95. package/static/example/pages/examples/detached-dom.jsx +9 -3
  96. package/static/example/pages/examples/oversized-object.jsx +8 -2
  97. package/static/example/pages/index.js +1 -1
  98. package/static/example/scenarios/detached-dom.js +7 -6
  99. package/static/example/scenarios/oversized-leak-filter.js +7 -2
  100. package/static/example/scenarios/oversized-object-with-filter.js +7 -2
  101. package/static/example/scenarios/oversized-object.js +4 -4
  102. package/static/links/min.js +1 -0
  103. package/static/links/src/App.js +1 -1
  104. package/static/links/src/index.js +1 -1
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
- * @oncall ws_labs
8
+ * @oncall web_perf_infra
9
9
  */
10
10
  import type { AnyOptions, CheckPageLoadCallback, IE2EScenarioVisitPlan, IE2EStepBasic } from '@memlab/core';
11
11
  import BaseSynthesizer from '../BaseSynthesizer';
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  * @format
9
- * @oncall ws_labs
9
+ * @oncall web_perf_infra
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
- * @oncall ws_labs
8
+ * @oncall web_perf_infra
9
9
  */
10
10
  import type { AnyOptions, CheckPageLoadCallback, IE2EScenarioVisitPlan, IE2EStepBasic } from '@memlab/core';
11
11
  import BaseSynthesizer from '../BaseSynthesizer';
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  * @format
9
- * @oncall ws_labs
9
+ * @oncall web_perf_infra
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -26,7 +26,7 @@ const BaseSynthesizer_1 = __importDefault(require("../BaseSynthesizer"));
26
26
  const ClickOperation_1 = __importDefault(require("../lib/operations/ClickOperation"));
27
27
  const InteractionUtils_1 = __importDefault(require("../lib/operations/InteractionUtils"));
28
28
  class TestSPAVisitSynthesizer extends BaseSynthesizer_1.default {
29
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
29
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
30
30
  getBaseURL(_options = {}) {
31
31
  const indexFile = path_1.default.join(__dirname, '..', '..', 'static', 'links', 'index.html');
32
32
  return `file://${indexFile}`;
@@ -8,7 +8,7 @@ export function repeat(): number;
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  *
10
10
  * @format
11
- * @oncall ws_labs
11
+ * @oncall web_perf_infra
12
12
  */
13
13
  export function url(): string;
14
14
  //# sourceMappingURL=test-airbnb.d.ts.map
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  * @format
9
- * @oncall ws_labs
9
+ * @oncall web_perf_infra
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -8,7 +8,7 @@ export function repeat(): number;
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  *
10
10
  * @format
11
- * @oncall ws_labs
11
+ * @oncall web_perf_infra
12
12
  */
13
13
  export function url(): string;
14
14
  //# sourceMappingURL=test-databricks.d.ts.map
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  * @format
9
- * @oncall ws_labs
9
+ * @oncall web_perf_infra
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -8,7 +8,7 @@ export function repeat(): number;
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  *
10
10
  * @format
11
- * @oncall ws_labs
11
+ * @oncall web_perf_infra
12
12
  */
13
13
  export function url(): string;
14
14
  //# sourceMappingURL=test-ebay.d.ts.map
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  * @format
9
- * @oncall ws_labs
9
+ * @oncall web_perf_infra
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -8,7 +8,7 @@ export function repeat(): number;
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  *
10
10
  * @format
11
- * @oncall ws_labs
11
+ * @oncall web_perf_infra
12
12
  */
13
13
  export function url(): string;
14
14
  //# sourceMappingURL=test-google-maps.d.ts.map
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  * @format
9
- * @oncall ws_labs
9
+ * @oncall web_perf_infra
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -8,7 +8,7 @@ export function repeat(): number;
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  *
10
10
  * @format
11
- * @oncall ws_labs
11
+ * @oncall web_perf_infra
12
12
  */
13
13
  export function url(): string;
14
14
  //# sourceMappingURL=test-shopify.d.ts.map
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  * @format
9
- * @oncall ws_labs
9
+ * @oncall web_perf_infra
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -8,7 +8,7 @@ export function repeat(): number;
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  *
10
10
  * @format
11
- * @oncall ws_labs
11
+ * @oncall web_perf_infra
12
12
  */
13
13
  export function url(): string;
14
14
  //# sourceMappingURL=test-youtube.d.ts.map
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  * @format
9
- * @oncall ws_labs
9
+ * @oncall web_perf_infra
10
10
  */
11
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memlab/e2e",
3
- "version": "1.0.13",
3
+ "version": "1.0.16",
4
4
  "license": "MIT",
5
5
  "description": "memlab browser E2E interaction libraries",
6
6
  "author": "Liang Gong <lgong@fb.com>",
@@ -30,9 +30,15 @@
30
30
  "puppeteer": "^13.5.1",
31
31
  "string-width": "^4.2.0",
32
32
  "util.promisify": "^1.1.1",
33
- "xvfb": "^0.4.0"
33
+ "xvfb": "^0.4.0",
34
+ "@babel/parser": "^7.16.4",
35
+ "@babel/traverse": "^7.16.3",
36
+ "@babel/generator": "^7.16.0",
37
+ "@babel/template": "^7.16.0"
34
38
  },
35
39
  "devDependencies": {
40
+ "@babel/types": "^7.16.0",
41
+ "@types/babel-core": "^6.25.7",
36
42
  "@types/fs-extra": "^9.0.3",
37
43
  "@types/jest": "^27.4.1",
38
44
  "@types/minimist": "^1.2.2",
@@ -44,7 +50,7 @@
44
50
  },
45
51
  "repository": {
46
52
  "type": "git",
47
- "url": "git+https://github.com/facebookincubator/memlab.git",
53
+ "url": "git+https://github.com/facebook/memlab.git",
48
54
  "directory": "packages/e2e"
49
55
  },
50
56
  "scripts": {
@@ -53,7 +59,7 @@
53
59
  "clean-pkg": "rm -rf ./dist && rm -rf ./node_modules && rm -f ./tsconfig.tsbuildinfo"
54
60
  },
55
61
  "bugs": {
56
- "url": "https://github.com/facebookincubator/memlab/issues"
62
+ "url": "https://github.com/facebook/memlab/issues"
57
63
  },
58
- "homepage": "https://github.com/facebookincubator/memlab#readme"
64
+ "homepage": "https://github.com/facebook/memlab#readme"
59
65
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
- * @oncall ws_labs
8
+ * @oncall web_perf_infra
9
9
  */
10
10
 
11
11
  import Head from 'next/head';
@@ -1,4 +1,10 @@
1
- // @nolint
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * @nolint
5
+ * @oncall web_perf_infra
6
+ */
7
+
2
8
  module.exports = function leakFilter(node, _snapshot, _leakedNodeIds) {
3
9
  return node.retainedSize > 1000 * 1000;
4
10
  };
@@ -1,9 +1,10 @@
1
1
  /**
2
- * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
- * @oncall ws_labs
4
+ * @nolint
5
+ * @oncall web_perf_infra
5
6
  */
6
- // @nolint
7
+
7
8
  /** @type {import('next').NextConfig} */
8
9
  const nextConfig = {
9
10
  reactStrictMode: true,
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
- * @oncall ws_labs
8
+ * @oncall web_perf_infra
9
9
  */
10
10
 
11
11
  import Layout from '../components/layout.jsx';
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
- * @oncall ws_labs
8
+ * @oncall web_perf_infra
9
9
  */
10
10
 
11
11
  import {Head, Html, Main, NextScript} from 'next/document';
@@ -1,10 +1,14 @@
1
- // @nolint
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * @nolint
5
+ * @oncall web_perf_infra
6
+ */
2
7
 
3
8
  import Link from 'next/link';
4
9
  import React from 'react';
5
10
 
6
11
  export default function DetachedDom() {
7
-
8
12
  const addNewItem = () => {
9
13
  if (!window.leakedObjects) {
10
14
  window.leakedObjects = [];
@@ -12,7 +16,9 @@ export default function DetachedDom() {
12
16
  for (let i = 0; i < 1024; i++) {
13
17
  window.leakedObjects.push(document.createElement('div'));
14
18
  }
15
- console.log('Detached DOMs are created. Please check Memory tab in devtools')
19
+ console.log(
20
+ 'Detached DOMs are created. Please check Memory tab in devtools',
21
+ );
16
22
  };
17
23
 
18
24
  return (
@@ -1,4 +1,10 @@
1
- // @nolint
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * @nolint
5
+ * @oncall web_perf_infra
6
+ */
7
+
2
8
  import Link from 'next/link';
3
9
  import React, {useEffect} from 'react';
4
10
 
@@ -21,7 +27,7 @@ export default function OversizedObject() {
21
27
  <div className="row">
22
28
  <Link href="/">Go back</Link>
23
29
  </div>
24
- <br/>
30
+ <br />
25
31
  <div className="row">
26
32
  Object<code>bigArray</code>is leaked. Please check <code>Memory</code>{' '}
27
33
  tab in devtools
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
- * @oncall ws_labs
8
+ * @oncall web_perf_infra
9
9
  */
10
10
 
11
11
  import Link from 'next/link';
@@ -1,15 +1,16 @@
1
1
  /**
2
- * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
- * @oncall ws_labs
4
+ * @nolint
5
+ * @oncall web_perf_infra
5
6
  */
6
- // @nolint
7
+
7
8
  // memlab/packages/e2e/static/example/scenario/detached-dom.js
8
9
  /**
9
10
  * The initial `url` of the scenario we would like to run.
10
11
  */
11
12
  function url() {
12
- return "http://localhost:3000/examples/detached-dom";
13
+ return 'http://localhost:3000/examples/detached-dom';
13
14
  }
14
15
 
15
16
  /**
@@ -21,7 +22,7 @@ function url() {
21
22
  */
22
23
  async function action(page) {
23
24
  const elements = await page.$x(
24
- "//button[contains(., 'Create detached DOMs')]"
25
+ "//button[contains(., 'Create detached DOMs')]",
25
26
  );
26
27
  const [button] = elements;
27
28
  if (button) {
@@ -42,4 +43,4 @@ async function back(page) {
42
43
  await page.click('a[href="/"]');
43
44
  }
44
45
 
45
- module.exports = { action, back, url };
46
+ module.exports = {action, back, url};
@@ -1,4 +1,9 @@
1
- /* @nolint */
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * @nolint
5
+ * @oncall web_perf_infra
6
+ */
2
7
 
3
8
  // leakFilter is called with each object (node) in browser
4
9
  // allocated by `action` but not released after the `back` call
@@ -6,4 +11,4 @@ function leakFilter(node, _snapshot, _leakedNodeIds) {
6
11
  return node.retainedSize > 1000 * 1000;
7
12
  }
8
13
 
9
- module.exports = { leakFilter };
14
+ module.exports = {leakFilter};
@@ -1,4 +1,9 @@
1
- /* @nolint */
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * @nolint
5
+ * @oncall web_perf_infra
6
+ */
2
7
 
3
8
  function url() {
4
9
  return 'http://localhost:3000/';
@@ -20,4 +25,4 @@ function leakFilter(node, _snapshot, _leakedNodeIds) {
20
25
  return node.retainedSize > 1000 * 1000;
21
26
  }
22
27
 
23
- module.exports = { action, back, leakFilter, url };
28
+ module.exports = {action, back, leakFilter, url};
@@ -1,9 +1,9 @@
1
1
  /**
2
- * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
- * @oncall ws_labs
4
+ * @nolint
5
+ * @oncall web_perf_infra
5
6
  */
6
- /* @nolint */
7
7
 
8
8
  function url() {
9
9
  return 'http://localhost:3000/';
@@ -19,4 +19,4 @@ async function back(page) {
19
19
  await page.click('a[href="/"]');
20
20
  }
21
21
 
22
- module.exports = { action, back, url };
22
+ module.exports = {action, back, url};