@mablhq/mabl-cli 1.12.24 → 1.13.17
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/api/basicApiClient.js +63 -26
- package/api/mablApiClient.js +9 -9
- package/api/mablApiClientFactory.js +1 -0
- package/auth/AuthClient.js +1 -4
- package/browserLauncher/browserLauncherFactory.js +7 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +6 -2
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +60 -20
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +24 -17
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpResponse.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +72 -68
- package/browserLauncher/playwrightBrowserLauncher/wrappers.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +7 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +13 -7
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +7 -7
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +4 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +3 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +23 -16
- package/browserLauncher/puppeteerBrowserLauncher/wrappers.js +1 -1
- package/browserLauncher/types.js +6 -1
- package/cli.js +6 -4
- package/commands/applications/applications_cmds/list.js +1 -1
- package/commands/branches/branches_cmds/create.js +1 -1
- package/commands/branches/branches_cmds/list.js +1 -1
- package/commands/branches/branches_cmds/merge.js +1 -1
- package/commands/commandUtil/awaitCompletion.js +2 -2
- package/commands/commandUtil/codeInsights.js +6 -6
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +12 -12
- package/commands/config/config_cmds/list.js +1 -1
- package/commands/constants.js +1 -1
- package/commands/credentials/credentials_cmds/list.js +1 -1
- package/commands/deploy/deploy_cmds/create.js +2 -2
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +7 -7
- package/commands/deploy/deploy_cmds/list.js +1 -1
- package/commands/environments/environments_cmds/create.js +3 -3
- package/commands/environments/environments_cmds/list.js +1 -1
- package/commands/environments/environments_cmds/urls_cmds/add.js +1 -1
- package/commands/flows/flows_cmds/list.js +1 -1
- package/commands/plans/plans_cmds/list.js +1 -1
- package/commands/test-runs/test-runs_cmds/export.js +1 -1
- package/commands/tests/executionUtil.js +1 -1
- package/commands/tests/testsUtil.js +16 -20
- package/commands/tests/tests_cmds/edit.js +1 -1
- package/commands/tests/tests_cmds/export.js +1 -1
- package/commands/tests/tests_cmds/import.js +13 -13
- package/commands/tests/tests_cmds/list.js +2 -2
- package/commands/tests/tests_cmds/run-alpha.js +1 -1
- package/commands/tests/tests_cmds/run-cloud.js +7 -7
- package/commands/tests/tests_cmds/run-legacy.js +2 -2
- package/commands/tests/tests_cmds/run.js +25 -7
- package/commands/workspaces/workspace_cmds/copy.js +1 -1
- package/commands/workspaces/workspace_cmds/list.js +1 -1
- package/configGenerators/flowConfigGenerator.js +3 -3
- package/configGenerators/selIdeGenerator.js +1 -1
- package/configGenerators/testConfigGenerator.js +7 -8
- package/core/execution/ApiTestUtils.js +2 -2
- package/core/trainer/openUtils.js +47 -0
- package/core/trainer/trainingSessions.js +36 -61
- package/env/defaultEnv.js +2 -1
- package/env/dev.js +2 -1
- package/env/env.js +3 -1
- package/env/local.js +2 -1
- package/env/prod.js +2 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +12 -0
- package/index.d.ts +7 -0
- package/mablscript/MablStep.js +11 -7
- package/mablscript/actions/ConditionAction.js +2 -4
- package/mablscript/actions/FindAction.js +4 -4
- package/mablscript/importer.js +16 -14
- package/mablscript/steps/AccessibilityCheck.js +88 -0
- package/mablscript/steps/AssertStep.js +6 -5
- package/mablscript/steps/CreateVariableStep.js +2 -3
- package/mablscript/steps/DownloadStep.js +1 -2
- package/mablscript/steps/EnterTextStep.js +2 -1
- package/mablscript/steps/IfConditionStep.js +3 -3
- package/mablscript/steps/SendHttpRequestStep.js +11 -3
- package/mablscript/steps/SendKeyStep.js +2 -2
- package/mablscript/steps/SetFilesStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +2 -1
- package/mablscript/types/AccessibilityCheckStepDescriptor.js +2 -0
- package/mablscript/types/AccessibilityCheckTypes.js +9 -0
- package/mablscript/types/VariableDataType.js +1 -8
- package/mablscript/types/VariableNamespace.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/package.json +8 -6
- package/popupDismissal/index.js +36 -30
- package/providers/authenticationProvider.js +2 -3
- package/providers/cliConfigProvider.js +1 -1
- package/providers/exportRequestProvider.js +1 -1
- package/providers/logging/loggingProvider.js +2 -2
- package/providers/scmContextProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +10 -6
- package/reporters/reporter.js +1 -1
- package/resources/mablFind.js +1 -1
- package/resources/popupDismissal.js +1 -1
- package/util/RichPromise.js +2 -2
- package/util/actionabilityUtil.js +59 -9
- package/util/asyncUtil.js +45 -0
- package/util/downloadUtil.js +1 -1
- package/util/logUtils.js +22 -3
- package/util/markdownUtil.js +3 -3
- package/util/pureUtil.js +6 -6
- package/util/resourceUtil.js +18 -1
- package/core/trainer/trainerBrowserUtil.js +0 -33
package/api/basicApiClient.js
CHANGED
|
@@ -28,8 +28,12 @@ const httpUtil_1 = require("../util/httpUtil");
|
|
|
28
28
|
const axios_1 = __importDefault(require("axios"));
|
|
29
29
|
const os = __importStar(require("os"));
|
|
30
30
|
const async_retry_1 = __importDefault(require("async-retry"));
|
|
31
|
+
const logUtils_1 = require("../util/logUtils");
|
|
32
|
+
const asyncUtil_1 = require("../util/asyncUtil");
|
|
31
33
|
const MABL_ENTITY_VERSION_HEADER = 'x-mabl-entity-version';
|
|
32
|
-
const
|
|
34
|
+
const DEFAULT_REQUEST_TIMEOUT_MILLISECONDS = 60000;
|
|
35
|
+
const DEFAULT_RETRIES = 5;
|
|
36
|
+
const DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS = DEFAULT_REQUEST_TIMEOUT_MILLISECONDS * DEFAULT_RETRIES;
|
|
33
37
|
const DEFAULT_MIN_RETRY_TIMEOUT_MILLISECONDS = 100;
|
|
34
38
|
const DEFAULT_MAX_RETRY_TIMEOUT_MILLISECONDS = 1000;
|
|
35
39
|
var AuthType;
|
|
@@ -39,10 +43,12 @@ var AuthType;
|
|
|
39
43
|
})(AuthType = exports.AuthType || (exports.AuthType = {}));
|
|
40
44
|
class BasicApiClient {
|
|
41
45
|
constructor(options) {
|
|
46
|
+
var _a, _b;
|
|
42
47
|
const config = httpUtil_1.axiosProxyConfig({
|
|
43
48
|
sslVerify: options.sslVerify,
|
|
44
49
|
proxyHost: options.proxyUrl,
|
|
45
50
|
});
|
|
51
|
+
config.timeout = (_a = options.requestTimeoutMillis) !== null && _a !== void 0 ? _a : DEFAULT_REQUEST_TIMEOUT_MILLISECONDS;
|
|
46
52
|
switch (options.authType) {
|
|
47
53
|
case AuthType.ApiKey:
|
|
48
54
|
config.auth = {
|
|
@@ -64,23 +70,27 @@ class BasicApiClient {
|
|
|
64
70
|
'x-mabl-user-platform': `${os.platform()}-${os.release()}`,
|
|
65
71
|
},
|
|
66
72
|
};
|
|
73
|
+
if (options.userAgentOverride) {
|
|
74
|
+
config.headers[httpUtil_1.USER_AGENT_HEADER] = options.userAgentOverride;
|
|
75
|
+
}
|
|
67
76
|
this.httpClient = axios_1.default.create(config);
|
|
68
77
|
this.retryConfig = options.retryConfig;
|
|
78
|
+
this.debugLogger = (_b = options.debugLogger) !== null && _b !== void 0 ? _b : logUtils_1.logInternal;
|
|
69
79
|
}
|
|
70
|
-
|
|
71
|
-
return this.retryWrappedRequest(
|
|
80
|
+
makeGetRequest(path) {
|
|
81
|
+
return this.retryWrappedRequest(`makeGetRequest('${path}')`, () => this.getRequest(path));
|
|
72
82
|
}
|
|
73
83
|
async getRequest(path) {
|
|
74
|
-
const response = await this.httpClient.get(path);
|
|
84
|
+
const response = await this.debugRequest('GET', path, () => this.httpClient.get(path));
|
|
75
85
|
BasicApiClient.checkResponseStatusCode(response);
|
|
76
86
|
return response.data;
|
|
77
87
|
}
|
|
78
|
-
|
|
79
|
-
return this.retryWrappedRequest(
|
|
88
|
+
makeGetRequestWithETag(path) {
|
|
89
|
+
return this.retryWrappedRequest(`makeGetRequestWithETag('${path}')`, () => this.getRequestWithETag(path));
|
|
80
90
|
}
|
|
81
91
|
async getRequestWithETag(path) {
|
|
82
92
|
var _a;
|
|
83
|
-
const response = await this.httpClient.get(path);
|
|
93
|
+
const response = await this.debugRequest('GET', path, () => this.httpClient.get(path));
|
|
84
94
|
BasicApiClient.checkResponseStatusCode(response);
|
|
85
95
|
const headers = response.headers;
|
|
86
96
|
const result = response.data;
|
|
@@ -91,58 +101,85 @@ class BasicApiClient {
|
|
|
91
101
|
return { ...result, entity_version: versionHeader };
|
|
92
102
|
}
|
|
93
103
|
async makePostRequest(path, requestBody, requestConfig) {
|
|
94
|
-
const response = await this.httpClient.post(path, requestBody, requestConfig);
|
|
104
|
+
const response = await this.debugRequest('POST', path, () => this.httpClient.post(path, requestBody, requestConfig));
|
|
95
105
|
BasicApiClient.checkResponseStatusCode(response);
|
|
96
106
|
return response.data;
|
|
97
107
|
}
|
|
98
108
|
async makePutRequest(path, requestBody) {
|
|
99
|
-
const response = await this.httpClient.put(path, requestBody);
|
|
109
|
+
const response = await this.debugRequest('PUT', path, () => this.httpClient.put(path, requestBody));
|
|
100
110
|
BasicApiClient.checkResponseStatusCode(response);
|
|
101
111
|
return response.data;
|
|
102
112
|
}
|
|
103
|
-
|
|
104
|
-
return this.retryWrappedRequest(
|
|
113
|
+
makeDeleteRequest(path) {
|
|
114
|
+
return this.retryWrappedRequest(`makeDeleteRequest('${path}')`, () => this.deleteRequest(path));
|
|
105
115
|
}
|
|
106
116
|
async deleteRequest(path) {
|
|
107
|
-
const response = await this.
|
|
117
|
+
const response = await this.debugRequest('DELETE', path, () => this.deleteRequest(path));
|
|
108
118
|
BasicApiClient.checkResponseStatusCode(response);
|
|
109
119
|
return response.data;
|
|
110
120
|
}
|
|
111
121
|
async makePatchRequest(path, requestBody, ifMatch) {
|
|
112
122
|
const extraConfig = ifMatch ? { headers: { 'If-Match': ifMatch } } : {};
|
|
113
|
-
const response = await this.httpClient.patch(path, requestBody, extraConfig);
|
|
123
|
+
const response = await this.debugRequest('PATCH', path, () => this.httpClient.patch(path, requestBody, extraConfig));
|
|
114
124
|
BasicApiClient.checkResponseStatusCode(response);
|
|
115
125
|
return response.data;
|
|
116
126
|
}
|
|
127
|
+
async debugRequest(method, path, request) {
|
|
128
|
+
const startTimeMillis = Date.now();
|
|
129
|
+
let responseCode;
|
|
130
|
+
let error;
|
|
131
|
+
try {
|
|
132
|
+
this.debugLogger(`API Client: Sending ${method} ${path}`);
|
|
133
|
+
const response = await request();
|
|
134
|
+
responseCode = response.status;
|
|
135
|
+
return response;
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
error = e;
|
|
139
|
+
throw e;
|
|
140
|
+
}
|
|
141
|
+
finally {
|
|
142
|
+
this.debugLogger(`API Client: ${method} ${path} ${error ? 'failed' : 'completed'} in ${Date.now() - startTimeMillis}ms with ${responseCode !== null && responseCode !== void 0 ? responseCode : error}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
117
145
|
static checkResponseStatusCode(response) {
|
|
118
146
|
const statusCode = response.status;
|
|
119
147
|
if (!statusCode || statusCode >= 400) {
|
|
120
148
|
throw new ApiError_1.ApiError(`[${statusCode} - ${response.statusText}]`, statusCode);
|
|
121
149
|
}
|
|
122
150
|
}
|
|
123
|
-
retryWrappedRequest(requestFunc) {
|
|
151
|
+
retryWrappedRequest(description, requestFunc) {
|
|
124
152
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
125
153
|
const retryOptions = {
|
|
126
|
-
retries: (_b = (_a = this.retryConfig) === null || _a === void 0 ? void 0 : _a.retryCount) !== null && _b !== void 0 ? _b :
|
|
154
|
+
retries: (_b = (_a = this.retryConfig) === null || _a === void 0 ? void 0 : _a.retryCount) !== null && _b !== void 0 ? _b : DEFAULT_RETRIES,
|
|
127
155
|
minTimeout: (_d = (_c = this.retryConfig) === null || _c === void 0 ? void 0 : _c.minTimeoutMillis) !== null && _d !== void 0 ? _d : DEFAULT_MIN_RETRY_TIMEOUT_MILLISECONDS,
|
|
128
156
|
maxTimeout: (_f = (_e = this.retryConfig) === null || _e === void 0 ? void 0 : _e.maxTimeoutMillis) !== null && _f !== void 0 ? _f : DEFAULT_MAX_RETRY_TIMEOUT_MILLISECONDS,
|
|
129
157
|
maxRetryTime: (_h = (_g = this.retryConfig) === null || _g === void 0 ? void 0 : _g.maxRetryTimeMillis) !== null && _h !== void 0 ? _h : DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS,
|
|
158
|
+
onRetry: (error) => {
|
|
159
|
+
this.debugLogger(`Retrying failed API request "${description}"`, error);
|
|
160
|
+
},
|
|
130
161
|
forever: false,
|
|
131
162
|
};
|
|
132
|
-
return async_retry_1.default(async (bail) =>
|
|
163
|
+
return asyncUtil_1.promiseWithTimeout(async_retry_1.default(async (bail) => {
|
|
133
164
|
var _a, _b;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
statusCode === 502 ||
|
|
137
|
-
statusCode === 503 ||
|
|
138
|
-
statusCode === 504) {
|
|
139
|
-
throw error;
|
|
165
|
+
try {
|
|
166
|
+
return await requestFunc();
|
|
140
167
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
168
|
+
catch (error) {
|
|
169
|
+
const axiosError = error;
|
|
170
|
+
const statusCode = (_a = axiosError.code) !== null && _a !== void 0 ? _a : (_b = axiosError.response) === null || _b === void 0 ? void 0 : _b.status;
|
|
171
|
+
if (statusCode === 429 ||
|
|
172
|
+
statusCode === 502 ||
|
|
173
|
+
statusCode === 503 ||
|
|
174
|
+
statusCode === 504) {
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
bail(error);
|
|
179
|
+
return {};
|
|
180
|
+
}
|
|
144
181
|
}
|
|
145
|
-
}), retryOptions);
|
|
182
|
+
}, retryOptions), retryOptions.maxRetryTime + retryOptions.maxTimeout, 'Retryable API request');
|
|
146
183
|
}
|
|
147
184
|
}
|
|
148
185
|
exports.BasicApiClient = BasicApiClient;
|
package/api/mablApiClient.js
CHANGED
|
@@ -67,7 +67,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
67
67
|
organization_id: workspaceId,
|
|
68
68
|
limit,
|
|
69
69
|
});
|
|
70
|
-
const applications = await this.makeGetRequest(`${env_1.BASE_API_URL}/applications?${applicationQueryString}`).then(result => { var _a; return (_a = result.applications) !== null && _a !== void 0 ? _a : []; });
|
|
70
|
+
const applications = await this.makeGetRequest(`${env_1.BASE_API_URL}/applications?${applicationQueryString}`).then((result) => { var _a; return (_a = result.applications) !== null && _a !== void 0 ? _a : []; });
|
|
71
71
|
sortTemporallyAscending(applications);
|
|
72
72
|
return applications;
|
|
73
73
|
}
|
|
@@ -117,7 +117,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
117
117
|
organization_id: workspaceId,
|
|
118
118
|
limit,
|
|
119
119
|
});
|
|
120
|
-
const environments = await this.makeGetRequest(`${env_1.BASE_API_URL}/v1/environments/?${environmentQueryString}`).then(result => { var _a; return (_a = result.environments) !== null && _a !== void 0 ? _a : []; });
|
|
120
|
+
const environments = await this.makeGetRequest(`${env_1.BASE_API_URL}/v1/environments/?${environmentQueryString}`).then((result) => { var _a; return (_a = result.environments) !== null && _a !== void 0 ? _a : []; });
|
|
121
121
|
sortTemporallyAscending(environments);
|
|
122
122
|
return environments;
|
|
123
123
|
}
|
|
@@ -170,7 +170,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
170
170
|
organization_id: workspaceId,
|
|
171
171
|
limit,
|
|
172
172
|
});
|
|
173
|
-
return await this.makeGetRequest(`${env_1.BASE_API_URL}/credentials?${credentialsQueryString}`).then(result => { var _a; return (_a = result.credentials) !== null && _a !== void 0 ? _a : []; });
|
|
173
|
+
return await this.makeGetRequest(`${env_1.BASE_API_URL}/credentials?${credentialsQueryString}`).then((result) => { var _a; return (_a = result.credentials) !== null && _a !== void 0 ? _a : []; });
|
|
174
174
|
}
|
|
175
175
|
catch (error) {
|
|
176
176
|
throw toApiError(`Failed to get credentials`, error);
|
|
@@ -190,7 +190,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
190
190
|
workspace_id: workspaceId,
|
|
191
191
|
limit,
|
|
192
192
|
});
|
|
193
|
-
return await this.makeGetRequest(`${env_1.BASE_API_URL}/events/deployment?${deploymentQueryString}`).then(result => { var _a; return (_a = result.deployments) !== null && _a !== void 0 ? _a : []; });
|
|
193
|
+
return await this.makeGetRequest(`${env_1.BASE_API_URL}/events/deployment?${deploymentQueryString}`).then((result) => { var _a; return (_a = result.deployments) !== null && _a !== void 0 ? _a : []; });
|
|
194
194
|
}
|
|
195
195
|
catch (error) {
|
|
196
196
|
throw toApiError(`Failed to get deployment events`, error);
|
|
@@ -245,7 +245,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
245
245
|
}
|
|
246
246
|
async getTestOverrides(testId, environmentId, selectorOverrideLimit = 10) {
|
|
247
247
|
try {
|
|
248
|
-
return await this.makeGetRequest(`${env_1.BASE_API_URL}/tests/testScripts/${testId}/overrides?environment_id=${environmentId}&selector_override_limit=${selectorOverrideLimit}`).then(result => { var _a; return (_a = result.overrides) !== null && _a !== void 0 ? _a : []; });
|
|
248
|
+
return await this.makeGetRequest(`${env_1.BASE_API_URL}/tests/testScripts/${testId}/overrides?environment_id=${environmentId}&selector_override_limit=${selectorOverrideLimit}`).then((result) => { var _a; return (_a = result.overrides) !== null && _a !== void 0 ? _a : []; });
|
|
249
249
|
}
|
|
250
250
|
catch (error) {
|
|
251
251
|
throw toApiError(`Failed to get selector overrides`, error);
|
|
@@ -271,7 +271,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
271
271
|
var _a, _b;
|
|
272
272
|
try {
|
|
273
273
|
const userInfo = await this.getSelf();
|
|
274
|
-
const requests = (_b = (_a = userInfo.roles) === null || _a === void 0 ? void 0 : _a.slice(0, limit).map(role => this.getWorkspace(role.organization_id))) !== null && _b !== void 0 ? _b : [];
|
|
274
|
+
const requests = (_b = (_a = userInfo.roles) === null || _a === void 0 ? void 0 : _a.slice(0, limit).map((role) => this.getWorkspace(role.organization_id))) !== null && _b !== void 0 ? _b : [];
|
|
275
275
|
const workspaces = await Promise.all(requests);
|
|
276
276
|
sortTemporallyAscending(workspaces);
|
|
277
277
|
return workspaces;
|
|
@@ -406,7 +406,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
406
406
|
limit,
|
|
407
407
|
status: statusFilter,
|
|
408
408
|
});
|
|
409
|
-
return await this.makeGetRequest(`${env_1.BASE_API_URL}/branch?${branchQueryString}`).then(result => { var _a; return (_a = result.branches) !== null && _a !== void 0 ? _a : []; });
|
|
409
|
+
return await this.makeGetRequest(`${env_1.BASE_API_URL}/branch?${branchQueryString}`).then((result) => { var _a; return (_a = result.branches) !== null && _a !== void 0 ? _a : []; });
|
|
410
410
|
}
|
|
411
411
|
catch (error) {
|
|
412
412
|
throw toApiError(`Failed to get Branches`, error);
|
|
@@ -422,7 +422,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
422
422
|
}
|
|
423
423
|
async getDatatableRows(datatableId) {
|
|
424
424
|
try {
|
|
425
|
-
return await this.makeGetRequest(`${env_1.BASE_API_URL}/variables/tables/${datatableId}/rows`).then(result => { var _a; return (_a = result.variableRows) !== null && _a !== void 0 ? _a : []; });
|
|
425
|
+
return await this.makeGetRequest(`${env_1.BASE_API_URL}/variables/tables/${datatableId}/rows`).then((result) => { var _a; return (_a = result.variableRows) !== null && _a !== void 0 ? _a : []; });
|
|
426
426
|
}
|
|
427
427
|
catch (error) {
|
|
428
428
|
throw toApiError(`Failed to get datatable rows`, error);
|
|
@@ -537,7 +537,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
537
537
|
planOverrides.deployment_ids = options.deploymentIds;
|
|
538
538
|
}
|
|
539
539
|
if ((_h = options.httpHeaders) === null || _h === void 0 ? void 0 : _h.length) {
|
|
540
|
-
planOverrides.http_headers = options.httpHeaders.map(header => {
|
|
540
|
+
planOverrides.http_headers = options.httpHeaders.map((header) => {
|
|
541
541
|
const parts = header.split(':', 2);
|
|
542
542
|
return {
|
|
543
543
|
name: parts[0],
|
|
@@ -45,6 +45,7 @@ class MablApiClientFactory {
|
|
|
45
45
|
proxyUrl: httpConfig.proxyHost,
|
|
46
46
|
sslVerify: httpConfig.sslVerify,
|
|
47
47
|
retryConfig: RETRY_CONFIG,
|
|
48
|
+
userAgentOverride: opts.userAgentOverride,
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
const authProvider = new authenticationProvider_1.AuthenticationProvider();
|
package/auth/AuthClient.js
CHANGED
|
@@ -22,10 +22,7 @@ class AuthClient {
|
|
|
22
22
|
.replace(/=/g, '');
|
|
23
23
|
}
|
|
24
24
|
sha256(input) {
|
|
25
|
-
return crypto_1.default
|
|
26
|
-
.createHash('sha256')
|
|
27
|
-
.update(input)
|
|
28
|
-
.digest();
|
|
25
|
+
return crypto_1.default.createHash('sha256').update(input).digest();
|
|
29
26
|
}
|
|
30
27
|
buildAuthorizationUrl(codeChallenge, redirectUri, idpType) {
|
|
31
28
|
const loginQueryString = query_string_1.default.stringify({
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.BrowserLauncherFactory = void 0;
|
|
4
7
|
const puppeteerBrowserLauncher_1 = require("./puppeteerBrowserLauncher/puppeteerBrowserLauncher");
|
|
@@ -6,20 +9,21 @@ const playwrightBrowserLauncher_1 = require("./playwrightBrowserLauncher/playwri
|
|
|
6
9
|
const runnerType_1 = require("./runnerType");
|
|
7
10
|
const logUtils_1 = require("../util/logUtils");
|
|
8
11
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
12
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
13
|
class BrowserLauncherFactory {
|
|
10
14
|
static getRunnerFromEnvironment() {
|
|
11
15
|
var _a;
|
|
12
16
|
return (_a = process.env.MABL_RUNNER) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
13
17
|
}
|
|
14
|
-
static createRunner(runnerType = runnerType_1.RunnerType.
|
|
18
|
+
static createRunner(runnerType = runnerType_1.RunnerType.Playwright, loggerFunc) {
|
|
15
19
|
const runnerFromEnv = BrowserLauncherFactory.getRunnerFromEnvironment();
|
|
16
20
|
const runner = runnerFromEnv ? runnerFromEnv : runnerType;
|
|
17
21
|
loggerFunc = loggerFunc !== null && loggerFunc !== void 0 ? loggerFunc : ((line) => logUtils_1.logCliOutput(loggingProvider_1.LogLevel.Info, line));
|
|
18
22
|
if (runner === runnerType_1.RunnerType.Playwright) {
|
|
19
|
-
loggerFunc(
|
|
23
|
+
loggerFunc(chalk_1.default.cyan(`Browser launcher:`, chalk_1.default.magenta('Playwright')));
|
|
20
24
|
return new playwrightBrowserLauncher_1.PlaywrightBrowserLauncher();
|
|
21
25
|
}
|
|
22
|
-
loggerFunc(
|
|
26
|
+
loggerFunc(chalk_1.default.cyan(`Browser launcher:`, chalk_1.default.magenta('Puppeteer')));
|
|
23
27
|
return new puppeteerBrowserLauncher_1.PuppeteerBrowserLauncher();
|
|
24
28
|
}
|
|
25
29
|
}
|
|
@@ -29,6 +29,7 @@ const browserLauncher_1 = require("../browserLauncher");
|
|
|
29
29
|
const playwrightPage_1 = require("./playwrightPage");
|
|
30
30
|
const path_1 = __importDefault(require("path"));
|
|
31
31
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
32
|
+
const runnerType_1 = require("../runnerType");
|
|
32
33
|
class PlaywrightBrowser extends events_1.default {
|
|
33
34
|
constructor(defaultContext, downloadDirectory, browserWSEndpoint) {
|
|
34
35
|
super();
|
|
@@ -49,6 +50,9 @@ class PlaywrightBrowser extends events_1.default {
|
|
|
49
50
|
fs_extra_1.default.mkdirSync(path_1.default.join(this.downloadDirectory));
|
|
50
51
|
}
|
|
51
52
|
}
|
|
53
|
+
getRunnerType() {
|
|
54
|
+
return runnerType_1.RunnerType.Playwright;
|
|
55
|
+
}
|
|
52
56
|
makeCdpCall(method, paramArgs) {
|
|
53
57
|
return this.cdpSession.send(method, paramArgs);
|
|
54
58
|
}
|
|
@@ -73,12 +77,12 @@ class PlaywrightBrowser extends events_1.default {
|
|
|
73
77
|
async pages() {
|
|
74
78
|
return Promise.all(this.getDefaultContext()
|
|
75
79
|
.pages()
|
|
76
|
-
.map(page => this.getOrCreatePage(page)));
|
|
80
|
+
.map((page) => this.getOrCreatePage(page)));
|
|
77
81
|
}
|
|
78
82
|
async getExtensionBackgroundPage(extensionId) {
|
|
79
83
|
const backgroundExtensionPage = this.defaultContext
|
|
80
84
|
.backgroundPages()
|
|
81
|
-
.find(page => page.url().includes(extensionId));
|
|
85
|
+
.find((page) => page.url().includes(extensionId));
|
|
82
86
|
if (!backgroundExtensionPage) {
|
|
83
87
|
throw new Error('mabl test initialization failure, unable to locate mabl extension page, please try again');
|
|
84
88
|
}
|
|
@@ -31,6 +31,7 @@ class PlaywrightBrowserLauncher {
|
|
|
31
31
|
viewport,
|
|
32
32
|
acceptDownloads: true,
|
|
33
33
|
httpCredentials: options.credentials,
|
|
34
|
+
extraHTTPHeaders: options.extraHttpHeaders,
|
|
34
35
|
isMobile: (_a = options.defaultDeviceDescriptor) === null || _a === void 0 ? void 0 : _a.isMobile,
|
|
35
36
|
deviceScaleFactor: (_b = options.defaultDeviceDescriptor) === null || _b === void 0 ? void 0 : _b.deviceScaleFactor,
|
|
36
37
|
hasTouch: (_c = options.defaultDeviceDescriptor) === null || _c === void 0 ? void 0 : _c.hasTouch,
|
|
@@ -19,12 +19,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.PlaywrightElementHandle = exports.PlaywrightJsHandle = void 0;
|
|
22
|
+
exports.PlaywrightElementHandle = exports.PlaywrightJsHandle = exports.NAVIGATION_ERROR_MESSAGE = void 0;
|
|
23
23
|
const playwright = __importStar(require("@playwright/test"));
|
|
24
|
+
const types_1 = require("../types");
|
|
24
25
|
const utils_1 = require("../utils");
|
|
25
26
|
const logUtils_1 = require("../../util/logUtils");
|
|
26
27
|
const elementHandle_1 = require("../elementHandle");
|
|
27
28
|
const testsUtil_1 = require("../../commands/tests/testsUtil");
|
|
29
|
+
exports.NAVIGATION_ERROR_MESSAGE = 'waiting for scheduled navigations to finish';
|
|
28
30
|
class PlaywrightJsHandle {
|
|
29
31
|
constructor(handle, page) {
|
|
30
32
|
this.handle = handle;
|
|
@@ -41,12 +43,12 @@ class PlaywrightJsHandle {
|
|
|
41
43
|
}
|
|
42
44
|
async evaluateHandle(code, arg) {
|
|
43
45
|
const handle = await this.handle.evaluateHandle(code, PlaywrightJsHandle.unwrapProperties(arg));
|
|
44
|
-
return utils_1.mapIfNotNull(handle, handle => handle.asElement()
|
|
46
|
+
return utils_1.mapIfNotNull(handle, (handle) => handle.asElement()
|
|
45
47
|
? new PlaywrightElementHandle(handle.asElement(), this.page)
|
|
46
48
|
: new PlaywrightJsHandle(handle, this.page));
|
|
47
49
|
}
|
|
48
50
|
async getProperty(propertyName) {
|
|
49
|
-
return utils_1.mapIfNotNull(await this.handle.getProperty(propertyName), handle => new PlaywrightJsHandle(handle, this.page));
|
|
51
|
+
return utils_1.mapIfNotNull(await this.handle.getProperty(propertyName), (handle) => new PlaywrightJsHandle(handle, this.page));
|
|
50
52
|
}
|
|
51
53
|
jsonValue() {
|
|
52
54
|
return this.handle.jsonValue();
|
|
@@ -67,12 +69,12 @@ class PlaywrightJsHandle {
|
|
|
67
69
|
result = arg;
|
|
68
70
|
}
|
|
69
71
|
else if (typeof arg === 'object' &&
|
|
70
|
-
!Object.keys(arg).some(key => arg[key] instanceof PlaywrightJsHandle)) {
|
|
72
|
+
!Object.keys(arg).some((key) => arg[key] instanceof PlaywrightJsHandle)) {
|
|
71
73
|
result = arg;
|
|
72
74
|
}
|
|
73
75
|
else if (typeof arg === 'object' && !Array.isArray(arg)) {
|
|
74
76
|
const unwrapped = { ...arg };
|
|
75
|
-
Object.keys(arg).forEach(propertyName => {
|
|
77
|
+
Object.keys(arg).forEach((propertyName) => {
|
|
76
78
|
const propertyValue = unwrapped[propertyName];
|
|
77
79
|
if (propertyValue instanceof PlaywrightJsHandle) {
|
|
78
80
|
unwrapped[propertyName] = propertyValue.getPlaywrightHandle();
|
|
@@ -116,23 +118,48 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
116
118
|
return this.element.setInputFiles(filePath);
|
|
117
119
|
}
|
|
118
120
|
async $x(xpathQuery) {
|
|
119
|
-
return (await this.element.$$(`xpath=${xpathQuery}`)).map(element => new PlaywrightElementHandle(element, this.page));
|
|
121
|
+
return (await this.element.$$(`xpath=${xpathQuery}`)).map((element) => new PlaywrightElementHandle(element, this.page));
|
|
120
122
|
}
|
|
121
123
|
asElement() {
|
|
122
|
-
return utils_1.mapIfNotNull(this.handle.asElement(), handle => new PlaywrightElementHandle(handle, this.page));
|
|
124
|
+
return utils_1.mapIfNotNull(this.handle.asElement(), (handle) => new PlaywrightElementHandle(handle, this.page));
|
|
123
125
|
}
|
|
124
126
|
async boundingBox() {
|
|
125
|
-
return utils_1.mapIfNotNull(await this.element.boundingBox(), boundingBox => boundingBox);
|
|
127
|
+
return utils_1.mapIfNotNull(await this.element.boundingBox(), (boundingBox) => boundingBox);
|
|
126
128
|
}
|
|
127
|
-
click(options) {
|
|
128
|
-
var _a, _b;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
async click(options) {
|
|
130
|
+
var _a, _b, _c, _d;
|
|
131
|
+
const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
|
|
132
|
+
try {
|
|
133
|
+
await this.element.click({
|
|
134
|
+
clickCount: (_b = options === null || options === void 0 ? void 0 : options.clickCount) !== null && _b !== void 0 ? _b : 1,
|
|
135
|
+
force: (_c = options === null || options === void 0 ? void 0 : options.force) !== null && _c !== void 0 ? _c : !trial,
|
|
136
|
+
timeout: (_d = options === null || options === void 0 ? void 0 : options.timeout) !== null && _d !== void 0 ? _d : types_1.DefaultTimeouts.quickActionTimeoutMs,
|
|
137
|
+
trial,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
if (error.message.includes(exports.NAVIGATION_ERROR_MESSAGE)) {
|
|
142
|
+
logUtils_1.logInternal(`Action timed out due to navigation timeout. ${error.toString()}`);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
133
147
|
}
|
|
134
|
-
doubleClick() {
|
|
135
|
-
|
|
148
|
+
async doubleClick(options) {
|
|
149
|
+
var _a, _b, _c;
|
|
150
|
+
try {
|
|
151
|
+
const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
|
|
152
|
+
return this.element.dblclick({
|
|
153
|
+
force: (_b = options === null || options === void 0 ? void 0 : options.force) !== null && _b !== void 0 ? _b : !trial,
|
|
154
|
+
timeout: (_c = options === null || options === void 0 ? void 0 : options.timeout) !== null && _c !== void 0 ? _c : types_1.DefaultTimeouts.quickActionTimeoutMs,
|
|
155
|
+
trial,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
if (error.message.includes(exports.NAVIGATION_ERROR_MESSAGE)) {
|
|
160
|
+
logUtils_1.logInternal(`Action timed out due to navigation timeout. ${error.toString()}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
136
163
|
}
|
|
137
164
|
async clickablePoint() {
|
|
138
165
|
var _a;
|
|
@@ -144,13 +171,13 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
144
171
|
return clickablePoint;
|
|
145
172
|
}
|
|
146
173
|
async contentFrame() {
|
|
147
|
-
return utils_1.mapIfNotNull(await this.element.contentFrame(), frame => this.page.getOrCreateFrame(frame));
|
|
174
|
+
return utils_1.mapIfNotNull(await this.element.contentFrame(), (frame) => this.page.getOrCreateFrame(frame));
|
|
148
175
|
}
|
|
149
176
|
focus() {
|
|
150
177
|
return this.element.focus();
|
|
151
178
|
}
|
|
152
179
|
async frame() {
|
|
153
|
-
return utils_1.mapIfNotNull(await this.element.ownerFrame(), frame => this.page.getOrCreateFrame(frame));
|
|
180
|
+
return utils_1.mapIfNotNull(await this.element.ownerFrame(), (frame) => this.page.getOrCreateFrame(frame));
|
|
154
181
|
}
|
|
155
182
|
hover() {
|
|
156
183
|
return this.element.hover();
|
|
@@ -162,9 +189,22 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
162
189
|
return this.element.selectOption(value);
|
|
163
190
|
}
|
|
164
191
|
async type(text, options) {
|
|
192
|
+
const timeout = PlaywrightElementHandle.getTypeTimeout(text, options);
|
|
165
193
|
await this.element.focus();
|
|
166
194
|
await this.element.selectText({ force: true });
|
|
167
|
-
return this.element.type(text,
|
|
195
|
+
return this.element.type(text, {
|
|
196
|
+
delay: options === null || options === void 0 ? void 0 : options.delay,
|
|
197
|
+
timeout,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
static getTypeTimeout(text, options) {
|
|
201
|
+
var _a;
|
|
202
|
+
let timeout;
|
|
203
|
+
const newTimeout = text.length * ((_a = options === null || options === void 0 ? void 0 : options.delay) !== null && _a !== void 0 ? _a : 1) * 2;
|
|
204
|
+
if (newTimeout > types_1.DefaultTimeouts.defaultTextInputTimeoutMs) {
|
|
205
|
+
timeout = newTimeout;
|
|
206
|
+
}
|
|
207
|
+
return timeout;
|
|
168
208
|
}
|
|
169
209
|
press(key) {
|
|
170
210
|
return this.element.press(key);
|
|
@@ -225,7 +265,7 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
225
265
|
}
|
|
226
266
|
async makeCdpCall(method, paramArgs) {
|
|
227
267
|
var _a;
|
|
228
|
-
return ((_a = this.cdpSession) !== null && _a !== void 0 ? _a :
|
|
268
|
+
return ((_a = this.cdpSession) !== null && _a !== void 0 ? _a : this.page.getCdpSession()).send(method, paramArgs);
|
|
229
269
|
}
|
|
230
270
|
}
|
|
231
271
|
exports.PlaywrightElementHandle = PlaywrightElementHandle;
|
|
@@ -27,6 +27,8 @@ const playwrightHttpResponse_1 = require("./playwrightHttpResponse");
|
|
|
27
27
|
const playwrightDom_1 = require("./playwrightDom");
|
|
28
28
|
const testsUtil_1 = require("../../commands/tests/testsUtil");
|
|
29
29
|
const WAIT_FOR_CONTEXT_TIMEOUT = 1000;
|
|
30
|
+
const MAIN_CONTEXT = 'main';
|
|
31
|
+
const UTILITY_CONTEXT = 'utility';
|
|
30
32
|
class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
31
33
|
constructor(frame, parentPage) {
|
|
32
34
|
super();
|
|
@@ -37,18 +39,21 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
37
39
|
injectSecondaryWorld() {
|
|
38
40
|
const serverFrame = this.getFrameImpl();
|
|
39
41
|
serverFrame.checkWorldFunction = async function (arg) {
|
|
40
|
-
let forcedWorld =
|
|
42
|
+
let forcedWorld = MAIN_CONTEXT;
|
|
41
43
|
if (this.utilityWorldAvailable === undefined) {
|
|
42
44
|
await Promise.race([
|
|
43
|
-
this._contextData.get(
|
|
45
|
+
this._contextData.get(UTILITY_CONTEXT).contextPromise,
|
|
44
46
|
testsUtil_1.sleep(WAIT_FOR_CONTEXT_TIMEOUT),
|
|
45
47
|
]);
|
|
46
48
|
this.utilityWorldAvailable =
|
|
47
|
-
this._contextData.get(
|
|
49
|
+
this._contextData.get(UTILITY_CONTEXT).context !== null;
|
|
48
50
|
}
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
if (arg === null || arg === void 0 ? void 0 : arg.hasOwnProperty('secondaryWorldValue')) {
|
|
52
|
+
forcedWorld = UTILITY_CONTEXT;
|
|
53
|
+
if (!this.utilityWorldAvailable) {
|
|
54
|
+
this._contextData.set(UTILITY_CONTEXT, this._contextData.get(MAIN_CONTEXT));
|
|
55
|
+
this.utilityWorldAvailable = true;
|
|
56
|
+
}
|
|
52
57
|
arg = arg.secondaryWorldValue;
|
|
53
58
|
}
|
|
54
59
|
return { world: forcedWorld, value: arg };
|
|
@@ -58,43 +63,45 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
58
63
|
const { world, value } = await this.checkWorldFunction(arg);
|
|
59
64
|
return originalEvaluateExpressionFunction(expression, isFunction, value, world);
|
|
60
65
|
};
|
|
61
|
-
serverFrame.evaluateExpressionAndWaitForSignals =
|
|
66
|
+
serverFrame.evaluateExpressionAndWaitForSignals =
|
|
67
|
+
functionOverride.bind(serverFrame);
|
|
62
68
|
const originalEvaluateExpressionHandleFunction = serverFrame.evaluateExpressionHandleAndWaitForSignals.bind(serverFrame);
|
|
63
69
|
const functionHandleOverride = async function (expression, isFunction, arg, _world) {
|
|
64
70
|
const { world, value } = await this.checkWorldFunction(arg);
|
|
65
71
|
return originalEvaluateExpressionHandleFunction(expression, isFunction, value, world);
|
|
66
72
|
};
|
|
67
|
-
serverFrame.evaluateExpressionHandleAndWaitForSignals =
|
|
73
|
+
serverFrame.evaluateExpressionHandleAndWaitForSignals =
|
|
74
|
+
functionHandleOverride.bind(serverFrame);
|
|
68
75
|
}
|
|
69
76
|
async $(selector) {
|
|
70
|
-
return utils_1.mapIfNotNull(await this.frame.$(selector), handle => new playwrightDom_1.PlaywrightElementHandle(handle, this.parentPage));
|
|
77
|
+
return utils_1.mapIfNotNull(await this.frame.$(selector), (handle) => new playwrightDom_1.PlaywrightElementHandle(handle, this.parentPage));
|
|
71
78
|
}
|
|
72
79
|
async $$(selector) {
|
|
73
80
|
const maybePlaywrightHandles = await this.frame.$$(selector);
|
|
74
81
|
if (!maybePlaywrightHandles.length) {
|
|
75
82
|
return [];
|
|
76
83
|
}
|
|
77
|
-
return maybePlaywrightHandles.map(handle => new playwrightDom_1.PlaywrightElementHandle(handle, this.parentPage));
|
|
84
|
+
return maybePlaywrightHandles.map((handle) => new playwrightDom_1.PlaywrightElementHandle(handle, this.parentPage));
|
|
78
85
|
}
|
|
79
86
|
async $$eval(selector, pageFunction, ...args) {
|
|
80
|
-
const result = await this.frame.$$eval(selector, pageFunction, ...args === null || args === void 0 ? void 0 : args.map(argument => argument instanceof playwrightDom_1.PlaywrightJsHandle
|
|
87
|
+
const result = await this.frame.$$eval(selector, pageFunction, ...args === null || args === void 0 ? void 0 : args.map((argument) => argument instanceof playwrightDom_1.PlaywrightJsHandle
|
|
81
88
|
? argument.getPlaywrightHandle()
|
|
82
89
|
: argument));
|
|
83
90
|
return result;
|
|
84
91
|
}
|
|
85
92
|
async $eval(selector, pageFunction, ...args) {
|
|
86
|
-
const result = await this.frame.$eval(selector, pageFunction, ...args === null || args === void 0 ? void 0 : args.map(argument => argument instanceof playwrightDom_1.PlaywrightJsHandle
|
|
93
|
+
const result = await this.frame.$eval(selector, pageFunction, ...args === null || args === void 0 ? void 0 : args.map((argument) => argument instanceof playwrightDom_1.PlaywrightJsHandle
|
|
87
94
|
? argument.getPlaywrightHandle()
|
|
88
95
|
: argument));
|
|
89
96
|
return result;
|
|
90
97
|
}
|
|
91
98
|
async $x(xpathQuery) {
|
|
92
|
-
return (await this.frame.$$(`xpath=${xpathQuery}`)).map(element => new playwrightDom_1.PlaywrightElementHandle(element, this.parentPage));
|
|
99
|
+
return (await this.frame.$$(`xpath=${xpathQuery}`)).map((element) => new playwrightDom_1.PlaywrightElementHandle(element, this.parentPage));
|
|
93
100
|
}
|
|
94
101
|
childFrames() {
|
|
95
102
|
return this.frame
|
|
96
103
|
.childFrames()
|
|
97
|
-
.map(frame => this.parentPage.getOrCreateFrame(frame));
|
|
104
|
+
.map((frame) => this.parentPage.getOrCreateFrame(frame));
|
|
98
105
|
}
|
|
99
106
|
evaluate(pageFunction, arg, addSecondaryWorldFlag = false) {
|
|
100
107
|
return this.frame.evaluate(pageFunction, playwrightDom_1.PlaywrightJsHandle.unwrapProperties(arg, addSecondaryWorldFlag));
|
|
@@ -111,7 +118,7 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
111
118
|
async goto(url, options) {
|
|
112
119
|
try {
|
|
113
120
|
const response = await this.frame.goto(url, options);
|
|
114
|
-
return utils_1.mapIfNotNull(response, response => new playwrightHttpResponse_1.PlaywrightHttpResponse(this.parentPage, response));
|
|
121
|
+
return utils_1.mapIfNotNull(response, (response) => new playwrightHttpResponse_1.PlaywrightHttpResponse(this.parentPage, response));
|
|
115
122
|
}
|
|
116
123
|
catch (e) {
|
|
117
124
|
if (e instanceof playwright.errors.TimeoutError) {
|
|
@@ -127,13 +134,13 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
127
134
|
return this.frame.name();
|
|
128
135
|
}
|
|
129
136
|
parentFrame() {
|
|
130
|
-
return utils_1.mapIfNotNull(this.frame.parentFrame(), frame => this.parentPage.getOrCreateFrame(frame));
|
|
137
|
+
return utils_1.mapIfNotNull(this.frame.parentFrame(), (frame) => this.parentPage.getOrCreateFrame(frame));
|
|
131
138
|
}
|
|
132
139
|
url() {
|
|
133
140
|
return this.frame.url();
|
|
134
141
|
}
|
|
135
142
|
async waitForSelector(selector, options) {
|
|
136
|
-
return utils_1.mapIfNotNull(await this.frame.waitForSelector(selector, options), handle => new playwrightDom_1.PlaywrightElementHandle(handle, this.parentPage));
|
|
143
|
+
return utils_1.mapIfNotNull(await this.frame.waitForSelector(selector, options), (handle) => new playwrightDom_1.PlaywrightElementHandle(handle, this.parentPage));
|
|
137
144
|
}
|
|
138
145
|
page() {
|
|
139
146
|
return this.parentPage;
|