@testim/testim-cli 3.253.0 → 3.255.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/OverrideTestDataBuilder.js +1 -1
- package/agent/routers/cliJsCode/index.js +4 -4
- package/agent/routers/cliJsCode/router.js +46 -42
- package/agent/routers/cliJsCode/service.js +18 -13
- package/agent/routers/codim/router.js +14 -17
- package/agent/routers/codim/router.test.js +19 -21
- package/agent/routers/codim/service.js +16 -16
- package/agent/routers/general/index.js +4 -8
- package/agent/routers/hybrid/registerRoutes.js +18 -18
- package/agent/routers/index.js +7 -7
- package/agent/routers/playground/router.js +11 -10
- package/agent/routers/playground/service.js +22 -23
- package/agent/routers/standalone-browser/registerRoutes.js +10 -10
- package/cdpTestRunner.js +4 -3
- package/chromiumInstaller.js +4 -5
- package/cli/onExit.js +2 -2
- package/cli.js +11 -10
- package/cliAgentMode.js +8 -8
- package/codim/codim-cli.js +20 -17
- package/codim/hybrid-utils.js +1 -1
- package/codim/measure-perf.js +9 -6
- package/codim/template.js/tests/examples/01-simple-text-validation.test.js +6 -6
- package/codim/template.js/tests/examples/02-using-locators.test.js +13 -15
- package/codim/template.js/tests/examples/03-using-hooks.test.js +17 -19
- package/codim/template.js/tests/examples/04-skip-and-only.test.js +16 -17
- package/codim/template.js/tests/examples/05-multiple-windows.test.js +16 -17
- package/codim/template.js/webpack.config.js +1 -1
- package/codim/template.ts/webpack.config.js +3 -3
- package/commons/AbortError.js +4 -4
- package/commons/detectDebugger.js +4 -2
- package/commons/featureFlags.js +8 -0
- package/commons/httpRequest.js +5 -1
- package/commons/httpRequestCounters.js +21 -10
- package/commons/lazyRequire.js +14 -12
- package/commons/logger.js +4 -4
- package/commons/performance-logger.js +14 -8
- package/commons/preloadTests.js +2 -2
- package/commons/prepareRunner.js +4 -2
- package/commons/prepareRunnerAndTestimStartUtils.js +40 -42
- package/commons/runnerFileCache.js +1 -1
- package/commons/socket/baseSocketServiceSocketIO.js +32 -34
- package/commons/socket/realDataService.js +6 -5
- package/commons/socket/realDataServiceSocketIO.js +4 -4
- package/commons/socket/remoteStepService.js +4 -3
- package/commons/socket/remoteStepServiceSocketIO.js +11 -12
- package/commons/socket/socketService.js +50 -52
- package/commons/socket/testResultServiceSocketIO.js +11 -11
- package/commons/testimDesiredCapabilitiesBuilder.js +3 -2
- package/commons/testimNgrok.js +2 -2
- package/commons/testimNgrok.test.js +1 -1
- package/commons/testimServicesApi.js +27 -20
- package/commons/testimTunnel.test.js +2 -1
- package/commons/xhr2.js +97 -100
- package/coverage/SummaryToObjectReport.js +0 -1
- package/coverage/jsCoverage.js +12 -10
- package/errors.js +5 -0
- package/fixLocalBuild.js +2 -0
- package/inputFileUtils.js +11 -9
- package/npm-shrinkwrap.json +2286 -1284
- package/package.json +9 -8
- package/player/appiumTestPlayer.js +1 -1
- package/player/chromeLauncherTestPlayer.js +0 -1
- package/player/services/tabService.js +15 -1
- package/player/services/tabServiceMock.js +166 -0
- package/player/stepActions/locateStepAction.js +2 -0
- package/player/stepActions/navigationStepAction.js +11 -10
- package/player/stepActions/sleepStepAction.js +4 -5
- package/player/stepActions/textStepAction.js +4 -11
- package/player/utils/imageCaptureUtils.js +81 -120
- package/player/utils/windowUtils.js +4 -3
- package/player/webdriver.js +26 -23
- package/processHandler.js +3 -3
- package/processHandler.test.js +1 -1
- package/reports/consoleReporter.js +3 -2
- package/reports/junitReporter.js +7 -9
- package/reports/reporter.js +34 -39
- package/runOptions.d.ts +260 -0
- package/runOptions.js +59 -44
- package/runner.js +14 -0
- package/runners/ParallelWorkerManager.js +9 -10
- package/runners/TestPlanRunner.js +142 -78
- package/runners/buildCodeTests.js +38 -37
- package/runners/runnerUtils.js +3 -3
- package/services/gridService.js +36 -40
- package/services/lambdatestService.js +3 -5
- package/stepPlayers/cliJsStepPlayback.js +22 -17
- package/testRunHandler.js +8 -0
- package/testRunStatus.js +9 -6
- package/utils/argsUtils.js +86 -0
- package/utils/argsUtils.test.js +32 -0
- package/utils/fsUtils.js +154 -0
- package/{utils.js → utils/index.js} +19 -262
- package/utils/promiseUtils.js +89 -0
- package/utils/stringUtils.js +98 -0
- package/utils/stringUtils.test.js +22 -0
- package/utils/timeUtils.js +25 -0
- package/utils/utils.test.js +27 -0
- package/workers/BaseWorker.js +16 -14
- package/workers/WorkerAppium.js +1 -1
- package/workers/WorkerExtension.js +6 -7
- package/workers/WorkerExtensionSingleBrowser.js +4 -4
- package/workers/WorkerSelenium.js +5 -2
- package/utils.test.js +0 -68
|
@@ -6,7 +6,7 @@ const _ = require('lodash');
|
|
|
6
6
|
const testimCustomToken = require('./testimCustomToken');
|
|
7
7
|
const constants = require('./constants');
|
|
8
8
|
const Promise = require('bluebird');
|
|
9
|
-
const utils = require('../utils
|
|
9
|
+
const utils = require('../utils');
|
|
10
10
|
const config = require('./config');
|
|
11
11
|
const httpRequest = require('./httpRequest');
|
|
12
12
|
|
|
@@ -84,6 +84,12 @@ function getTestPlan(projectId, testPlanNames) {
|
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
async function loadSfdcCredential({ branch, projectId }) {
|
|
88
|
+
const branchData = await pRetry(() => getWithAuth(`/branch/branchData/${branch}`, {
|
|
89
|
+
projectId,
|
|
90
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
91
|
+
return branchData?.sfdcCredential;
|
|
92
|
+
}
|
|
87
93
|
|
|
88
94
|
function loadTest({ testId, branch, projectId, skipSharedSteps = false, useBranchMap = true }) {
|
|
89
95
|
return pRetry(() => getWithAuth(`/test/${testId}`, {
|
|
@@ -174,7 +180,7 @@ function reportExecutionFinished(status, executionId, projectId, success, tmsOpt
|
|
|
174
180
|
tmsOptions,
|
|
175
181
|
remoteRunId,
|
|
176
182
|
resultExtraData,
|
|
177
|
-
}), {
|
|
183
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
178
184
|
}
|
|
179
185
|
|
|
180
186
|
async function getTestPlanTestList(projectId, names, planIds, branch, intersections) {
|
|
@@ -183,7 +189,7 @@ async function getTestPlanTestList(projectId, names, planIds, branch, intersecti
|
|
|
183
189
|
body: { projectId, names, planIds, branch, intersections },
|
|
184
190
|
// people who send insane lists get a timeout :(
|
|
185
191
|
timeout: 120000,
|
|
186
|
-
}), {
|
|
192
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
187
193
|
}
|
|
188
194
|
|
|
189
195
|
function getSuiteTestList({
|
|
@@ -204,11 +210,11 @@ function getSuiteTestList({
|
|
|
204
210
|
testConfigIds,
|
|
205
211
|
intersections,
|
|
206
212
|
},
|
|
207
|
-
}), {
|
|
213
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
208
214
|
}
|
|
209
215
|
|
|
210
216
|
function getUsageForCurrentBillingPeriod(projectId) {
|
|
211
|
-
return pRetry(() => getWithAuth(`/plan/project/${projectId}/usage-current-billing-period`), {
|
|
217
|
+
return pRetry(() => getWithAuth(`/plan/project/${projectId}/usage-current-billing-period`), { retries: DEFAULT_REQUEST_RETRY })
|
|
212
218
|
.catch((error) => {
|
|
213
219
|
logger.error('failed getting usage for current billing period', { projectId, error });
|
|
214
220
|
return undefined;
|
|
@@ -216,11 +222,11 @@ function getUsageForCurrentBillingPeriod(projectId) {
|
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
function isTestResultCompleted(resultId, projectId, testRetryKey) {
|
|
219
|
-
return pRetry(() => getWithAuth(`/result/${resultId}/isComplete`, { projectId, testRetryKey }), {
|
|
225
|
+
return pRetry(() => getWithAuth(`/result/${resultId}/isComplete`, { projectId, testRetryKey }), { retries: DEFAULT_REQUEST_RETRY });
|
|
220
226
|
}
|
|
221
227
|
|
|
222
228
|
function getTestResults(testId, resultId, projectId, branch) {
|
|
223
|
-
return pRetry(() => getWithAuth(`/test/v2/${testId}/result/${resultId}`, { projectId, branch }), {
|
|
229
|
+
return pRetry(() => getWithAuth(`/test/v2/${testId}/result/${resultId}`, { projectId, branch }), { retries: DEFAULT_REQUEST_RETRY });
|
|
224
230
|
}
|
|
225
231
|
|
|
226
232
|
function keepAliveGrid(projectId, slots) {
|
|
@@ -250,11 +256,11 @@ function getHybridGridProvider(body) {
|
|
|
250
256
|
function getGridByName(companyId, projectId, gridName, browser, executionId) {
|
|
251
257
|
return pRetry(() => getWithAuth('/grid/name', {
|
|
252
258
|
companyId, projectId, name: gridName, browser, executionId, reqId: utils.guid(),
|
|
253
|
-
}), {
|
|
259
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
254
260
|
}
|
|
255
261
|
|
|
256
262
|
function getGridById(companyId, projectId, gridId, browser, executionId) {
|
|
257
|
-
return pRetry(() => getWithAuth(`/grid/${gridId}`, { companyId, projectId, browser, executionId, reqId: utils.guid() }), {
|
|
263
|
+
return pRetry(() => getWithAuth(`/grid/${gridId}`, { companyId, projectId, browser, executionId, reqId: utils.guid() }), { retries: DEFAULT_REQUEST_RETRY });
|
|
258
264
|
}
|
|
259
265
|
|
|
260
266
|
|
|
@@ -269,7 +275,7 @@ async function initializeUserWithAuth({ projectId, token, branchName, lightweigh
|
|
|
269
275
|
lightweightMode,
|
|
270
276
|
localGrid,
|
|
271
277
|
},
|
|
272
|
-
}), {
|
|
278
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
273
279
|
} catch (e) {
|
|
274
280
|
logger.error('error initializing info from server', e);
|
|
275
281
|
if (e && e.message && e.message.includes('Bad Request')) {
|
|
@@ -292,7 +298,7 @@ async function getEditorUrl() {
|
|
|
292
298
|
}
|
|
293
299
|
try {
|
|
294
300
|
return await pRetry(() => getWithAuth('/system-info/editor-url'), {
|
|
295
|
-
|
|
301
|
+
retries: DEFAULT_REQUEST_RETRY,
|
|
296
302
|
onFailedAttempt: error => {
|
|
297
303
|
if (error.attemptNumber >= DEFAULT_REQUEST_RETRY) {
|
|
298
304
|
throw error;
|
|
@@ -306,16 +312,16 @@ async function getEditorUrl() {
|
|
|
306
312
|
}
|
|
307
313
|
|
|
308
314
|
function getAllGrids(companyId) {
|
|
309
|
-
return pRetry(() => getWithAuth('/grid', { companyId }), {
|
|
315
|
+
return pRetry(() => getWithAuth('/grid', { companyId }), { retries: DEFAULT_REQUEST_RETRY });
|
|
310
316
|
}
|
|
311
317
|
|
|
312
|
-
const fetchLambdatestConfig = async () => pRetry(() => getWithAuth('/grid/lt/config'), {
|
|
318
|
+
const fetchLambdatestConfig = async () => pRetry(() => getWithAuth('/grid/lt/config'), { retries: DEFAULT_REQUEST_RETRY });
|
|
313
319
|
|
|
314
|
-
const getLabFeaturesByProjectId = async (projectId) => pRetry(() => getWithAuth(`/labFeature/v2/project/${projectId}`), {
|
|
320
|
+
const getLabFeaturesByProjectId = async (projectId) => pRetry(() => getWithAuth(`/labFeature/v2/project/${projectId}`), { retries: DEFAULT_REQUEST_RETRY });
|
|
315
321
|
|
|
316
322
|
|
|
317
323
|
function getRealData(projectId, channel, query) {
|
|
318
|
-
return pRetry(() => getWithAuth(`/real-data/${channel}?${query}&projectId=${projectId}`), {
|
|
324
|
+
return pRetry(() => getWithAuth(`/real-data/${channel}?${query}&projectId=${projectId}`), { retries: DEFAULT_REQUEST_RETRY });
|
|
319
325
|
}
|
|
320
326
|
|
|
321
327
|
function updateTestResult(projectId, resultId, testId, testResult, remoteRunId) {
|
|
@@ -328,7 +334,7 @@ function updateTestResult(projectId, resultId, testId, testResult, remoteRunId)
|
|
|
328
334
|
testResult,
|
|
329
335
|
remoteRunId,
|
|
330
336
|
},
|
|
331
|
-
}), {
|
|
337
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
332
338
|
}
|
|
333
339
|
|
|
334
340
|
function clearTestResult(projectId, resultId, testId, testResult) {
|
|
@@ -340,7 +346,7 @@ function clearTestResult(projectId, resultId, testId, testResult) {
|
|
|
340
346
|
testId,
|
|
341
347
|
testResult,
|
|
342
348
|
},
|
|
343
|
-
}), {
|
|
349
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
344
350
|
}
|
|
345
351
|
|
|
346
352
|
function saveRemoteStep(projectId, resultId, stepId, remoteStep) {
|
|
@@ -352,7 +358,7 @@ function saveRemoteStep(projectId, resultId, stepId, remoteStep) {
|
|
|
352
358
|
stepId,
|
|
353
359
|
remoteStep,
|
|
354
360
|
},
|
|
355
|
-
}), {
|
|
361
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
356
362
|
}
|
|
357
363
|
|
|
358
364
|
function relativize(uri) {
|
|
@@ -393,7 +399,7 @@ function uploadArtifact(projectId, testId, testResultId, content, subType, mimeT
|
|
|
393
399
|
|
|
394
400
|
return pRetry(() => postAuthFormData(`/storage${storagePath}`, {}, files, {
|
|
395
401
|
'X-Asset-Encoding': 'gzip',
|
|
396
|
-
}), {
|
|
402
|
+
}), { retries: DEFAULT_REQUEST_RETRY }).then(() => storagePath);
|
|
397
403
|
}
|
|
398
404
|
|
|
399
405
|
const uploadRunDataArtifact = _.memoize(async (projectId, testId, testResultId, runData) => {
|
|
@@ -443,7 +449,7 @@ function addTestRetry({
|
|
|
443
449
|
runId,
|
|
444
450
|
testResult,
|
|
445
451
|
},
|
|
446
|
-
}), {
|
|
452
|
+
}), { retries: DEFAULT_REQUEST_RETRY });
|
|
447
453
|
}
|
|
448
454
|
|
|
449
455
|
/**
|
|
@@ -518,6 +524,7 @@ module.exports = {
|
|
|
518
524
|
initializeUserWithAuth: Promise.method(initializeUserWithAuth),
|
|
519
525
|
addTestRetry,
|
|
520
526
|
getHybridGridProvider,
|
|
527
|
+
loadSfdcCredential,
|
|
521
528
|
loadTest,
|
|
522
529
|
isTestResultCompleted,
|
|
523
530
|
getApplitoolsIntegrationData,
|
|
@@ -66,7 +66,8 @@ describe('testimTunnel', () => {
|
|
|
66
66
|
|
|
67
67
|
it('should handle connect errors', async () => {
|
|
68
68
|
ltConnectStub.rejects('error');
|
|
69
|
-
|
|
69
|
+
const connectPromise = testimTunnel.connect({ tunnel: true, gridData: { type: 'testimLambdaTest', tunnel: 'lambdatest' } });
|
|
70
|
+
await expect(connectPromise).to.be.rejectedWith('Failed to start tunnel. Please contact support@testim.io');
|
|
70
71
|
});
|
|
71
72
|
});
|
|
72
73
|
|