@memlab/e2e 1.0.0

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 (118) hide show
  1. package/README.md +11 -0
  2. package/dist/BaseSynthesizer.d.ts +63 -0
  3. package/dist/BaseSynthesizer.d.ts.map +1 -0
  4. package/dist/BaseSynthesizer.js +433 -0
  5. package/dist/E2EInteractionManager.d.ts +41 -0
  6. package/dist/E2EInteractionManager.d.ts.map +1 -0
  7. package/dist/E2EInteractionManager.js +347 -0
  8. package/dist/TestRunnerLoader.d.ts +16 -0
  9. package/dist/TestRunnerLoader.d.ts.map +1 -0
  10. package/dist/TestRunnerLoader.js +41 -0
  11. package/dist/TypesThirdParty.d.ts +25 -0
  12. package/dist/TypesThirdParty.d.ts.map +1 -0
  13. package/dist/TypesThirdParty.js +10 -0
  14. package/dist/index.d.ts +16 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +40 -0
  17. package/dist/lib/E2EUtils.d.ts +59 -0
  18. package/dist/lib/E2EUtils.d.ts.map +1 -0
  19. package/dist/lib/E2EUtils.js +286 -0
  20. package/dist/lib/SynthesisUtils.d.ts +25 -0
  21. package/dist/lib/SynthesisUtils.d.ts.map +1 -0
  22. package/dist/lib/SynthesisUtils.js +30 -0
  23. package/dist/lib/operations/BackOperation.d.ts +17 -0
  24. package/dist/lib/operations/BackOperation.d.ts.map +1 -0
  25. package/dist/lib/operations/BackOperation.js +37 -0
  26. package/dist/lib/operations/BackspaceOperation.d.ts +18 -0
  27. package/dist/lib/operations/BackspaceOperation.d.ts.map +1 -0
  28. package/dist/lib/operations/BackspaceOperation.js +36 -0
  29. package/dist/lib/operations/BaseOperation.d.ts +22 -0
  30. package/dist/lib/operations/BaseOperation.d.ts.map +1 -0
  31. package/dist/lib/operations/BaseOperation.js +67 -0
  32. package/dist/lib/operations/CachePageContent.d.ts +22 -0
  33. package/dist/lib/operations/CachePageContent.d.ts.map +1 -0
  34. package/dist/lib/operations/CachePageContent.js +46 -0
  35. package/dist/lib/operations/ClickOperation.d.ts +36 -0
  36. package/dist/lib/operations/ClickOperation.d.ts.map +1 -0
  37. package/dist/lib/operations/ClickOperation.js +131 -0
  38. package/dist/lib/operations/CompoundOperation.d.ts +20 -0
  39. package/dist/lib/operations/CompoundOperation.d.ts.map +1 -0
  40. package/dist/lib/operations/CompoundOperation.js +39 -0
  41. package/dist/lib/operations/EnterOperation.d.ts +18 -0
  42. package/dist/lib/operations/EnterOperation.d.ts.map +1 -0
  43. package/dist/lib/operations/EnterOperation.js +36 -0
  44. package/dist/lib/operations/EscOperation.d.ts +17 -0
  45. package/dist/lib/operations/EscOperation.d.ts.map +1 -0
  46. package/dist/lib/operations/EscOperation.js +36 -0
  47. package/dist/lib/operations/HoverOperation.d.ts +28 -0
  48. package/dist/lib/operations/HoverOperation.d.ts.map +1 -0
  49. package/dist/lib/operations/HoverOperation.js +73 -0
  50. package/dist/lib/operations/InteractionUtils.d.ts +33 -0
  51. package/dist/lib/operations/InteractionUtils.d.ts.map +1 -0
  52. package/dist/lib/operations/InteractionUtils.js +207 -0
  53. package/dist/lib/operations/Operations.d.ts +25 -0
  54. package/dist/lib/operations/Operations.d.ts.map +1 -0
  55. package/dist/lib/operations/Operations.js +45 -0
  56. package/dist/lib/operations/RevertOperation.d.ts +18 -0
  57. package/dist/lib/operations/RevertOperation.d.ts.map +1 -0
  58. package/dist/lib/operations/RevertOperation.js +55 -0
  59. package/dist/lib/operations/RunJSCode.d.ts +25 -0
  60. package/dist/lib/operations/RunJSCode.d.ts.map +1 -0
  61. package/dist/lib/operations/RunJSCode.js +51 -0
  62. package/dist/lib/operations/ScrollOperation.d.ts +27 -0
  63. package/dist/lib/operations/ScrollOperation.d.ts.map +1 -0
  64. package/dist/lib/operations/ScrollOperation.js +85 -0
  65. package/dist/lib/operations/TargetExtraOperation.d.ts +18 -0
  66. package/dist/lib/operations/TargetExtraOperation.d.ts.map +1 -0
  67. package/dist/lib/operations/TargetExtraOperation.js +28 -0
  68. package/dist/lib/operations/TestPlanner.d.ts +46 -0
  69. package/dist/lib/operations/TestPlanner.d.ts.map +1 -0
  70. package/dist/lib/operations/TestPlanner.js +182 -0
  71. package/dist/lib/operations/TypeOperation.d.ts +29 -0
  72. package/dist/lib/operations/TypeOperation.d.ts.map +1 -0
  73. package/dist/lib/operations/TypeOperation.js +64 -0
  74. package/dist/lib/operations/UploadOperation.d.ts +25 -0
  75. package/dist/lib/operations/UploadOperation.d.ts.map +1 -0
  76. package/dist/lib/operations/UploadOperation.js +56 -0
  77. package/dist/lib/operations/WaitForElementOperation.d.ts +32 -0
  78. package/dist/lib/operations/WaitForElementOperation.d.ts.map +1 -0
  79. package/dist/lib/operations/WaitForElementOperation.js +67 -0
  80. package/dist/lib/operations/WaitOperation.d.ts +19 -0
  81. package/dist/lib/operations/WaitOperation.d.ts.map +1 -0
  82. package/dist/lib/operations/WaitOperation.js +42 -0
  83. package/dist/lib/operations/WithCachedPageContent.d.ts +26 -0
  84. package/dist/lib/operations/WithCachedPageContent.d.ts.map +1 -0
  85. package/dist/lib/operations/WithCachedPageContent.js +53 -0
  86. package/dist/lib/operations/XVirtualFrameBuffer.d.ts +15 -0
  87. package/dist/lib/operations/XVirtualFrameBuffer.d.ts.map +1 -0
  88. package/dist/lib/operations/XVirtualFrameBuffer.js +44 -0
  89. package/dist/plugins/DefaultScenarioSynthesizer.d.ts +23 -0
  90. package/dist/plugins/DefaultScenarioSynthesizer.d.ts.map +1 -0
  91. package/dist/plugins/DefaultScenarioSynthesizer.js +61 -0
  92. package/dist/plugins/TestSPAVisitSynthesizer.d.ts +23 -0
  93. package/dist/plugins/TestSPAVisitSynthesizer.d.ts.map +1 -0
  94. package/dist/plugins/TestSPAVisitSynthesizer.js +72 -0
  95. package/dist/plugins/scenarios/test-airbnb.d.ts +14 -0
  96. package/dist/plugins/scenarios/test-airbnb.d.ts.map +1 -0
  97. package/dist/plugins/scenarios/test-airbnb.js +48 -0
  98. package/dist/plugins/scenarios/test-databricks.d.ts +14 -0
  99. package/dist/plugins/scenarios/test-databricks.d.ts.map +1 -0
  100. package/dist/plugins/scenarios/test-databricks.js +40 -0
  101. package/dist/plugins/scenarios/test-ebay.d.ts +14 -0
  102. package/dist/plugins/scenarios/test-ebay.d.ts.map +1 -0
  103. package/dist/plugins/scenarios/test-ebay.js +48 -0
  104. package/dist/plugins/scenarios/test-google-maps.d.ts +14 -0
  105. package/dist/plugins/scenarios/test-google-maps.d.ts.map +1 -0
  106. package/dist/plugins/scenarios/test-google-maps.js +41 -0
  107. package/dist/plugins/scenarios/test-shopify.d.ts +14 -0
  108. package/dist/plugins/scenarios/test-shopify.d.ts.map +1 -0
  109. package/dist/plugins/scenarios/test-shopify.js +40 -0
  110. package/dist/plugins/scenarios/test-youtube.d.ts +14 -0
  111. package/dist/plugins/scenarios/test-youtube.d.ts.map +1 -0
  112. package/dist/plugins/scenarios/test-youtube.js +40 -0
  113. package/package.json +53 -0
  114. package/static/links/index.html +18 -0
  115. package/static/links/min.js +3 -0
  116. package/static/links/package.json +36 -0
  117. package/static/links/src/App.js +48 -0
  118. package/static/links/src/index.js +20 -0
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @emails oncall+ws_labs
9
+ * @format
10
+ */
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ const path_1 = __importDefault(require("path"));
25
+ const BaseSynthesizer_1 = __importDefault(require("../BaseSynthesizer"));
26
+ const ClickOperation_1 = __importDefault(require("../lib/operations/ClickOperation"));
27
+ const InteractionUtils_1 = __importDefault(require("../lib/operations/InteractionUtils"));
28
+ class TestSPAVisitSynthesizer extends BaseSynthesizer_1.default {
29
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
30
+ getBaseURL(_options = {}) {
31
+ const indexFile = path_1.default.join(__dirname, '..', '..', 'static', 'links', 'index.html');
32
+ return `file://${indexFile}`;
33
+ }
34
+ getAppName() {
35
+ return 'test-spa';
36
+ }
37
+ getNumberOfWarmup() {
38
+ return 1;
39
+ }
40
+ getCookieFile() {
41
+ return null;
42
+ }
43
+ getDomain() {
44
+ return 'test.com';
45
+ }
46
+ getAvailableSteps() {
47
+ const steps = [];
48
+ for (let i = 1; i <= 8; ++i) {
49
+ steps.push({
50
+ name: `link-${i}`,
51
+ url: '',
52
+ interactions: [new ClickOperation_1.default(`[data-testid="link-${i}"]`)],
53
+ });
54
+ }
55
+ return steps;
56
+ }
57
+ getDefaultStartStepName() {
58
+ return 'link-1';
59
+ }
60
+ getAvailableVisitPlans() {
61
+ const plans = [this.synthesis('link-2', 'link-3', ['link-4'])];
62
+ return plans;
63
+ }
64
+ getPageLoadChecker() {
65
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
66
+ return (_page) => __awaiter(this, void 0, void 0, function* () {
67
+ yield InteractionUtils_1.default.waitFor(200);
68
+ return true;
69
+ });
70
+ }
71
+ }
72
+ exports.default = TestSPAVisitSynthesizer;
@@ -0,0 +1,14 @@
1
+ export function action(page: any): Promise<void>;
2
+ export function back(page: any): Promise<void>;
3
+ export function repeat(): number;
4
+ /**
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ *
10
+ * @emails oncall+ws_labs
11
+ * @format
12
+ */
13
+ export function url(): string;
14
+ //# sourceMappingURL=test-airbnb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-airbnb.d.ts","sourceRoot":"","sources":["../../../src/plugins/scenarios/test-airbnb.js"],"names":[],"mappings":"AAgBA,iDAMC;AAGD,+CAMC;AAGD,iCAEC;AApCD;;;;;;;;GAQG;AAGH,8BAEC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @emails oncall+ws_labs
9
+ * @format
10
+ */
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ // initial page load's url
21
+ function url() {
22
+ return 'https://www.airbnb.com/?tab_id=home_tab';
23
+ }
24
+ // action where we want to detect memory leaks
25
+ function action(page) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const arr = yield page.$x("//button[contains(., 'Show map')]");
28
+ if (arr[0]) {
29
+ yield arr[0].click();
30
+ }
31
+ arr.forEach(elem => elem.dispose());
32
+ });
33
+ }
34
+ // action where we want to go back to the step before
35
+ function back(page) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const arr = yield page.$x("//button[contains(., 'Show list')]");
38
+ if (arr[0]) {
39
+ yield arr[0].click();
40
+ }
41
+ arr.forEach(elem => elem.dispose());
42
+ });
43
+ }
44
+ // specify the number of repeat for the action
45
+ function repeat() {
46
+ return 15;
47
+ }
48
+ module.exports = { action, back, repeat, url };
@@ -0,0 +1,14 @@
1
+ export function action(page: any): Promise<void>;
2
+ export function back(page: any): Promise<void>;
3
+ export function repeat(): number;
4
+ /**
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ *
10
+ * @emails oncall+ws_labs
11
+ * @format
12
+ */
13
+ export function url(): string;
14
+ //# sourceMappingURL=test-databricks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-databricks.d.ts","sourceRoot":"","sources":["../../../src/plugins/scenarios/test-databricks.js"],"names":[],"mappings":"AAgBA,iDAEC;AAGD,+CAEC;AAGD,iCAEC;AA5BD;;;;;;;;GAQG;AAGH,8BAEC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @emails oncall+ws_labs
9
+ * @format
10
+ */
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ // initial page load's url
21
+ function url() {
22
+ return 'https://databricks.com/';
23
+ }
24
+ // action where we want to detect memory leaks
25
+ function action(page) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ yield page.hover('a[href="/product/data-lakehouse"]');
28
+ });
29
+ }
30
+ // action where we want to go back to the step before
31
+ function back(page) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ yield page.hover('a[href="/solutions"]');
34
+ });
35
+ }
36
+ // specify the number of repeat for the action
37
+ function repeat() {
38
+ return 15;
39
+ }
40
+ module.exports = { action, back, repeat, url };
@@ -0,0 +1,14 @@
1
+ export function action(page: any): Promise<void>;
2
+ export function back(page: any): Promise<void>;
3
+ export function repeat(): number;
4
+ /**
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ *
10
+ * @emails oncall+ws_labs
11
+ * @format
12
+ */
13
+ export function url(): string;
14
+ //# sourceMappingURL=test-ebay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-ebay.d.ts","sourceRoot":"","sources":["../../../src/plugins/scenarios/test-ebay.js"],"names":[],"mappings":"AAgBA,iDAMC;AAGD,+CAMC;AAGD,iCAEC;AApCD;;;;;;;;GAQG;AAGH,8BAEC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @emails oncall+ws_labs
9
+ * @format
10
+ */
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ // initial page load's url
21
+ function url() {
22
+ return 'https://www.ebay.com/';
23
+ }
24
+ // action where we want to detect memory leaks
25
+ function action(page) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const arr = yield page.$x("//button[contains(., 'Shop by category')]");
28
+ if (arr[0]) {
29
+ yield arr[0].click();
30
+ }
31
+ arr.forEach(elem => elem.dispose());
32
+ });
33
+ }
34
+ // action where we want to go back to the step before
35
+ function back(page) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const arr = yield page.$x("//button[contains(., 'Shop by category')]");
38
+ if (arr[0]) {
39
+ yield arr[0].click();
40
+ }
41
+ arr.forEach(elem => elem.dispose());
42
+ });
43
+ }
44
+ // specify the number of repeat for the action
45
+ function repeat() {
46
+ return 3;
47
+ }
48
+ module.exports = { action, back, repeat, url };
@@ -0,0 +1,14 @@
1
+ export function action(page: any): Promise<void>;
2
+ export function back(page: any): Promise<void>;
3
+ export function repeat(): number;
4
+ /**
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ *
10
+ * @emails oncall+ws_labs
11
+ * @format
12
+ */
13
+ export function url(): string;
14
+ //# sourceMappingURL=test-google-maps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-google-maps.d.ts","sourceRoot":"","sources":["../../../src/plugins/scenarios/test-google-maps.js"],"names":[],"mappings":"AAiBA,iDAEC;AAGD,+CAEC;AAGD,iCAEC;AA7BD;;;;;;;;GAQG;AAGH,8BAGC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @emails oncall+ws_labs
9
+ * @format
10
+ */
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ // initial page load's url
21
+ function url() {
22
+ // Meta Headquarter
23
+ return 'https://www.google.com/maps/@37.386427,-122.0428214,11z';
24
+ }
25
+ // action where we want to detect memory leaks
26
+ function action(page) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ yield page.click('button[aria-label="Hotels"]');
29
+ });
30
+ }
31
+ // action where we want to go back to the step before
32
+ function back(page) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ yield page.click('[aria-label="Clear search"]');
35
+ });
36
+ }
37
+ // specify the number of repeat for the action
38
+ function repeat() {
39
+ return 5;
40
+ }
41
+ module.exports = { action, back, repeat, url };
@@ -0,0 +1,14 @@
1
+ export function action(page: any): Promise<void>;
2
+ export function back(page: any): Promise<void>;
3
+ export function repeat(): number;
4
+ /**
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ *
10
+ * @emails oncall+ws_labs
11
+ * @format
12
+ */
13
+ export function url(): string;
14
+ //# sourceMappingURL=test-shopify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-shopify.d.ts","sourceRoot":"","sources":["../../../src/plugins/scenarios/test-shopify.js"],"names":[],"mappings":"AAgBA,iDAEC;AAGD,+CAEC;AAGD,iCAEC;AA5BD;;;;;;;;GAQG;AAGH,8BAEC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @emails oncall+ws_labs
9
+ * @format
10
+ */
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ // initial page load's url
21
+ function url() {
22
+ return 'https://www.shopify.com/';
23
+ }
24
+ // action where we want to detect memory leaks
25
+ function action(page) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ yield page.click('input[data-trekkie-id="Main Nav Get Started"]');
28
+ });
29
+ }
30
+ // action where we want to go back to the step before
31
+ function back(page) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ yield page.click('button[id="CloseModal"]');
34
+ });
35
+ }
36
+ // specify the number of repeat for the action
37
+ function repeat() {
38
+ return 3;
39
+ }
40
+ module.exports = { action, back, repeat, url };
@@ -0,0 +1,14 @@
1
+ export function action(page: any): Promise<void>;
2
+ export function back(page: any): Promise<void>;
3
+ export function repeat(): number;
4
+ /**
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ *
10
+ * @emails oncall+ws_labs
11
+ * @format
12
+ */
13
+ export function url(): string;
14
+ //# sourceMappingURL=test-youtube.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-youtube.d.ts","sourceRoot":"","sources":["../../../src/plugins/scenarios/test-youtube.js"],"names":[],"mappings":"AAgBA,iDAEC;AAGD,+CAEC;AAGD,iCAEC;AA5BD;;;;;;;;GAQG;AAGH,8BAEC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @emails oncall+ws_labs
9
+ * @format
10
+ */
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ // initial page load's url
21
+ function url() {
22
+ return 'https://www.youtube.com';
23
+ }
24
+ // action where we want to detect memory leaks
25
+ function action(page) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ yield page.click('[id="video-title-link"]');
28
+ });
29
+ }
30
+ // action where we want to go back to the step before
31
+ function back(page) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ yield page.click('[id="logo-icon"]');
34
+ });
35
+ }
36
+ // specify the number of repeat for the action
37
+ function repeat() {
38
+ return 5;
39
+ }
40
+ module.exports = { action, back, repeat, url };
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@memlab/e2e",
3
+ "version": "1.0.0",
4
+ "description": "memlab browser E2E interaction libraries",
5
+ "keywords": [
6
+ "e2e",
7
+ "browser"
8
+ ],
9
+ "author": "Liang Gong <lgong@fb.com>",
10
+ "contributors": [],
11
+ "license": "MIT",
12
+ "main": "dist/index.js",
13
+ "types": "dist/index.d.ts",
14
+ "files": [
15
+ "dist",
16
+ "static"
17
+ ],
18
+ "dependencies": {
19
+ "@memlab/core": "^1.0.0",
20
+ "ansi": "^0.3.1",
21
+ "babar": "^0.2.0",
22
+ "chalk": "^4.0.0",
23
+ "fs-extra": "^4.0.2",
24
+ "minimist": "^1.2.0",
25
+ "puppeteer": "^13.5.1",
26
+ "string-width": "^4.2.0",
27
+ "util.promisify": "^1.1.1",
28
+ "xvfb": "^0.4.0"
29
+ },
30
+ "devDependencies": {
31
+ "@types/fs-extra": "^9.0.3",
32
+ "@types/jest": "^27.4.1",
33
+ "@types/minimist": "^1.2.2",
34
+ "@types/node": "^12.16.3",
35
+ "@types/puppeteer": "^5.4.4",
36
+ "jest": "^27.5.1",
37
+ "ts-jest": "^27.1.4",
38
+ "typescript": "^4.6.3"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/facebookincubator/memlab.git",
43
+ "directory": "packages/e2e"
44
+ },
45
+ "scripts": {
46
+ "build-pkg": "tsc",
47
+ "clean-pkg": "rm -rf ./dist && rm -rf ./node_modules && rm -f ./tsconfig.tsbuildinfo"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/facebookincubator/memlab/issues"
51
+ },
52
+ "homepage": "https://github.com/facebookincubator/memlab#readme"
53
+ }
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web page for e2e tests"
11
+ />
12
+ <title>React App</title>
13
+ <script defer="defer" src="min.js"></script>
14
+ </head>
15
+ <body>
16
+ <div id="root"></div>
17
+ </body>
18
+ </html>