@mablhq/mabl-cli 1.13.21 → 1.16.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/basicApiClient.js +56 -32
- package/api/featureSet.js +27 -0
- package/api/mablApiClient.js +22 -21
- package/api/mablApiClientFactory.js +0 -8
- package/browserLauncher/pageEvent.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +12 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +6 -0
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +10 -0
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +12 -0
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +6 -0
- package/commands/applications/applications_cmds/list.js +5 -2
- package/commands/branches/branches_cmds/list.js +5 -2
- package/commands/config/config_cmds/get.js +5 -2
- package/commands/config/config_cmds/list.js +5 -2
- package/commands/credentials/credentials_cmds/list.js +5 -2
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +5 -2
- package/commands/deploy/deploy_cmds/list.js +5 -2
- package/commands/environments/environments_cmds/list.js +5 -2
- package/commands/flows/flows_cmds/list.js +5 -2
- package/commands/plans/plans_cmds/list.js +5 -2
- package/commands/tests/executionUtil.js +6 -1
- package/commands/tests/testsUtil.js +8 -23
- package/commands/tests/tests_cmds/list.js +5 -2
- package/commands/tests/tests_cmds/trainer_cmds/trainerUtil.js +2 -2
- package/commands/workspaces/workspace_cmds/list.js +5 -2
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +0 -6
- package/mablApi/index.js +1 -1
- package/mablscript/MablStep.js +3 -0
- package/mablscript/steps/AccessibilityCheck.js +14 -2
- package/mablscriptFind/index.js +1 -1
- package/package.json +3 -3
- package/resources/mablFind.js +1 -1
- package/util/resourceUtil.js +39 -13
- package/api/entities/JourneyRunScheduledMessage.js +0 -2
package/api/basicApiClient.js
CHANGED
|
@@ -32,11 +32,19 @@ const logUtils_1 = require("../util/logUtils");
|
|
|
32
32
|
const asyncUtil_1 = require("../util/asyncUtil");
|
|
33
33
|
const MABL_ENTITY_VERSION_HEADER = 'x-mabl-entity-version';
|
|
34
34
|
const DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS = 60000;
|
|
35
|
-
const
|
|
36
|
-
const DEFAULT_RETRIES = 5;
|
|
35
|
+
const DEFAULT_RETRIES = 10;
|
|
37
36
|
const DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS = DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS * DEFAULT_RETRIES;
|
|
38
|
-
const
|
|
39
|
-
const
|
|
37
|
+
const DEFAULT_NONRETRYABLE_REQUEST_TIMEOUT_MILLISECONDS = DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS;
|
|
38
|
+
const DEFAULT_MIN_RETRY_INTERVAL_MILLISECONDS = 1000;
|
|
39
|
+
const DEFAULT_MAX_RETRY_INTERVAL_MILLISECONDS = 10000;
|
|
40
|
+
const RETRYABLE_NODEJS_ERRORS = [
|
|
41
|
+
'EAI_AGAIN',
|
|
42
|
+
'ECONNRESET',
|
|
43
|
+
'ENOTFOUND',
|
|
44
|
+
'ENETUNREACH',
|
|
45
|
+
'ETIMEOUT',
|
|
46
|
+
'ECONNABORTED',
|
|
47
|
+
];
|
|
40
48
|
var AuthType;
|
|
41
49
|
(function (AuthType) {
|
|
42
50
|
AuthType[AuthType["Bearer"] = 0] = "Bearer";
|
|
@@ -44,12 +52,12 @@ var AuthType;
|
|
|
44
52
|
})(AuthType = exports.AuthType || (exports.AuthType = {}));
|
|
45
53
|
class BasicApiClient {
|
|
46
54
|
constructor(options) {
|
|
47
|
-
var _a, _b;
|
|
55
|
+
var _a, _b, _c, _d;
|
|
48
56
|
const config = httpUtil_1.axiosProxyConfig({
|
|
49
57
|
sslVerify: options.sslVerify,
|
|
50
58
|
proxyHost: options.proxyUrl,
|
|
51
59
|
});
|
|
52
|
-
config.timeout = (_a = options.requestTimeoutMillis) !== null && _a !== void 0 ? _a : DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS;
|
|
60
|
+
config.timeout = (_c = (_a = options.requestTimeoutMillis) !== null && _a !== void 0 ? _a : (_b = options.retryConfig) === null || _b === void 0 ? void 0 : _b.requestTimeoutMillis) !== null && _c !== void 0 ? _c : DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS;
|
|
53
61
|
switch (options.authType) {
|
|
54
62
|
case AuthType.ApiKey:
|
|
55
63
|
config.auth = {
|
|
@@ -77,7 +85,7 @@ class BasicApiClient {
|
|
|
77
85
|
this.httpRequestConfig = config;
|
|
78
86
|
this.httpClient = axios_1.default.create(config);
|
|
79
87
|
this.retryConfig = options.retryConfig;
|
|
80
|
-
this.debugLogger = (
|
|
88
|
+
this.debugLogger = (_d = options.debugLogger) !== null && _d !== void 0 ? _d : logUtils_1.logInternal;
|
|
81
89
|
}
|
|
82
90
|
getNonRetryableRequestConfig(override) {
|
|
83
91
|
const overrideWithTimeout = { ...(override !== null && override !== void 0 ? override : {}) };
|
|
@@ -87,20 +95,26 @@ class BasicApiClient {
|
|
|
87
95
|
}
|
|
88
96
|
return { ...this.httpRequestConfig, ...overrideWithTimeout };
|
|
89
97
|
}
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
getRetryableRequestConfig(retryConfig) {
|
|
99
|
+
var _a;
|
|
100
|
+
return this.getNonRetryableRequestConfig({
|
|
101
|
+
timeout: (_a = retryConfig === null || retryConfig === void 0 ? void 0 : retryConfig.requestTimeoutMillis) !== null && _a !== void 0 ? _a : this.httpRequestConfig.timeout,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
makeGetRequest(path, retryConfig) {
|
|
105
|
+
return this.retryWrappedRequest(`makeGetRequest('${path}')`, () => this.getRequest(path, this.getRetryableRequestConfig(retryConfig)), retryConfig);
|
|
92
106
|
}
|
|
93
|
-
async getRequest(path) {
|
|
94
|
-
const response = await this.debugRequest('GET', path, () => this.httpClient.get(path));
|
|
107
|
+
async getRequest(path, config) {
|
|
108
|
+
const response = await this.debugRequest('GET', path, () => this.httpClient.get(path, config));
|
|
95
109
|
BasicApiClient.checkResponseStatusCode(response);
|
|
96
110
|
return response.data;
|
|
97
111
|
}
|
|
98
|
-
makeGetRequestWithETag(path) {
|
|
99
|
-
return this.retryWrappedRequest(`makeGetRequestWithETag('${path}')`, () => this.getRequestWithETag(path));
|
|
112
|
+
makeGetRequestWithETag(path, retryConfig) {
|
|
113
|
+
return this.retryWrappedRequest(`makeGetRequestWithETag('${path}')`, () => this.getRequestWithETag(path, this.getRetryableRequestConfig(retryConfig)), retryConfig);
|
|
100
114
|
}
|
|
101
|
-
async getRequestWithETag(path) {
|
|
115
|
+
async getRequestWithETag(path, config) {
|
|
102
116
|
var _a;
|
|
103
|
-
const response = await this.debugRequest('GET', path, () => this.httpClient.get(path));
|
|
117
|
+
const response = await this.debugRequest('GET', path, () => this.httpClient.get(path, config));
|
|
104
118
|
BasicApiClient.checkResponseStatusCode(response);
|
|
105
119
|
const headers = response.headers;
|
|
106
120
|
const result = response.data;
|
|
@@ -120,11 +134,11 @@ class BasicApiClient {
|
|
|
120
134
|
BasicApiClient.checkResponseStatusCode(response);
|
|
121
135
|
return response.data;
|
|
122
136
|
}
|
|
123
|
-
makeDeleteRequest(path) {
|
|
124
|
-
return this.retryWrappedRequest(`makeDeleteRequest('${path}')`, () => this.deleteRequest(path));
|
|
137
|
+
makeDeleteRequest(path, retryConfig) {
|
|
138
|
+
return this.retryWrappedRequest(`makeDeleteRequest('${path}')`, () => this.deleteRequest(path, this.getRetryableRequestConfig(retryConfig)), retryConfig);
|
|
125
139
|
}
|
|
126
|
-
async deleteRequest(path) {
|
|
127
|
-
const response = await this.debugRequest('DELETE', path, () => this.deleteRequest(path));
|
|
140
|
+
async deleteRequest(path, config) {
|
|
141
|
+
const response = await this.debugRequest('DELETE', path, () => this.deleteRequest(path, config));
|
|
128
142
|
BasicApiClient.checkResponseStatusCode(response);
|
|
129
143
|
return response.data;
|
|
130
144
|
}
|
|
@@ -158,38 +172,48 @@ class BasicApiClient {
|
|
|
158
172
|
throw new ApiError_1.ApiError(`[${statusCode} - ${response.statusText}]`, statusCode);
|
|
159
173
|
}
|
|
160
174
|
}
|
|
161
|
-
retryWrappedRequest(description, requestFunc) {
|
|
162
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
175
|
+
retryWrappedRequest(description, requestFunc, retryConfigOverride) {
|
|
176
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
163
177
|
const retryOptions = {
|
|
164
|
-
retries: (
|
|
165
|
-
minTimeout: (_d = (
|
|
166
|
-
maxTimeout: (
|
|
167
|
-
maxRetryTime: (
|
|
178
|
+
retries: (_c = (_a = retryConfigOverride === null || retryConfigOverride === void 0 ? void 0 : retryConfigOverride.retryCount) !== null && _a !== void 0 ? _a : (_b = this.retryConfig) === null || _b === void 0 ? void 0 : _b.retryCount) !== null && _c !== void 0 ? _c : DEFAULT_RETRIES,
|
|
179
|
+
minTimeout: (_f = (_d = retryConfigOverride === null || retryConfigOverride === void 0 ? void 0 : retryConfigOverride.minRetryIntervalMillis) !== null && _d !== void 0 ? _d : (_e = this.retryConfig) === null || _e === void 0 ? void 0 : _e.minRetryIntervalMillis) !== null && _f !== void 0 ? _f : DEFAULT_MIN_RETRY_INTERVAL_MILLISECONDS,
|
|
180
|
+
maxTimeout: (_j = (_g = retryConfigOverride === null || retryConfigOverride === void 0 ? void 0 : retryConfigOverride.maxRetryIntervalMillis) !== null && _g !== void 0 ? _g : (_h = this.retryConfig) === null || _h === void 0 ? void 0 : _h.maxRetryIntervalMillis) !== null && _j !== void 0 ? _j : DEFAULT_MAX_RETRY_INTERVAL_MILLISECONDS,
|
|
181
|
+
maxRetryTime: (_m = (_k = retryConfigOverride === null || retryConfigOverride === void 0 ? void 0 : retryConfigOverride.maxRetryTimeMillis) !== null && _k !== void 0 ? _k : (_l = this.retryConfig) === null || _l === void 0 ? void 0 : _l.maxRetryTimeMillis) !== null && _m !== void 0 ? _m : DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS,
|
|
168
182
|
onRetry: (error) => {
|
|
169
183
|
this.debugLogger(`Retrying failed API request "${description}"`, error);
|
|
170
184
|
},
|
|
171
185
|
forever: false,
|
|
172
186
|
};
|
|
173
187
|
return asyncUtil_1.promiseWithTimeout(async_retry_1.default(async (bail) => {
|
|
174
|
-
var _a, _b;
|
|
175
188
|
try {
|
|
176
189
|
return await requestFunc();
|
|
177
190
|
}
|
|
178
191
|
catch (error) {
|
|
179
|
-
|
|
180
|
-
const statusCode = (_a = axiosError.code) !== null && _a !== void 0 ? _a : (_b = axiosError.response) === null || _b === void 0 ? void 0 : _b.status;
|
|
181
|
-
if (statusCode === 429 ||
|
|
182
|
-
statusCode === 502 ||
|
|
183
|
-
statusCode === 503 ||
|
|
184
|
-
statusCode === 504) {
|
|
192
|
+
if (axios_1.default.isAxiosError(error) && BasicApiClient.isRetryable(error)) {
|
|
185
193
|
throw error;
|
|
186
194
|
}
|
|
187
195
|
else {
|
|
196
|
+
let code;
|
|
197
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
198
|
+
code = error.code;
|
|
199
|
+
}
|
|
200
|
+
this.debugLogger(`Non-retryable error on API client: ${code} ${description} ${error}`);
|
|
188
201
|
bail(error);
|
|
189
202
|
return {};
|
|
190
203
|
}
|
|
191
204
|
}
|
|
192
205
|
}, retryOptions), retryOptions.maxRetryTime + retryOptions.maxTimeout, 'Retryable API request');
|
|
193
206
|
}
|
|
207
|
+
static isRetryable(axiosError) {
|
|
208
|
+
if (axiosError.response) {
|
|
209
|
+
const statusCode = axiosError.response.status;
|
|
210
|
+
return (statusCode === 429 ||
|
|
211
|
+
statusCode === 502 ||
|
|
212
|
+
statusCode === 503 ||
|
|
213
|
+
statusCode === 504);
|
|
214
|
+
}
|
|
215
|
+
return (axiosError.code !== undefined &&
|
|
216
|
+
RETRYABLE_NODEJS_ERRORS.includes(axiosError.code));
|
|
217
|
+
}
|
|
194
218
|
}
|
|
195
219
|
exports.BasicApiClient = BasicApiClient;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FeatureSet = exports.FindImplementationVersion = void 0;
|
|
4
|
+
const runnerType_1 = require("../browserLauncher/runnerType");
|
|
5
|
+
const PLAYWRIGHT_FEATURE_FLAG = 'nodejs_execution_engine_playwright';
|
|
6
|
+
const SMARTER_WAIT_FEATURE_FLAG = 'smarter_wait';
|
|
7
|
+
var FindImplementationVersion;
|
|
8
|
+
(function (FindImplementationVersion) {
|
|
9
|
+
FindImplementationVersion[FindImplementationVersion["V1"] = 0] = "V1";
|
|
10
|
+
FindImplementationVersion[FindImplementationVersion["SmartFind"] = 1] = "SmartFind";
|
|
11
|
+
})(FindImplementationVersion = exports.FindImplementationVersion || (exports.FindImplementationVersion = {}));
|
|
12
|
+
class FeatureSet {
|
|
13
|
+
constructor(featureFlags) {
|
|
14
|
+
this.featureFlags = featureFlags;
|
|
15
|
+
}
|
|
16
|
+
getRunnerType() {
|
|
17
|
+
return this.featureFlags.has(PLAYWRIGHT_FEATURE_FLAG)
|
|
18
|
+
? runnerType_1.RunnerType.Playwright
|
|
19
|
+
: runnerType_1.RunnerType.Puppeteer;
|
|
20
|
+
}
|
|
21
|
+
getFindImplementationVersion() {
|
|
22
|
+
return this.featureFlags.has(SMARTER_WAIT_FEATURE_FLAG)
|
|
23
|
+
? FindImplementationVersion.SmartFind
|
|
24
|
+
: FindImplementationVersion.V1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.FeatureSet = FeatureSet;
|
package/api/mablApiClient.js
CHANGED
|
@@ -26,9 +26,7 @@ const mablApi_1 = require("../mablApi");
|
|
|
26
26
|
const cliConfigProvider_1 = require("../providers/cliConfigProvider");
|
|
27
27
|
const basicApiClient_1 = require("./basicApiClient");
|
|
28
28
|
const queryString = __importStar(require("query-string"));
|
|
29
|
-
const
|
|
30
|
-
const runnerType_1 = require("../browserLauncher/runnerType");
|
|
31
|
-
const PLAYWRIGHT_FEATURE_FLAG = 'nodejs_execution_engine_playwright';
|
|
29
|
+
const featureSet_1 = require("./featureSet");
|
|
32
30
|
class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
33
31
|
constructor(options) {
|
|
34
32
|
super(options);
|
|
@@ -229,7 +227,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
229
227
|
}
|
|
230
228
|
async getDeploymentResults(deploymentEventId) {
|
|
231
229
|
try {
|
|
232
|
-
return await this.makeGetRequest(`${env_1.BASE_API_URL}/execution/result/event/${deploymentEventId}
|
|
230
|
+
return await this.makeGetRequest(`${env_1.BASE_API_URL}/execution/result/event/${deploymentEventId}`, { requestTimeoutMillis: 600000, maxRetryTimeMillis: 900000 });
|
|
233
231
|
}
|
|
234
232
|
catch (error) {
|
|
235
233
|
throw toApiError(`Failed to get deployment results`, error);
|
|
@@ -237,12 +235,20 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
237
235
|
}
|
|
238
236
|
async getTestFindSummaries(testId, environmentId) {
|
|
239
237
|
try {
|
|
240
|
-
return await this.makeGetRequest(`${env_1.BASE_API_URL}/findSummary?journey_id=${testId}&environment_id=${environmentId}`);
|
|
238
|
+
return await this.makeGetRequest(`${env_1.BASE_API_URL}/findSummary?journey_id=${testId}&environment_id=${environmentId}`).then((result) => { var _a; return (_a = result.findsummaries) !== null && _a !== void 0 ? _a : []; });
|
|
241
239
|
}
|
|
242
240
|
catch (error) {
|
|
243
241
|
throw toApiError(`Failed to get test find summaries results`, error);
|
|
244
242
|
}
|
|
245
243
|
}
|
|
244
|
+
async getTestFindModels(testId, environmentId) {
|
|
245
|
+
try {
|
|
246
|
+
return await this.makeGetRequest(`${env_1.BASE_API_URL}/findModel/test/${testId}?environment_id=${environmentId}`).then((result) => { var _a; return (_a = result.findModels) !== null && _a !== void 0 ? _a : []; });
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
throw toApiError(`Failed to get test find model results`, error);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
246
252
|
async getTestOverrides(testId, environmentId, selectorOverrideLimit = 10) {
|
|
247
253
|
try {
|
|
248
254
|
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 : []; });
|
|
@@ -687,23 +693,18 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
687
693
|
timeout: 3600000,
|
|
688
694
|
});
|
|
689
695
|
}
|
|
690
|
-
async
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}
|
|
702
|
-
catch (ex) {
|
|
703
|
-
logUtils_1.logInternal(`Unable to get the playwright feature flag (${ex})`);
|
|
704
|
-
}
|
|
696
|
+
async getEffectiveFeaturesByWorkspaceId(workspaceId) {
|
|
697
|
+
try {
|
|
698
|
+
const workspace = await this.getWorkspace(workspaceId);
|
|
699
|
+
const account = await this.getAccount(workspace.account_id);
|
|
700
|
+
const features = account.effective_features
|
|
701
|
+
? new Set(account.effective_features)
|
|
702
|
+
: new Set();
|
|
703
|
+
return new featureSet_1.FeatureSet(features);
|
|
704
|
+
}
|
|
705
|
+
catch (error) {
|
|
706
|
+
throw toApiError(`Failed to get feature flags for workspace ${workspaceId}`, error);
|
|
705
707
|
}
|
|
706
|
-
return runnerType_1.RunnerType.Puppeteer;
|
|
707
708
|
}
|
|
708
709
|
}
|
|
709
710
|
exports.MablApiClient = MablApiClient;
|
|
@@ -9,11 +9,6 @@ const authenticationProvider_1 = require("../providers/authenticationProvider");
|
|
|
9
9
|
const cliConfigProvider_1 = require("../providers/cliConfigProvider");
|
|
10
10
|
const basicApiClient_1 = require("./basicApiClient");
|
|
11
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
-
const RETRY_CONFIG = {
|
|
13
|
-
retryCount: 3,
|
|
14
|
-
minTimeoutMillis: 1000,
|
|
15
|
-
maxTimeoutMillis: 2000,
|
|
16
|
-
};
|
|
17
12
|
class MablApiClientFactory {
|
|
18
13
|
static createApiClientFromOptionalApiKey(apiKey) {
|
|
19
14
|
if (apiKey) {
|
|
@@ -44,7 +39,6 @@ class MablApiClientFactory {
|
|
|
44
39
|
token: opts.authToken,
|
|
45
40
|
proxyUrl: httpConfig.proxyHost,
|
|
46
41
|
sslVerify: httpConfig.sslVerify,
|
|
47
|
-
retryConfig: RETRY_CONFIG,
|
|
48
42
|
userAgentOverride: opts.userAgentOverride,
|
|
49
43
|
});
|
|
50
44
|
}
|
|
@@ -56,7 +50,6 @@ class MablApiClientFactory {
|
|
|
56
50
|
token: authConfig.accessToken,
|
|
57
51
|
proxyUrl: httpConfig.proxyHost,
|
|
58
52
|
sslVerify: httpConfig.sslVerify,
|
|
59
|
-
retryConfig: RETRY_CONFIG,
|
|
60
53
|
});
|
|
61
54
|
}
|
|
62
55
|
throw new Error('Please supply an API key or authenticate the mabl CLI tool');
|
|
@@ -74,7 +67,6 @@ class MablApiClientFactory {
|
|
|
74
67
|
token: accessToken,
|
|
75
68
|
proxyUrl: httpConfig.proxyHost,
|
|
76
69
|
sslVerify: httpConfig.sslVerify,
|
|
77
|
-
retryConfig: RETRY_CONFIG,
|
|
78
70
|
});
|
|
79
71
|
}
|
|
80
72
|
static throwUserAuthTypeError() {
|
|
@@ -13,4 +13,5 @@ var PageEvent;
|
|
|
13
13
|
PageEvent["Response"] = "response";
|
|
14
14
|
PageEvent["TracingBufferUsage"] = "tracingbufferusage";
|
|
15
15
|
PageEvent["TracingComplete"] = "tracingcomplete";
|
|
16
|
+
PageEvent["TracingDataCollected"] = "TracingDataCollected";
|
|
16
17
|
})(PageEvent = exports.PageEvent || (exports.PageEvent = {}));
|
|
@@ -7,6 +7,7 @@ exports.PlaywrightBrowserLauncher = void 0;
|
|
|
7
7
|
const test_1 = require("@playwright/test");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const playwrightBrowser_1 = require("./playwrightBrowser");
|
|
10
|
+
const BROWSER_LAUNCH_TIMEOUT_MS = 60000;
|
|
10
11
|
class PlaywrightBrowserLauncher {
|
|
11
12
|
async connect(options, currentDownloadPath) {
|
|
12
13
|
const browser = await test_1.chromium.connect(options.browserWSEndpoint);
|
|
@@ -35,6 +36,7 @@ class PlaywrightBrowserLauncher {
|
|
|
35
36
|
isMobile: (_a = options.defaultDeviceDescriptor) === null || _a === void 0 ? void 0 : _a.isMobile,
|
|
36
37
|
deviceScaleFactor: (_b = options.defaultDeviceDescriptor) === null || _b === void 0 ? void 0 : _b.deviceScaleFactor,
|
|
37
38
|
hasTouch: (_c = options.defaultDeviceDescriptor) === null || _c === void 0 ? void 0 : _c.hasTouch,
|
|
39
|
+
timeout: BROWSER_LAUNCH_TIMEOUT_MS,
|
|
38
40
|
});
|
|
39
41
|
return new playwrightBrowser_1.PlaywrightBrowser(defaultContext, path_1.default.join(options.downloadPath, 'final'), '');
|
|
40
42
|
}
|
|
@@ -26,6 +26,7 @@ const utils_1 = require("../utils");
|
|
|
26
26
|
const logUtils_1 = require("../../util/logUtils");
|
|
27
27
|
const elementHandle_1 = require("../elementHandle");
|
|
28
28
|
const testsUtil_1 = require("../../commands/tests/testsUtil");
|
|
29
|
+
const pureUtil_1 = require("../../util/pureUtil");
|
|
29
30
|
exports.NAVIGATION_ERROR_MESSAGE = 'waiting for scheduled navigations to finish';
|
|
30
31
|
class PlaywrightJsHandle {
|
|
31
32
|
constructor(handle, page) {
|
|
@@ -267,5 +268,16 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
267
268
|
var _a;
|
|
268
269
|
return ((_a = this.cdpSession) !== null && _a !== void 0 ? _a : this.page.getCdpSession()).send(method, paramArgs);
|
|
269
270
|
}
|
|
271
|
+
getTagName() {
|
|
272
|
+
return this.element.evaluate((el) => el.tagName.toLowerCase());
|
|
273
|
+
}
|
|
274
|
+
async getAttribute(attributeName) {
|
|
275
|
+
const result = await this.element.evaluate((el, attributeName) => el.getAttribute(attributeName), attributeName);
|
|
276
|
+
return pureUtil_1.isNullish(result) ? undefined : result;
|
|
277
|
+
}
|
|
278
|
+
async getInnerText() {
|
|
279
|
+
const result = await this.element.evaluate((el) => el.innerText);
|
|
280
|
+
return pureUtil_1.isNullish(result) ? undefined : result;
|
|
281
|
+
}
|
|
270
282
|
}
|
|
271
283
|
exports.PlaywrightElementHandle = PlaywrightElementHandle;
|
|
@@ -130,6 +130,12 @@ class PlaywrightPage extends events_1.default {
|
|
|
130
130
|
this.emit(browserLauncher_1.PageEvent.TracingBufferUsage, tracing);
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
+
if (event === browserLauncher_1.PageEvent.TracingDataCollected &&
|
|
134
|
+
!this.listenerCount(event)) {
|
|
135
|
+
this.getCdpSession().on('Tracing.dataCollected', (data) => {
|
|
136
|
+
this.emit(browserLauncher_1.PageEvent.TracingDataCollected, data);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
133
139
|
if (event === browserLauncher_1.PageEvent.TracingComplete && !this.listenerCount(event)) {
|
|
134
140
|
this.getCdpSession().on('Tracing.tracingComplete', (tracingComplete) => {
|
|
135
141
|
this.emit(browserLauncher_1.PageEvent.TracingComplete, tracingComplete);
|
|
@@ -53,6 +53,16 @@ class PuppeteerBrowser extends events_1.default {
|
|
|
53
53
|
this.browser.disconnect();
|
|
54
54
|
return Promise.resolve();
|
|
55
55
|
}
|
|
56
|
+
reconnect() {
|
|
57
|
+
const webSocketEndpoint = this.wsEndpoint();
|
|
58
|
+
if (!webSocketEndpoint) {
|
|
59
|
+
throw new Error(`No browser websocket endpoint configured or supplied for connection`);
|
|
60
|
+
}
|
|
61
|
+
return browserLauncher_1.BrowserLauncherFactory.createRunner(this.getRunnerType()).connect({
|
|
62
|
+
defaultDeviceDescriptor: undefined,
|
|
63
|
+
browserWSEndpoint: webSocketEndpoint,
|
|
64
|
+
}, this.getDownloadDirectory());
|
|
65
|
+
}
|
|
56
66
|
async newPage() {
|
|
57
67
|
return this.getOrCreatePage(await this.browser.newPage());
|
|
58
68
|
}
|
|
@@ -5,6 +5,7 @@ const puppeteerJsHandle_1 = require("./puppeteerJsHandle");
|
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const testsUtil_1 = require("../../commands/tests/testsUtil");
|
|
7
7
|
const elementHandle_1 = require("../elementHandle");
|
|
8
|
+
const pureUtil_1 = require("../../util/pureUtil");
|
|
8
9
|
const msBetweenClicks = 100;
|
|
9
10
|
class PuppeteerElementHandle extends puppeteerJsHandle_1.PuppeteerJsHandle {
|
|
10
11
|
constructor(element, parentPage) {
|
|
@@ -123,5 +124,16 @@ class PuppeteerElementHandle extends puppeteerJsHandle_1.PuppeteerJsHandle {
|
|
|
123
124
|
getValue() {
|
|
124
125
|
return this.element.evaluate((el) => el.value);
|
|
125
126
|
}
|
|
127
|
+
async getInnerText() {
|
|
128
|
+
const result = await this.element.evaluate((el) => el.innerText);
|
|
129
|
+
return pureUtil_1.isNullish(result) ? undefined : result;
|
|
130
|
+
}
|
|
131
|
+
getTagName() {
|
|
132
|
+
return this.element.evaluate((el) => el.tagName.toLowerCase());
|
|
133
|
+
}
|
|
134
|
+
async getAttribute(attributeName) {
|
|
135
|
+
const result = await this.element.evaluate((el, attributeName) => el.getAttribute(attributeName), attributeName);
|
|
136
|
+
return pureUtil_1.isNullish(result) ? undefined : result;
|
|
137
|
+
}
|
|
126
138
|
}
|
|
127
139
|
exports.PuppeteerElementHandle = PuppeteerElementHandle;
|
|
@@ -245,6 +245,12 @@ class PuppeteerPage extends events_1.default {
|
|
|
245
245
|
this.emit(browserLauncher_1.PageEvent.TracingComplete, tracingComplete);
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
|
+
if (event === browserLauncher_1.PageEvent.TracingDataCollected &&
|
|
249
|
+
!this.listenerCount(event)) {
|
|
250
|
+
this.getCdpClient().on('Tracing.dataCollected', (data) => {
|
|
251
|
+
this.emit(browserLauncher_1.PageEvent.TracingComplete, data);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
248
254
|
}
|
|
249
255
|
evaluateHandleInSecondaryWorld(code, ...args) {
|
|
250
256
|
return this.mainFrame().evaluateHandleInSecondaryWorld(code, ...args);
|
|
@@ -1,9 +1,12 @@
|
|
|
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
|
const js_yaml_1 = require("js-yaml");
|
|
4
7
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
5
8
|
const util_1 = require("../../commandUtil/util");
|
|
6
|
-
const
|
|
9
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
7
10
|
const moment = require("moment");
|
|
8
11
|
const list_1 = require("../../commandUtil/list");
|
|
9
12
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
@@ -30,7 +33,7 @@ function printApplications(applications, output) {
|
|
|
30
33
|
loggingProvider_1.logger.info(js_yaml_1.dump(applications));
|
|
31
34
|
break;
|
|
32
35
|
default:
|
|
33
|
-
const table = new
|
|
36
|
+
const table = new cli_table3_1.default({
|
|
34
37
|
head: ['ID', 'Name', 'Created time'],
|
|
35
38
|
wordWrap: true,
|
|
36
39
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
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
|
const js_yaml_1 = require("js-yaml");
|
|
4
|
-
const
|
|
7
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
5
8
|
const moment = require("moment");
|
|
6
9
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
7
10
|
const util_1 = require("../../commandUtil/util");
|
|
@@ -55,7 +58,7 @@ function printBranches(branches, output) {
|
|
|
55
58
|
loggingProvider_1.logger.info(js_yaml_1.dump(branches));
|
|
56
59
|
break;
|
|
57
60
|
default:
|
|
58
|
-
const table = new
|
|
61
|
+
const table = new cli_table3_1.default({
|
|
59
62
|
head: ['ID', 'Name', 'Status', 'Created'],
|
|
60
63
|
});
|
|
61
64
|
branches.forEach((branch) => {
|
|
@@ -1,8 +1,11 @@
|
|
|
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
|
const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
|
|
4
7
|
const set_1 = require("./set");
|
|
5
|
-
const
|
|
8
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
6
9
|
const list_1 = require("./list");
|
|
7
10
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
8
11
|
exports.command = `get <${set_1.configKeyCommandArg}>`;
|
|
@@ -16,7 +19,7 @@ exports.builder = (yargs) => {
|
|
|
16
19
|
exports.handler = getConfig;
|
|
17
20
|
function getConfig(parsed) {
|
|
18
21
|
const key = parsed['config-key'];
|
|
19
|
-
const table = new
|
|
22
|
+
const table = new cli_table3_1.default({
|
|
20
23
|
head: ['Config', 'Value', 'Details'],
|
|
21
24
|
});
|
|
22
25
|
let value;
|
|
@@ -1,8 +1,11 @@
|
|
|
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.listConfig = exports.defaultTupleValue = void 0;
|
|
4
7
|
const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
|
|
5
|
-
const
|
|
8
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
6
9
|
const set_1 = require("./set");
|
|
7
10
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
8
11
|
exports.command = `list`;
|
|
@@ -10,7 +13,7 @@ exports.describe = 'List all user config values';
|
|
|
10
13
|
exports.handler = listConfig;
|
|
11
14
|
exports.defaultTupleValue = '---';
|
|
12
15
|
function listConfig() {
|
|
13
|
-
const table = new
|
|
16
|
+
const table = new cli_table3_1.default({
|
|
14
17
|
head: ['Config', 'Value', 'Details'],
|
|
15
18
|
colWidths: [null, 60],
|
|
16
19
|
});
|
|
@@ -1,9 +1,12 @@
|
|
|
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
|
const js_yaml_1 = require("js-yaml");
|
|
4
7
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
5
8
|
const util_1 = require("../../commandUtil/util");
|
|
6
|
-
const
|
|
9
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
7
10
|
const moment = require("moment");
|
|
8
11
|
const list_1 = require("../../commandUtil/list");
|
|
9
12
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
@@ -30,7 +33,7 @@ function printCredentials(credentials, output) {
|
|
|
30
33
|
loggingProvider_1.logger.info(js_yaml_1.dump(credentials));
|
|
31
34
|
break;
|
|
32
35
|
default:
|
|
33
|
-
const table = new
|
|
36
|
+
const table = new cli_table3_1.default({
|
|
34
37
|
head: ['ID', 'Name', 'Description', 'Created time'],
|
|
35
38
|
wordWrap: true,
|
|
36
39
|
});
|
|
@@ -1,10 +1,13 @@
|
|
|
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.ExecutionResultPresenter = void 0;
|
|
4
7
|
const change_case_1 = require("change-case");
|
|
5
8
|
const mablApi_1 = require("../../../mablApi");
|
|
6
9
|
const moment = require("moment");
|
|
7
|
-
const
|
|
10
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
8
11
|
const chalk = require('chalk');
|
|
9
12
|
const momentDurationFormatSetup = require('moment-duration-format');
|
|
10
13
|
momentDurationFormatSetup(moment);
|
|
@@ -25,7 +28,7 @@ class ExecutionResultPresenter {
|
|
|
25
28
|
if (columnWidth) {
|
|
26
29
|
tableConfig.colWidths = Array(columnLabels.length - 1).fill(columnWidth);
|
|
27
30
|
}
|
|
28
|
-
const table = new
|
|
31
|
+
const table = new cli_table3_1.default(tableConfig);
|
|
29
32
|
const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
|
|
30
33
|
finalExecutions.forEach((summary) => {
|
|
31
34
|
var _a, _b, _c, _d, _e;
|
|
@@ -1,7 +1,10 @@
|
|
|
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
|
const js_yaml_1 = require("js-yaml");
|
|
4
|
-
const
|
|
7
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
5
8
|
const moment = require("moment");
|
|
6
9
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
7
10
|
const util_1 = require("../../commandUtil/util");
|
|
@@ -30,7 +33,7 @@ function printDeployments(deployments, output) {
|
|
|
30
33
|
loggingProvider_1.logger.info(js_yaml_1.dump(deployments));
|
|
31
34
|
break;
|
|
32
35
|
default:
|
|
33
|
-
const table = new
|
|
36
|
+
const table = new cli_table3_1.default({
|
|
34
37
|
head: ['ID', 'Time', 'Application/Env.', 'Pass', 'Fail', 'Total'],
|
|
35
38
|
});
|
|
36
39
|
deployments.forEach((deployment) => {
|
|
@@ -1,9 +1,12 @@
|
|
|
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
|
const js_yaml_1 = require("js-yaml");
|
|
4
7
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
5
8
|
const util_1 = require("../../commandUtil/util");
|
|
6
|
-
const
|
|
9
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
7
10
|
const moment = require("moment");
|
|
8
11
|
const list_1 = require("../../commandUtil/list");
|
|
9
12
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
@@ -30,7 +33,7 @@ function printEnvironments(environments, output) {
|
|
|
30
33
|
loggingProvider_1.logger.info(js_yaml_1.dump(environments));
|
|
31
34
|
break;
|
|
32
35
|
default:
|
|
33
|
-
const table = new
|
|
36
|
+
const table = new cli_table3_1.default({
|
|
34
37
|
head: ['ID', 'Name', 'Created time'],
|
|
35
38
|
wordWrap: true,
|
|
36
39
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
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
|
-
const
|
|
6
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
4
7
|
const moment = require("moment");
|
|
5
8
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
6
9
|
const util_1 = require("../../commandUtil/util");
|
|
@@ -42,7 +45,7 @@ async function listFlows(parsed) {
|
|
|
42
45
|
return flows.length;
|
|
43
46
|
}
|
|
44
47
|
function printFlows(flows) {
|
|
45
|
-
const table = new
|
|
48
|
+
const table = new cli_table3_1.default({
|
|
46
49
|
head: ['ID', 'Description', 'Created time'],
|
|
47
50
|
wordWrap: true,
|
|
48
51
|
});
|