@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.
- package/README.md +11 -0
- package/dist/BaseSynthesizer.d.ts +63 -0
- package/dist/BaseSynthesizer.d.ts.map +1 -0
- package/dist/BaseSynthesizer.js +433 -0
- package/dist/E2EInteractionManager.d.ts +41 -0
- package/dist/E2EInteractionManager.d.ts.map +1 -0
- package/dist/E2EInteractionManager.js +347 -0
- package/dist/TestRunnerLoader.d.ts +16 -0
- package/dist/TestRunnerLoader.d.ts.map +1 -0
- package/dist/TestRunnerLoader.js +41 -0
- package/dist/TypesThirdParty.d.ts +25 -0
- package/dist/TypesThirdParty.d.ts.map +1 -0
- package/dist/TypesThirdParty.js +10 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/lib/E2EUtils.d.ts +59 -0
- package/dist/lib/E2EUtils.d.ts.map +1 -0
- package/dist/lib/E2EUtils.js +286 -0
- package/dist/lib/SynthesisUtils.d.ts +25 -0
- package/dist/lib/SynthesisUtils.d.ts.map +1 -0
- package/dist/lib/SynthesisUtils.js +30 -0
- package/dist/lib/operations/BackOperation.d.ts +17 -0
- package/dist/lib/operations/BackOperation.d.ts.map +1 -0
- package/dist/lib/operations/BackOperation.js +37 -0
- package/dist/lib/operations/BackspaceOperation.d.ts +18 -0
- package/dist/lib/operations/BackspaceOperation.d.ts.map +1 -0
- package/dist/lib/operations/BackspaceOperation.js +36 -0
- package/dist/lib/operations/BaseOperation.d.ts +22 -0
- package/dist/lib/operations/BaseOperation.d.ts.map +1 -0
- package/dist/lib/operations/BaseOperation.js +67 -0
- package/dist/lib/operations/CachePageContent.d.ts +22 -0
- package/dist/lib/operations/CachePageContent.d.ts.map +1 -0
- package/dist/lib/operations/CachePageContent.js +46 -0
- package/dist/lib/operations/ClickOperation.d.ts +36 -0
- package/dist/lib/operations/ClickOperation.d.ts.map +1 -0
- package/dist/lib/operations/ClickOperation.js +131 -0
- package/dist/lib/operations/CompoundOperation.d.ts +20 -0
- package/dist/lib/operations/CompoundOperation.d.ts.map +1 -0
- package/dist/lib/operations/CompoundOperation.js +39 -0
- package/dist/lib/operations/EnterOperation.d.ts +18 -0
- package/dist/lib/operations/EnterOperation.d.ts.map +1 -0
- package/dist/lib/operations/EnterOperation.js +36 -0
- package/dist/lib/operations/EscOperation.d.ts +17 -0
- package/dist/lib/operations/EscOperation.d.ts.map +1 -0
- package/dist/lib/operations/EscOperation.js +36 -0
- package/dist/lib/operations/HoverOperation.d.ts +28 -0
- package/dist/lib/operations/HoverOperation.d.ts.map +1 -0
- package/dist/lib/operations/HoverOperation.js +73 -0
- package/dist/lib/operations/InteractionUtils.d.ts +33 -0
- package/dist/lib/operations/InteractionUtils.d.ts.map +1 -0
- package/dist/lib/operations/InteractionUtils.js +207 -0
- package/dist/lib/operations/Operations.d.ts +25 -0
- package/dist/lib/operations/Operations.d.ts.map +1 -0
- package/dist/lib/operations/Operations.js +45 -0
- package/dist/lib/operations/RevertOperation.d.ts +18 -0
- package/dist/lib/operations/RevertOperation.d.ts.map +1 -0
- package/dist/lib/operations/RevertOperation.js +55 -0
- package/dist/lib/operations/RunJSCode.d.ts +25 -0
- package/dist/lib/operations/RunJSCode.d.ts.map +1 -0
- package/dist/lib/operations/RunJSCode.js +51 -0
- package/dist/lib/operations/ScrollOperation.d.ts +27 -0
- package/dist/lib/operations/ScrollOperation.d.ts.map +1 -0
- package/dist/lib/operations/ScrollOperation.js +85 -0
- package/dist/lib/operations/TargetExtraOperation.d.ts +18 -0
- package/dist/lib/operations/TargetExtraOperation.d.ts.map +1 -0
- package/dist/lib/operations/TargetExtraOperation.js +28 -0
- package/dist/lib/operations/TestPlanner.d.ts +46 -0
- package/dist/lib/operations/TestPlanner.d.ts.map +1 -0
- package/dist/lib/operations/TestPlanner.js +182 -0
- package/dist/lib/operations/TypeOperation.d.ts +29 -0
- package/dist/lib/operations/TypeOperation.d.ts.map +1 -0
- package/dist/lib/operations/TypeOperation.js +64 -0
- package/dist/lib/operations/UploadOperation.d.ts +25 -0
- package/dist/lib/operations/UploadOperation.d.ts.map +1 -0
- package/dist/lib/operations/UploadOperation.js +56 -0
- package/dist/lib/operations/WaitForElementOperation.d.ts +32 -0
- package/dist/lib/operations/WaitForElementOperation.d.ts.map +1 -0
- package/dist/lib/operations/WaitForElementOperation.js +67 -0
- package/dist/lib/operations/WaitOperation.d.ts +19 -0
- package/dist/lib/operations/WaitOperation.d.ts.map +1 -0
- package/dist/lib/operations/WaitOperation.js +42 -0
- package/dist/lib/operations/WithCachedPageContent.d.ts +26 -0
- package/dist/lib/operations/WithCachedPageContent.d.ts.map +1 -0
- package/dist/lib/operations/WithCachedPageContent.js +53 -0
- package/dist/lib/operations/XVirtualFrameBuffer.d.ts +15 -0
- package/dist/lib/operations/XVirtualFrameBuffer.d.ts.map +1 -0
- package/dist/lib/operations/XVirtualFrameBuffer.js +44 -0
- package/dist/plugins/DefaultScenarioSynthesizer.d.ts +23 -0
- package/dist/plugins/DefaultScenarioSynthesizer.d.ts.map +1 -0
- package/dist/plugins/DefaultScenarioSynthesizer.js +61 -0
- package/dist/plugins/TestSPAVisitSynthesizer.d.ts +23 -0
- package/dist/plugins/TestSPAVisitSynthesizer.d.ts.map +1 -0
- package/dist/plugins/TestSPAVisitSynthesizer.js +72 -0
- package/dist/plugins/scenarios/test-airbnb.d.ts +14 -0
- package/dist/plugins/scenarios/test-airbnb.d.ts.map +1 -0
- package/dist/plugins/scenarios/test-airbnb.js +48 -0
- package/dist/plugins/scenarios/test-databricks.d.ts +14 -0
- package/dist/plugins/scenarios/test-databricks.d.ts.map +1 -0
- package/dist/plugins/scenarios/test-databricks.js +40 -0
- package/dist/plugins/scenarios/test-ebay.d.ts +14 -0
- package/dist/plugins/scenarios/test-ebay.d.ts.map +1 -0
- package/dist/plugins/scenarios/test-ebay.js +48 -0
- package/dist/plugins/scenarios/test-google-maps.d.ts +14 -0
- package/dist/plugins/scenarios/test-google-maps.d.ts.map +1 -0
- package/dist/plugins/scenarios/test-google-maps.js +41 -0
- package/dist/plugins/scenarios/test-shopify.d.ts +14 -0
- package/dist/plugins/scenarios/test-shopify.d.ts.map +1 -0
- package/dist/plugins/scenarios/test-shopify.js +40 -0
- package/dist/plugins/scenarios/test-youtube.d.ts +14 -0
- package/dist/plugins/scenarios/test-youtube.d.ts.map +1 -0
- package/dist/plugins/scenarios/test-youtube.js +40 -0
- package/package.json +53 -0
- package/static/links/index.html +18 -0
- package/static/links/min.js +3 -0
- package/static/links/package.json +36 -0
- package/static/links/src/App.js +48 -0
- package/static/links/src/index.js +20 -0
|
@@ -0,0 +1,286 @@
|
|
|
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 fs_1 = __importDefault(require("fs"));
|
|
25
|
+
const core_1 = require("@memlab/core");
|
|
26
|
+
const BaseOperation_1 = __importDefault(require("./operations/BaseOperation"));
|
|
27
|
+
const InteractionUtils_1 = __importDefault(require("./operations/InteractionUtils"));
|
|
28
|
+
const core_2 = require("@memlab/core");
|
|
29
|
+
function checkLastSnapshotChunk(chunk) {
|
|
30
|
+
const regex = /\}\s*$/;
|
|
31
|
+
if (!regex.test(chunk)) {
|
|
32
|
+
core_1.utils.throwError(new Error('resolved `HeapProfiler.takeHeapSnapshot` before writing the last chunk'));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// get URL parameter for a specific step
|
|
36
|
+
function getURLParameter(tab, visitPlan) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const params = visitPlan.URLParameters;
|
|
39
|
+
const stepParams = (_b = (_a = tab.urlParams) === null || _a === void 0 ? void 0 : _a.map(({ name, value }) => [name, value].map(encodeURIComponent).join('=')).join('&')) !== null && _b !== void 0 ? _b : '';
|
|
40
|
+
let ret = params +
|
|
41
|
+
(params.length > 0 && stepParams.length > 0 ? '&' : '') +
|
|
42
|
+
stepParams;
|
|
43
|
+
if (ret.length > 0 && !ret.startsWith('?')) {
|
|
44
|
+
ret = '?' + ret;
|
|
45
|
+
}
|
|
46
|
+
return ret;
|
|
47
|
+
}
|
|
48
|
+
function compareURL(page, url) {
|
|
49
|
+
if (!core_1.config.verbose) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const actual = unescape(page.url());
|
|
53
|
+
url = unescape(url);
|
|
54
|
+
if (!core_1.utils.isURLEqual(url, actual)) {
|
|
55
|
+
core_1.info.warning('URL changed:');
|
|
56
|
+
core_1.info.lowLevel(` Expected: ${url}`);
|
|
57
|
+
core_1.info.lowLevel('----');
|
|
58
|
+
core_1.info.lowLevel(` Actual: ${actual}`);
|
|
59
|
+
core_1.info.lowLevel('');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function logTabProgress(i, visitPlan) {
|
|
63
|
+
const len = visitPlan.tabsOrder.length;
|
|
64
|
+
const tab = visitPlan.tabsOrder[i];
|
|
65
|
+
const progress = `[${i + 1}/${len}]`;
|
|
66
|
+
const tabType = tab.type ? `(${tab.type})` : '';
|
|
67
|
+
const msg = `${progress} visiting ${tab.name} ${tabType}`;
|
|
68
|
+
if (core_1.config.verbose) {
|
|
69
|
+
core_1.info.topLevel(msg);
|
|
70
|
+
}
|
|
71
|
+
core_1.info.topLevel(core_1.serializer.summarizeTabsOrder(visitPlan.tabsOrder, {
|
|
72
|
+
color: true,
|
|
73
|
+
progress: i,
|
|
74
|
+
}));
|
|
75
|
+
core_1.browserInfo.addMarker(`[memlab]: ${msg}`);
|
|
76
|
+
}
|
|
77
|
+
function serializeVisitPlan(visitPlan) {
|
|
78
|
+
fs_1.default.writeFileSync(core_1.config.snapshotSequenceFile, JSON.stringify(visitPlan.tabsOrder, null, 2), 'UTF-8');
|
|
79
|
+
}
|
|
80
|
+
function logMetaData(visitPlan, opt = {}) {
|
|
81
|
+
// save the visiting info to disk
|
|
82
|
+
serializeVisitPlan(visitPlan);
|
|
83
|
+
// save the run meta info to disk
|
|
84
|
+
const runMeta = {
|
|
85
|
+
app: core_1.config.targetApp,
|
|
86
|
+
type: visitPlan.type,
|
|
87
|
+
interaction: core_1.config.targetTab,
|
|
88
|
+
browserInfo: core_1.browserInfo,
|
|
89
|
+
};
|
|
90
|
+
fs_1.default.writeFileSync(core_1.config.runMetaFile, JSON.stringify(runMeta), 'UTF-8');
|
|
91
|
+
// additional post processing of collected data
|
|
92
|
+
if (opt.final) {
|
|
93
|
+
core_1.config.runningMode.postProcessData(visitPlan);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function setPermissions(page, origin) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
if (origin === '' || origin == null) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const browser = page.browser();
|
|
102
|
+
const context = browser.defaultBrowserContext();
|
|
103
|
+
yield context.overridePermissions(origin, core_1.config.grantedPermissions);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// check if the URL is correct
|
|
107
|
+
function checkURL(page, intendedURL) {
|
|
108
|
+
compareURL(page, intendedURL);
|
|
109
|
+
}
|
|
110
|
+
function injectPageReloadChecker(page) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
yield page.evaluate(() => {
|
|
113
|
+
// @ts-expect-error TODO: add Window shim type
|
|
114
|
+
window.__memlab_check_reload = 1;
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function checkPageReload(page) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
// @ts-expect-error TODO: add Window shim type
|
|
121
|
+
const flag = yield page.evaluate(() => window.__memlab_check_reload);
|
|
122
|
+
if (flag !== 1) {
|
|
123
|
+
core_1.utils.haltOrThrow('The page is reloaded. MemLab cannot analyze heap across page reloads. ' +
|
|
124
|
+
'Please remove window.reload() calls or disable any reload logic.');
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function maybeWaitForConsoleInput(stepId) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
if (core_1.config.isManualDebug) {
|
|
131
|
+
yield core_1.info.waitForConsole(`Press Enter (or Return) to continue step-${stepId}:`);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function applyAsyncWithGuard(f, self, args,
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
137
|
+
exceptionHandler = (_ex) => {
|
|
138
|
+
/*noop*/
|
|
139
|
+
}) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
let ret;
|
|
142
|
+
try {
|
|
143
|
+
ret = yield f.apply(self, args);
|
|
144
|
+
}
|
|
145
|
+
catch (ex) {
|
|
146
|
+
exceptionHandler(core_1.utils.getError(ex));
|
|
147
|
+
}
|
|
148
|
+
return ret;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function applyAsyncWithRetry(f, self, args, options = {}) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
options.retry = options.retry || 0;
|
|
154
|
+
const retry = options.retry;
|
|
155
|
+
const exceptionHandler = (ex) => __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
if (retry <= 0 || core_1.config.verbose) {
|
|
157
|
+
// if the browser UI is enabled, MemLab should wait for a while
|
|
158
|
+
// so we can have a chance to manually inspect the page
|
|
159
|
+
if (core_1.config.openDevtoolsConsole) {
|
|
160
|
+
yield InteractionUtils_1.default.waitFor(core_1.config.delayBeforeExitUponException);
|
|
161
|
+
}
|
|
162
|
+
core_1.utils.haltOrThrow(core_1.utils.getError(ex), {
|
|
163
|
+
printCallback: () => {
|
|
164
|
+
core_1.info.warning('interaction fail');
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
core_1.info.warning(`interaction fail, making ${retry} more attempt(s)...`);
|
|
169
|
+
if (!!options.delayBeforeRetry && options.delayBeforeRetry > 0) {
|
|
170
|
+
yield InteractionUtils_1.default.waitFor(options.delayBeforeRetry);
|
|
171
|
+
}
|
|
172
|
+
if (options.retry) {
|
|
173
|
+
options.retry--;
|
|
174
|
+
}
|
|
175
|
+
yield applyAsyncWithRetry(f, self, args, options);
|
|
176
|
+
});
|
|
177
|
+
yield applyAsyncWithGuard(f, self, args, exceptionHandler);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function clearConsole(page) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
if (core_1.config.clearConsole) {
|
|
183
|
+
yield page.evaluate(() => {
|
|
184
|
+
try {
|
|
185
|
+
console.clear();
|
|
186
|
+
}
|
|
187
|
+
catch (_a) {
|
|
188
|
+
// do nothing
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function dispatchOperation(page, operation, opArgs) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
if (!(operation instanceof BaseOperation_1.default)) {
|
|
197
|
+
throw core_1.utils.haltOrThrow(`unknown operation: ${operation}`);
|
|
198
|
+
}
|
|
199
|
+
yield operation.do(page, opArgs);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function waitExtraForTab(tabInfo) {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
+
let delay = 0;
|
|
205
|
+
const mode = core_1.config.runningMode;
|
|
206
|
+
if (tabInfo.type === 'target') {
|
|
207
|
+
if (!mode.shouldExtraWaitForTarget(tabInfo)) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
delay += core_1.config.extraWaitingForTarget;
|
|
211
|
+
}
|
|
212
|
+
else if (tabInfo.type === 'final') {
|
|
213
|
+
if (!mode.shouldExtraWaitForFinal(tabInfo)) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
delay += core_1.config.extraWaitingForFinal;
|
|
217
|
+
}
|
|
218
|
+
// wait for extra time
|
|
219
|
+
if (delay > 0) {
|
|
220
|
+
core_1.info.overwrite(`wait extra ${delay / 1000}s for ${tabInfo.type} page...`);
|
|
221
|
+
yield InteractionUtils_1.default.waitFor(delay);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function getNavigationHistoryLength(page) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
return yield page.evaluate(() => {
|
|
228
|
+
let ret = -1;
|
|
229
|
+
try {
|
|
230
|
+
ret = history.length;
|
|
231
|
+
}
|
|
232
|
+
catch (e) {
|
|
233
|
+
// do nothing
|
|
234
|
+
}
|
|
235
|
+
return ret;
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
// const allocFile = path.join(config.curDataDir, 'Heap-alloc.json');
|
|
240
|
+
// await startTrackingHeapAllocation(page, allocFile);
|
|
241
|
+
function startTrackingHeapAllocation(page, file) {
|
|
242
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
243
|
+
const heap = '';
|
|
244
|
+
fs_1.default.writeFileSync(file, heap, 'UTF-8');
|
|
245
|
+
core_1.info.lowLevel('tracking heap allocation...');
|
|
246
|
+
const cdpSession = yield page.target().createCDPSession();
|
|
247
|
+
cdpSession.on('HeapProfiler.addHeapSnapshotChunk', data => {
|
|
248
|
+
fs_1.default.appendFileSync(file, data.chunk, 'UTF-8');
|
|
249
|
+
});
|
|
250
|
+
yield cdpSession.send('HeapProfiler.startTrackingHeapObjects', {
|
|
251
|
+
trackAllocations: true,
|
|
252
|
+
});
|
|
253
|
+
yield InteractionUtils_1.default.waitFor(30000);
|
|
254
|
+
return cdpSession;
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function getScenarioAppName(scenario = null) {
|
|
258
|
+
if (!scenario || !scenario.app) {
|
|
259
|
+
return getScenarioDefaultAppName();
|
|
260
|
+
}
|
|
261
|
+
return scenario.app();
|
|
262
|
+
}
|
|
263
|
+
function getScenarioDefaultAppName() {
|
|
264
|
+
return 'default-app-for-scenario';
|
|
265
|
+
}
|
|
266
|
+
exports.default = (0, core_2.setInternalValue)({
|
|
267
|
+
applyAsyncWithGuard,
|
|
268
|
+
applyAsyncWithRetry,
|
|
269
|
+
checkLastSnapshotChunk,
|
|
270
|
+
checkPageReload,
|
|
271
|
+
checkURL,
|
|
272
|
+
clearConsole,
|
|
273
|
+
compareURL,
|
|
274
|
+
dispatchOperation,
|
|
275
|
+
getNavigationHistoryLength,
|
|
276
|
+
getScenarioAppName,
|
|
277
|
+
getURLParameter,
|
|
278
|
+
injectPageReloadChecker,
|
|
279
|
+
logMetaData,
|
|
280
|
+
logTabProgress,
|
|
281
|
+
maybeWaitForConsoleInput,
|
|
282
|
+
serializeVisitPlan,
|
|
283
|
+
setPermissions,
|
|
284
|
+
startTrackingHeapAllocation,
|
|
285
|
+
waitExtraForTab,
|
|
286
|
+
}, __filename, core_2.constant.internalDir);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @emails oncall+ws_labs
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
import BackOperation from './operations/BackOperation';
|
|
11
|
+
import RevertOperation from './operations/RevertOperation';
|
|
12
|
+
declare const _default: {
|
|
13
|
+
backStep: {
|
|
14
|
+
name: string;
|
|
15
|
+
url: string;
|
|
16
|
+
interactions: BackOperation[];
|
|
17
|
+
};
|
|
18
|
+
revertStep: {
|
|
19
|
+
name: string;
|
|
20
|
+
url: string;
|
|
21
|
+
interactions: RevertOperation[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=SynthesisUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SynthesisUtils.d.ts","sourceRoot":"","sources":["../../src/lib/SynthesisUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,eAAe,MAAM,8BAA8B,CAAC;;;;;;;;;;;;;AAc3D,wBAGE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BackOperation_1 = __importDefault(require("./operations/BackOperation"));
|
|
16
|
+
const RevertOperation_1 = __importDefault(require("./operations/RevertOperation"));
|
|
17
|
+
const backStep = {
|
|
18
|
+
name: 'back',
|
|
19
|
+
url: '',
|
|
20
|
+
interactions: [new BackOperation_1.default()],
|
|
21
|
+
};
|
|
22
|
+
const revertStep = {
|
|
23
|
+
name: 'revert',
|
|
24
|
+
url: '',
|
|
25
|
+
interactions: [new RevertOperation_1.default()],
|
|
26
|
+
};
|
|
27
|
+
exports.default = {
|
|
28
|
+
backStep,
|
|
29
|
+
revertStep,
|
|
30
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @emails oncall+ws_labs
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
import BaseOperation from './BaseOperation';
|
|
11
|
+
import type { Page } from 'puppeteer';
|
|
12
|
+
export default class BackOperation extends BaseOperation {
|
|
13
|
+
kind: string;
|
|
14
|
+
constructor();
|
|
15
|
+
act(page: Page): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=BackOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackOperation.d.ts","sourceRoot":"","sources":["../../../src/lib/operations/BackOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,aAAa;IACtD,IAAI,EAAE,MAAM,CAAC;;IAOP,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 BaseOperation_1 = __importDefault(require("./BaseOperation"));
|
|
25
|
+
const core_1 = require("@memlab/core");
|
|
26
|
+
class BackOperation extends BaseOperation_1.default {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.kind = 'back';
|
|
30
|
+
}
|
|
31
|
+
act(page) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
page.goBack({ timeout: core_1.config.presenceCheckTimeout || 120000 });
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = BackOperation;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @emails oncall+ws_labs
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
import BaseOperation from './BaseOperation';
|
|
11
|
+
import type { Page } from 'puppeteer';
|
|
12
|
+
declare class BackspaceOperation extends BaseOperation {
|
|
13
|
+
kind: string;
|
|
14
|
+
constructor();
|
|
15
|
+
act(page: Page): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export default BackspaceOperation;
|
|
18
|
+
//# sourceMappingURL=BackspaceOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackspaceOperation.d.ts","sourceRoot":"","sources":["../../../src/lib/operations/BackspaceOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAEpC,cAAM,kBAAmB,SAAQ,aAAa;IAC5C,IAAI,EAAE,MAAM,CAAC;;IAOP,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 BaseOperation_1 = __importDefault(require("./BaseOperation"));
|
|
25
|
+
class BackspaceOperation extends BaseOperation_1.default {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.kind = 'backspace';
|
|
29
|
+
}
|
|
30
|
+
act(page) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
yield page.keyboard.press('Backspace');
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.default = BackspaceOperation;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @emails oncall+ws_labs
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
import type { Page } from 'puppeteer';
|
|
11
|
+
import type { E2EOperation, OperationArgs } from '@memlab/core';
|
|
12
|
+
declare abstract class BaseOperation implements E2EOperation {
|
|
13
|
+
kind: string;
|
|
14
|
+
selector: string;
|
|
15
|
+
protected optional: boolean;
|
|
16
|
+
constructor();
|
|
17
|
+
protected log(msg: string): void;
|
|
18
|
+
do(page: Page, opArgs?: OperationArgs): Promise<void>;
|
|
19
|
+
act(_page: Page, _opArgs?: OperationArgs): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export default BaseOperation;
|
|
22
|
+
//# sourceMappingURL=BaseOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseOperation.d.ts","sourceRoot":"","sources":["../../../src/lib/operations/BaseOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAI9D,uBAAe,aAAc,YAAW,YAAY;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,QAAQ,UAAS;;IAO3B,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQ1B,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBzD,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAKnE;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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 core_1 = require("@memlab/core");
|
|
25
|
+
const InteractionUtils_1 = __importDefault(require("./InteractionUtils"));
|
|
26
|
+
let opId = 1; // operation index used in debug mode
|
|
27
|
+
class BaseOperation {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.optional = false;
|
|
30
|
+
this.kind = 'abstract';
|
|
31
|
+
this.selector = '';
|
|
32
|
+
}
|
|
33
|
+
log(msg) {
|
|
34
|
+
if (core_1.config.verbose) {
|
|
35
|
+
core_1.info.lowLevel(msg);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
core_1.info.overwrite(msg);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
do(page, opArgs = {}) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (core_1.config.verbose && core_1.config.runningMode.shouldTakeScreenShot()) {
|
|
44
|
+
yield InteractionUtils_1.default.screenshot(page, `${++opId}-${this.kind}`);
|
|
45
|
+
}
|
|
46
|
+
if (this.selector !== '') {
|
|
47
|
+
yield InteractionUtils_1.default.waitForSelector(page, this.selector, 'exist', this.optional);
|
|
48
|
+
}
|
|
49
|
+
yield this.act(page, opArgs);
|
|
50
|
+
const isPageLoaded = opArgs.isPageLoaded;
|
|
51
|
+
yield InteractionUtils_1.default.waitUntilLoaded(page, {
|
|
52
|
+
isPageLoaded,
|
|
53
|
+
noWaitAfterPageLoad: true,
|
|
54
|
+
});
|
|
55
|
+
yield InteractionUtils_1.default.waitFor(core_1.config.waitAfterOperation);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
59
|
+
act(_page, _opArgs = {}) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const error = new Error('BaseOperation.act can not be called.');
|
|
62
|
+
error.stack;
|
|
63
|
+
throw error;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.default = BaseOperation;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @emails oncall+ws_labs
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
import type { Page } from 'puppeteer';
|
|
11
|
+
import type { AnyValue } from '@memlab/core';
|
|
12
|
+
import BaseOperation from './BaseOperation';
|
|
13
|
+
declare type PageFunction = (page: Page) => Promise<AnyValue>;
|
|
14
|
+
declare class CachePageContent extends BaseOperation {
|
|
15
|
+
kind: string;
|
|
16
|
+
private pageFunction;
|
|
17
|
+
private varName;
|
|
18
|
+
constructor(pageFunction: PageFunction, varName: string);
|
|
19
|
+
act(page: Page): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export default CachePageContent;
|
|
22
|
+
//# sourceMappingURL=CachePageContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CachePageContent.d.ts","sourceRoot":"","sources":["../../../src/lib/operations/CachePageContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAG3C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,aAAK,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAKtD,cAAM,gBAAiB,SAAQ,aAAa;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,OAAO,CAAS;gBAEZ,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM;IAOjD,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAWrC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 core_1 = require("@memlab/core");
|
|
25
|
+
const BaseOperation_1 = __importDefault(require("./BaseOperation"));
|
|
26
|
+
// Takes a pageFunction and variable name,
|
|
27
|
+
// calls the pageFunction with the argument 'page',
|
|
28
|
+
// and saves the result to the utils.memCache object with varName as the key
|
|
29
|
+
class CachePageContent extends BaseOperation_1.default {
|
|
30
|
+
constructor(pageFunction, varName) {
|
|
31
|
+
super();
|
|
32
|
+
this.kind = 'cache-page-content';
|
|
33
|
+
this.pageFunction = pageFunction;
|
|
34
|
+
this.varName = varName;
|
|
35
|
+
}
|
|
36
|
+
act(page) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const varValue = yield this.pageFunction(page);
|
|
39
|
+
if (varValue == null) {
|
|
40
|
+
core_1.utils.haltOrThrow(`CachePageContent: Provided pageFunction returned ${varValue}`);
|
|
41
|
+
}
|
|
42
|
+
core_1.utils.memCache[this.varName] = varValue;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = CachePageContent;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @emails oncall+ws_labs
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
import type { Page } from 'puppeteer';
|
|
11
|
+
import type { AnyOptions, Optional } from '@memlab/core';
|
|
12
|
+
import BaseOperation from './BaseOperation';
|
|
13
|
+
declare type PageFunction = (page: Page) => Promise<void>;
|
|
14
|
+
declare type IfPageFunction = (page: Page) => Promise<boolean>;
|
|
15
|
+
declare class ClickOperation extends BaseOperation {
|
|
16
|
+
kind: string;
|
|
17
|
+
selector: string;
|
|
18
|
+
delay: Optional<number>;
|
|
19
|
+
waitFor: Optional<string | PageFunction>;
|
|
20
|
+
clickCount: Optional<number>;
|
|
21
|
+
indexInMatches: Optional<number>;
|
|
22
|
+
if: Optional<string | IfPageFunction>;
|
|
23
|
+
constructor(selector: string, args?: AnyOptions & {
|
|
24
|
+
delay?: number;
|
|
25
|
+
waitFor?: string | PageFunction;
|
|
26
|
+
clickCount?: number;
|
|
27
|
+
indexInMatches?: number;
|
|
28
|
+
if?: string | IfPageFunction;
|
|
29
|
+
});
|
|
30
|
+
_shouldClick(page: Page): Promise<boolean>;
|
|
31
|
+
private useContains;
|
|
32
|
+
private clickElement;
|
|
33
|
+
act(page: Page): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export default ClickOperation;
|
|
36
|
+
//# sourceMappingURL=ClickOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClickOperation.d.ts","sourceRoot":"","sources":["../../../src/lib/operations/ClickOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAGvD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,aAAK,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAClD,aAAK,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvD,cAAM,cAAe,SAAQ,aAAa;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,EAAE,QAAQ,CAAC,MAAM,GAAG,YAAY,CAAC,CAAC;IACzC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7B,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,EAAE,EAAE,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC;gBAGpC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,UAAU,GAAG;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;QAChC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,EAAE,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;KACzB;IAgBF,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;IAsBhD,OAAO,CAAC,WAAW;YAKL,YAAY;IAgCpB,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CA0CrC;AAED,eAAe,cAAc,CAAC"}
|