@testim/testim-cli 3.196.0 → 3.197.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 +1 -1
- package/cli/onExit.js +12 -1
- package/cli.js +5 -1
- package/commons/constants.js +0 -25
- package/commons/featureFlags.js +2 -0
- package/commons/socket/testResultService.js +4 -14
- package/commons/testimAnalytics.js +0 -1
- package/commons/testimDesiredCapabilitiesBuilder.js +0 -94
- package/commons/testimServicesApi.js +9 -79
- package/executionQueue.js +7 -4
- package/npm-shrinkwrap.json +948 -512
- package/package.json +3 -1
- package/player/stepActions/baseJsStepAction.js +5 -1
- package/player/stepActions/pixelValidationStepAction.js +28 -0
- package/player/stepActions/salesforceAutoLoginStepAction.js +5 -3
- package/player/stepActions/stepActionRegistrar.js +3 -48
- package/player/utils/eyeSdkService.js +230 -0
- package/reports/consoleReporter.js +0 -20
- package/reports/reporter.js +0 -21
- package/runOptions.js +13 -89
- package/runner.js +3 -44
- package/runners/{strategies/LocalStrategy.js → ParallelWorkerManager.js} +59 -68
- package/runners/TestPlanRunner.js +286 -67
- package/runners/runnerUtils.js +73 -0
- package/services/analyticsService.js +94 -0
- package/services/gridService.js +24 -16
- package/services/gridService.test.js +21 -21
- package/testRunHandler.js +1 -1
- package/testRunStatus.js +13 -9
- package/utils.js +5 -5
- package/workers/BaseWorker.js +38 -39
- package/workers/BaseWorker.test.js +1 -1
- package/workers/WorkerExtensionSingleBrowser.js +6 -3
- package/commons/apkUploader/apkUploader.js +0 -46
- package/commons/apkUploader/apkUploaderFactory.js +0 -68
- package/commons/apkUploader/deviceFarmApkUploader.js +0 -41
- package/commons/apkUploader/saucelabsApkUploader.js +0 -36
- package/commons/apkUploader/testObjectApkUploader.js +0 -34
- package/player/mobile/mobileTestPlayer.js +0 -80
- package/player/mobile/mobileWebDriver.js +0 -155
- package/player/mobile/services/frameLocatorMock.js +0 -18
- package/player/mobile/services/mobilePortSelector.js +0 -22
- package/player/mobile/services/mobileTabService.js +0 -241
- package/player/mobile/utils/mobileScreenshotUtils.js +0 -46
- package/player/mobile/utils/mobileWindowUtils.js +0 -84
- package/player/stepActions/mobile/android/androidLocateStepAction.js +0 -122
- package/player/stepActions/mobile/android/androidLongClickStepAction.js +0 -12
- package/player/stepActions/mobile/android/androidScrollStepAction.js +0 -134
- package/player/stepActions/mobile/android/androidSpecialKeyStepAction.js +0 -22
- package/player/stepActions/mobile/android/androidSwipeStepAction.js +0 -32
- package/player/stepActions/mobile/androidGlobalActionStepAction.js +0 -12
- package/player/stepActions/mobile/androidTapStepAction.js +0 -19
- package/player/stepActions/mobile/androidTextChangeStepAction.js +0 -23
- package/player/stepActions/mobile/ios/iosLocateStepAction.js +0 -124
- package/player/stepActions/mobile/ios/iosScrollStepAction.js +0 -76
- package/runners/AnonymousTestPlanRunner.js +0 -106
- package/runners/BaseRunner.js +0 -42
- package/runners/BaseTestPlanRunner.js +0 -194
- package/runners/DeviceFarmRemoteRunner.js +0 -50
- package/runners/SchedulerRemoteRunner.js +0 -47
- package/runners/strategies/BaseStrategy.js +0 -86
- package/runners/strategies/DeviceFarmStrategy.js +0 -195
- package/runners/strategies/LocalDeviceFarmStrategy.js +0 -12
- package/runners/strategies/LocalTestStrategy.js +0 -14
- package/runners/strategies/Strategy.js +0 -17
- package/workers/WorkerAppium.js +0 -70
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
# TESTIM.IO
|
|
3
|
-
## Web
|
|
3
|
+
## Web Test Automation Solution. Built for agile teams. Testim is a cloud service that instantly enables Test Automation to make your Continuous Delivery ready.
|
|
4
4
|
|
|
5
5
|
For more information please check out https://testim.io and https://help.testim.io/docs
|
|
6
6
|
|
package/cli/onExit.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const constants = require('../commons/constants');
|
|
4
|
-
const utils = require('../utils');
|
|
5
4
|
const { requireWithFallback } = require('../commons/requireWithFallback');
|
|
6
5
|
const { isCi } = require('./isCiRun');
|
|
7
6
|
const { writeStackTrace } = require('./writeStackTrace');
|
|
8
7
|
const logger = require('../commons/logger').getLogger('process-handler');
|
|
9
8
|
|
|
9
|
+
let exitCodeIgnoreFailingTests = false;
|
|
10
|
+
|
|
10
11
|
function getExitCode(result) {
|
|
11
12
|
if (result instanceof Error) {
|
|
12
13
|
return 1;
|
|
13
14
|
}
|
|
15
|
+
|
|
16
|
+
if (exitCodeIgnoreFailingTests) {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
result = result || {};
|
|
15
21
|
const hasFailedTests = Object.values(result).some(
|
|
16
22
|
({ runnerStatus, success, testStatus, status }) => {
|
|
@@ -32,9 +38,13 @@ function closeChromeDriverIfRunning() {
|
|
|
32
38
|
try {
|
|
33
39
|
const chromedriver = requireWithFallback('chromedriver');
|
|
34
40
|
chromedriver.stop();
|
|
41
|
+
// eslint-disable-next-line no-empty
|
|
35
42
|
} catch (err) { }
|
|
36
43
|
}
|
|
37
44
|
|
|
45
|
+
module.exports.ignoreFailingTestsInExitCode = function () {
|
|
46
|
+
exitCodeIgnoreFailingTests = true;
|
|
47
|
+
};
|
|
38
48
|
|
|
39
49
|
|
|
40
50
|
module.exports.onExit = async function onExit(exitValue) {
|
|
@@ -42,6 +52,7 @@ module.exports.onExit = async function onExit(exitValue) {
|
|
|
42
52
|
if (!isCi) {
|
|
43
53
|
writeStackTrace(exitValue);
|
|
44
54
|
} else {
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
45
56
|
console.error(exitValue, exitValue && exitValue.stack);
|
|
46
57
|
}
|
|
47
58
|
}
|
package/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ require('./bluebirdConfig.js');
|
|
|
7
7
|
const options = require('./runOptions');
|
|
8
8
|
const EventEmitter = require('events');
|
|
9
9
|
const logger = require('./commons/logger').getLogger('cli-entry');
|
|
10
|
-
const { onExit } = require('./cli/onExit');
|
|
10
|
+
const { onExit, ignoreFailingTestsInExitCode } = require('./cli/onExit');
|
|
11
11
|
const testRunner = require('./runner');
|
|
12
12
|
const prepareRunner = require('./commons/prepareRunner');
|
|
13
13
|
const { CLI_MODE } = require('./commons/constants');
|
|
@@ -92,6 +92,10 @@ function main() {
|
|
|
92
92
|
options.localRCASaver = `http://localhost:${port}`;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
if (options.exitCodeIgnoreFailingTests) {
|
|
96
|
+
ignoreFailingTestsInExitCode();
|
|
97
|
+
}
|
|
98
|
+
|
|
95
99
|
perf.log('right before testRunner.init/prepareRunner.prepare');
|
|
96
100
|
return Promise.all([
|
|
97
101
|
testRunner.init(options),
|
package/commons/constants.js
CHANGED
|
@@ -33,29 +33,6 @@ module.exports = {
|
|
|
33
33
|
test: {
|
|
34
34
|
HIDDEN_PARAM: 'TST_HIDDEN_PARAM',
|
|
35
35
|
},
|
|
36
|
-
deviceFarm: {
|
|
37
|
-
status: {
|
|
38
|
-
INITIALIZING: 'INITIALIZING',
|
|
39
|
-
PENDING: 'PENDING',
|
|
40
|
-
PENDING_CONCURRENCY: 'PENDING_CONCURRENCY',
|
|
41
|
-
PENDING_DEVICE: 'PENDING_DEVICE',
|
|
42
|
-
PROCESSING: 'PROCESSING',
|
|
43
|
-
SCHEDULING: 'SCHEDULING',
|
|
44
|
-
PREPARING: 'PREPARING',
|
|
45
|
-
RUNNING: 'RUNNING',
|
|
46
|
-
COMPLETED: 'COMPLETED',
|
|
47
|
-
STOPPING: 'STOPPING',
|
|
48
|
-
},
|
|
49
|
-
result: {
|
|
50
|
-
PENDING: 'PENDING',
|
|
51
|
-
PASSED: 'PASSED',
|
|
52
|
-
WARNED: 'WARNED',
|
|
53
|
-
FAILED: 'FAILED',
|
|
54
|
-
SKIPPED: 'SKIPPED',
|
|
55
|
-
ERRORED: 'ERRORED',
|
|
56
|
-
STOPPED: 'STOPPED',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
36
|
socketEventTypes: {
|
|
60
37
|
TEST_RESULT_CREATED: 'test-result-created',
|
|
61
38
|
TEST_RESULT_UPDATED: 'test-result-updated',
|
|
@@ -64,8 +41,6 @@ module.exports = {
|
|
|
64
41
|
CLI_MODE: {
|
|
65
42
|
EXTENSION: 'extension',
|
|
66
43
|
SELENIUM: 'selenium',
|
|
67
|
-
APPIUM: 'appium',
|
|
68
|
-
DEVICE_FARM_APPIUM: 'device-farm-appium',
|
|
69
44
|
},
|
|
70
45
|
sessionType: {
|
|
71
46
|
CODELESS: 'codeless',
|
package/commons/featureFlags.js
CHANGED
|
@@ -52,6 +52,8 @@ class FeatureFlagsService {
|
|
|
52
52
|
autoSaveDownloadFileFireFox: new Rox.Flag(true),
|
|
53
53
|
safariSelectOptionDispatchEventOnSelectElement: new Rox.Flag(true),
|
|
54
54
|
experimentalPreCodeCompilation: new Rox.Flag(false),
|
|
55
|
+
/** Enables using top level await inside custom actions for non-IE browsers */
|
|
56
|
+
experimentalAsyncCustomCode: new Rox.Flag(),
|
|
55
57
|
useSameBrowserForMultiTests: new LabFeatureFlag('labs'),
|
|
56
58
|
highSpeedMode: new LabFeatureFlag(),
|
|
57
59
|
usePortedHtml5DragDrop: new Rox.Flag(),
|
|
@@ -2,11 +2,9 @@ const testResultServiceSocketIO = require('./testResultServiceSocketIO');
|
|
|
2
2
|
const socketService = require('./socketService');
|
|
3
3
|
|
|
4
4
|
const { EventEmitter } = require('events');
|
|
5
|
-
|
|
6
|
-
const testimServicesApi = require('../testimServicesApi');
|
|
7
5
|
const featureFlags = require('../featureFlags');
|
|
8
6
|
|
|
9
|
-
const {socketEventTypes} = require('../constants');
|
|
7
|
+
const { socketEventTypes } = require('../constants');
|
|
10
8
|
const Promise = require('bluebird');
|
|
11
9
|
|
|
12
10
|
class TestResultService extends EventEmitter {
|
|
@@ -22,9 +20,9 @@ class TestResultService extends EventEmitter {
|
|
|
22
20
|
joinToTestResult(resultId, testId) {
|
|
23
21
|
//TODO - Consider unifying the joinToTestResult and listenToTestResult flows
|
|
24
22
|
if (featureFlags.flags.useNewWSCLI.isEnabled()) {
|
|
25
|
-
return socketService.addFilter(`${resultId}:testResult`, {resultId, testId}, [
|
|
23
|
+
return socketService.addFilter(`${resultId}:testResult`, { resultId, testId }, [
|
|
26
24
|
socketEventTypes.TEST_RESULT_UPDATED,
|
|
27
|
-
socketEventTypes.TEST_RESULT_CREATED
|
|
25
|
+
socketEventTypes.TEST_RESULT_CREATED,
|
|
28
26
|
]);
|
|
29
27
|
}
|
|
30
28
|
testResultServiceSocketIO.joinRoom(resultId, testId);
|
|
@@ -54,17 +52,9 @@ class TestResultService extends EventEmitter {
|
|
|
54
52
|
testResultServiceSocketIO.listenToTestResult(resultId, testId, onTestResultStatus);
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
clearTestResult(projectId, resultId, testId, testResult) {
|
|
58
|
-
return testimServicesApi.clearTestResult(projectId, resultId, testId, testResult);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
updateTestResult(projectId, resultId, testId, testResult, remoteRunId) {
|
|
62
|
-
return testimServicesApi.updateTestResult(projectId, resultId, testId, testResult, remoteRunId);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
55
|
getSocket() {
|
|
66
56
|
if (featureFlags.flags.useNewWSCLI.isEnabled()) {
|
|
67
|
-
return;
|
|
57
|
+
return undefined;
|
|
68
58
|
}
|
|
69
59
|
return testResultServiceSocketIO.getSocket();
|
|
70
60
|
}
|
|
@@ -5,7 +5,6 @@ const config = require('./config');
|
|
|
5
5
|
const Analytics = require('analytics-node');
|
|
6
6
|
|
|
7
7
|
const analytics = new Analytics('sJOSIGKa5x5rJEGsaOlCjrgozAf7FnVY', { flushAt: 1 });
|
|
8
|
-
const testimCustomToken = require('./testimCustomToken');
|
|
9
8
|
|
|
10
9
|
function identify(data) {
|
|
11
10
|
if (config.IS_ON_PREM) {
|
|
@@ -9,7 +9,6 @@ const featureFlags = require('./featureFlags');
|
|
|
9
9
|
const { CLI_MODE, mobileWeb, gridTypes } = require('./constants');
|
|
10
10
|
const config = require('./config');
|
|
11
11
|
const utils = require('../utils');
|
|
12
|
-
const { getAppCaps } = require('./apkUploader/apkUploaderFactory');
|
|
13
12
|
const LambdatestService = require('../services/lambdatestService');
|
|
14
13
|
const logger = require('./logger').getLogger('testim-desired-capabilities-builder');
|
|
15
14
|
|
|
@@ -577,99 +576,6 @@ function buildSeleniumOptions(browserOptions, testName, testRunConfig, gridInfo,
|
|
|
577
576
|
return opts;
|
|
578
577
|
}
|
|
579
578
|
|
|
580
|
-
function buildTestObject(browserOptions, testName, appCaps) {
|
|
581
|
-
if (!_.isEmpty(browserOptions.testobjectSauce)) {
|
|
582
|
-
return Object.assign({
|
|
583
|
-
idleTimeout: 30,
|
|
584
|
-
testobject_test_name: testName,
|
|
585
|
-
testobject_session_creation_timeout: String(browserOptions.browserTimeout),
|
|
586
|
-
deviceName: null,
|
|
587
|
-
}, appCaps, browserOptions.testobjectSauce);
|
|
588
|
-
}
|
|
589
|
-
return {};
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
function buildSaucelabsMobile(browserOptions, testName, appCaps) {
|
|
593
|
-
if (!_.isEmpty(browserOptions.saucelabs)) {
|
|
594
|
-
return Object.assign({
|
|
595
|
-
deviceName: null,
|
|
596
|
-
name: testName,
|
|
597
|
-
idleTimeout: 30,
|
|
598
|
-
browserName: '',
|
|
599
|
-
}, appCaps, browserOptions.saucelabs);
|
|
600
|
-
}
|
|
601
|
-
return {};
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
function buildAppiumOptions(browserOptions, gridInfo, nativeAppData, testName) {
|
|
605
|
-
const { getSessionTimeout, getSessionRetries, driverRequestTimeout, driverRequestRetries } = browserOptions;
|
|
606
|
-
const opts = {
|
|
607
|
-
host: gridInfo.host,
|
|
608
|
-
port: gridInfo.port || 4444,
|
|
609
|
-
path: gridInfo.path || '/wd/hub',
|
|
610
|
-
protocol: gridInfo.protocol || 'http',
|
|
611
|
-
logLevel: LOG_LEVEL,
|
|
612
|
-
connectionRetryTimeout: driverRequestTimeout,
|
|
613
|
-
connectionRetryCount: driverRequestRetries,
|
|
614
|
-
getSessionTimeout,
|
|
615
|
-
getSessionRetries,
|
|
616
|
-
desiredCapabilities: {
|
|
617
|
-
browserName: '',
|
|
618
|
-
noReset: false,
|
|
619
|
-
fullReset: false,
|
|
620
|
-
},
|
|
621
|
-
};
|
|
622
|
-
|
|
623
|
-
if (browserOptions.projectData.type === 'android') {
|
|
624
|
-
Object.assign(opts.desiredCapabilities, {
|
|
625
|
-
appPackage: nativeAppData.packageName,
|
|
626
|
-
appActivity: nativeAppData.activity,
|
|
627
|
-
platformName: 'Android',
|
|
628
|
-
automationName: 'uiautomator2',
|
|
629
|
-
autoLaunch: false,
|
|
630
|
-
ignoreUnimportantViews: false,
|
|
631
|
-
disableWindowAnimation: browserOptions.disableWindowAnimation,
|
|
632
|
-
});
|
|
633
|
-
} else if (browserOptions.projectData.type === 'ios') {
|
|
634
|
-
Object.assign(opts.desiredCapabilities, {
|
|
635
|
-
bundleId: nativeAppData.packageName,
|
|
636
|
-
platformName: 'iOS',
|
|
637
|
-
automationName: 'XCUITest',
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
if (browserOptions.deviceUdid) {
|
|
642
|
-
opts.desiredCapabilities.udid = browserOptions.deviceUdid;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
if (browserOptions.deviceName) {
|
|
646
|
-
opts.desiredCapabilities.deviceName = browserOptions.deviceName;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
if (gridInfo.user && gridInfo.key && gridInfo.type === 'saucelabs') {
|
|
650
|
-
browserOptions.saucelabs = browserOptions.saucelabs || {};
|
|
651
|
-
browserOptions.saucelabs.username = browserOptions.saucelabs.username || gridInfo.user;
|
|
652
|
-
browserOptions.saucelabs.accessKey = browserOptions.saucelabs.accessKey || gridInfo.key;
|
|
653
|
-
} else if (gridInfo.key && gridInfo.type === 'testobject') {
|
|
654
|
-
browserOptions.testobjectSauce = browserOptions.testobjectSauce || {};
|
|
655
|
-
browserOptions.testobjectSauce.testobjectApiKey = browserOptions.testobjectSauce.testobjectApiKey || gridInfo.key;
|
|
656
|
-
} else if (gridInfo.key && gridInfo.type === 'perfecto') {
|
|
657
|
-
browserOptions.perfecto = browserOptions.perfecto || {};
|
|
658
|
-
browserOptions.perfecto.securityToken = gridInfo.key;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
const appCaps = getAppCaps(gridInfo);
|
|
662
|
-
|
|
663
|
-
Object.assign(
|
|
664
|
-
opts.desiredCapabilities,
|
|
665
|
-
buildTestObject(browserOptions, testName, appCaps),
|
|
666
|
-
buildSaucelabsMobile(browserOptions, testName, appCaps)
|
|
667
|
-
);
|
|
668
|
-
|
|
669
|
-
return opts;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
579
|
module.exports = {
|
|
673
580
|
buildSeleniumOptions,
|
|
674
|
-
buildAppiumOptions,
|
|
675
581
|
};
|
|
@@ -55,11 +55,6 @@ function putAuth(url, body) {
|
|
|
55
55
|
.then(headers => httpRequest.put(`${config.SERVICES_HOST}${url || ''}`, body, headers));
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function getTextWithAuth(url, query) {
|
|
59
|
-
return getTokenHeader()
|
|
60
|
-
.then(headers => httpRequest.getText(`${config.SERVICES_HOST}${url || ''}`, query, headers));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
58
|
function getWithAuth(url, query, options, timeout) {
|
|
64
59
|
return getTokenHeader()
|
|
65
60
|
.then(headers => httpRequest.get(`${config.SERVICES_HOST}${url || ''}`, query, headers, timeout, options));
|
|
@@ -69,10 +64,6 @@ function getS3Artifact(url, timeout) {
|
|
|
69
64
|
return utils.runWithRetries(() => getWithAuth(`/storage${url}`, null, { isBinary: true }, timeout));
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
function getS3ArtifactText(url) {
|
|
73
|
-
return utils.runWithRetries(() => getTextWithAuth(`/storage${url}`));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
67
|
function getTestPlan(projectId, testPlanNames) {
|
|
77
68
|
//TODO: need to be checked after 3 months to prevent users from using old version
|
|
78
69
|
const parseProperty = (dataValue) => (dataValue == null ? [] : (typeof (dataValue) === 'string' && JSON.parse(dataValue)) || dataValue);
|
|
@@ -100,21 +91,15 @@ function saveTestPlanResult(projectId, testPlanId, result) {
|
|
|
100
91
|
return utils.runWithRetries(() => postAuth({ url: '/testPlan/result', body: { projectId, testPlanId, result } }));
|
|
101
92
|
}
|
|
102
93
|
|
|
103
|
-
function updateTestStatus(
|
|
94
|
+
function updateTestStatus(projectId, executionId, testId, resultId, status, data, apiRetries = DEFAULT_REQUEST_RETRY) {
|
|
104
95
|
return utils.runWithRetries(() => putAuth('/result/run/test', {
|
|
105
96
|
runId: executionId,
|
|
106
97
|
testId,
|
|
107
|
-
startTime,
|
|
108
|
-
endTime,
|
|
109
|
-
success,
|
|
110
|
-
failureReason,
|
|
111
98
|
resultId,
|
|
112
99
|
status,
|
|
113
|
-
config,
|
|
114
100
|
projectId,
|
|
115
101
|
runnerVersion,
|
|
116
|
-
|
|
117
|
-
testRetryKey,
|
|
102
|
+
...data,
|
|
118
103
|
}), apiRetries);
|
|
119
104
|
}
|
|
120
105
|
|
|
@@ -182,14 +167,6 @@ function reportExecutionFinished(status, executionId, projectId, success, tmsOpt
|
|
|
182
167
|
}), DEFAULT_REQUEST_RETRY);
|
|
183
168
|
}
|
|
184
169
|
|
|
185
|
-
function getBranchData(projectId, branchName) {
|
|
186
|
-
return utils.runWithRetries(() => getWithAuth(`/branch/branchData/${encodeURIComponent(branchName)}`, { projectId }));
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function getUserDetails(userId) {
|
|
190
|
-
return utils.runWithRetries(() => getWithAuth(`/user/user/${userId}`));
|
|
191
|
-
}
|
|
192
|
-
|
|
193
170
|
function getTestPlanTestList(projectId, names, planIds, branch) {
|
|
194
171
|
return utils.runWithRetries(() => postAuth({
|
|
195
172
|
url: '/testPlan/list',
|
|
@@ -243,11 +220,11 @@ function keepAliveGrid(projectId, slots) {
|
|
|
243
220
|
});
|
|
244
221
|
}
|
|
245
222
|
|
|
246
|
-
function releaseGridSlot(projectId, slotId, gridId, browser) {
|
|
223
|
+
function releaseGridSlot(companyId, projectId, slotId, gridId, browser) {
|
|
247
224
|
return postAuth({
|
|
248
225
|
url: `/grid/release?reqId=${utils.guid()}`,
|
|
249
226
|
body: {
|
|
250
|
-
projectId, slotId, gridId, browser,
|
|
227
|
+
companyId, projectId, slotId, gridId, browser,
|
|
251
228
|
},
|
|
252
229
|
});
|
|
253
230
|
}
|
|
@@ -259,23 +236,16 @@ function getHybridGridProvider(body) {
|
|
|
259
236
|
});
|
|
260
237
|
}
|
|
261
238
|
|
|
262
|
-
function
|
|
239
|
+
function getGridByName(companyId, projectId, gridName, browser, executionId) {
|
|
263
240
|
return utils.runWithRetries(() => getWithAuth('/grid/name', {
|
|
264
|
-
projectId, name: gridName, browser, executionId, reqId: utils.guid(),
|
|
241
|
+
companyId, projectId, name: gridName, browser, executionId, reqId: utils.guid(),
|
|
265
242
|
}));
|
|
266
243
|
}
|
|
267
244
|
|
|
268
|
-
function getGridById(projectId, gridId, browser, executionId) {
|
|
269
|
-
return utils.runWithRetries(() => getWithAuth(`/grid/${gridId}`, { projectId, browser, executionId, reqId: utils.guid() }));
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function getCompanyByProjectId(projectId) {
|
|
273
|
-
return utils.runWithRetries(() => getWithAuth(`/company/company/${projectId}`));
|
|
245
|
+
function getGridById(companyId, projectId, gridId, browser, executionId) {
|
|
246
|
+
return utils.runWithRetries(() => getWithAuth(`/grid/${gridId}`, { companyId, projectId, browser, executionId, reqId: utils.guid() }));
|
|
274
247
|
}
|
|
275
248
|
|
|
276
|
-
function getProject(projectId) {
|
|
277
|
-
return utils.runWithRetries(() => getWithAuth(`/v2/project/project?projectId=${projectId}`));
|
|
278
|
-
}
|
|
279
249
|
|
|
280
250
|
async function initializeUserWithAuth({ projectId, token, branchName, lightweightMode, localGrid }) {
|
|
281
251
|
try {
|
|
@@ -325,38 +295,6 @@ const fetchLambdatestConfig = async () => utils.runWithRetries(() => getWithAuth
|
|
|
325
295
|
|
|
326
296
|
const getLabFeaturesByProjectId = async (projectId) => utils.runWithRetries(() => getWithAuth(`/labFeature/v2/project/${projectId}`));
|
|
327
297
|
|
|
328
|
-
function getAppUploadUrl(projectId, projectArn, appName) {
|
|
329
|
-
return utils.runWithRetries(() => postAuth({
|
|
330
|
-
url: '/deviceFarm/app',
|
|
331
|
-
body: {
|
|
332
|
-
projectId,
|
|
333
|
-
projectArn,
|
|
334
|
-
appName,
|
|
335
|
-
},
|
|
336
|
-
}));
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
function createDeviceFarmRun(companyId, projectId, projectArn, appArn, configuration, branch, executionId, env, remoteRunObject) {
|
|
340
|
-
return postAuth({
|
|
341
|
-
url: '/deviceFarm/run',
|
|
342
|
-
body: {
|
|
343
|
-
companyId,
|
|
344
|
-
projectId,
|
|
345
|
-
projectArn,
|
|
346
|
-
appArn,
|
|
347
|
-
configuration,
|
|
348
|
-
branch,
|
|
349
|
-
executionId,
|
|
350
|
-
env,
|
|
351
|
-
remoteRunObject,
|
|
352
|
-
},
|
|
353
|
-
timeout: 30000,
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
function getDeviceFarmRun(projectId, runArn) {
|
|
358
|
-
return getWithAuth(`/deviceFarm/run?projectId=${projectId}&runArn=${runArn}`);
|
|
359
|
-
}
|
|
360
298
|
|
|
361
299
|
function getRealData(projectId, channel, query) {
|
|
362
300
|
return utils.runWithRetries(() => getWithAuth(`/real-data/${channel}?${query}&projectId=${projectId}`));
|
|
@@ -492,30 +430,22 @@ function addTestRetry({
|
|
|
492
430
|
|
|
493
431
|
module.exports = {
|
|
494
432
|
getS3Artifact,
|
|
495
|
-
getS3ArtifactText,
|
|
496
433
|
getTestPlan,
|
|
497
434
|
saveTestPlanResult,
|
|
498
435
|
updateTestStatus,
|
|
499
436
|
updateExecutionTests,
|
|
500
437
|
reportExecutionStarted,
|
|
501
438
|
reportExecutionFinished,
|
|
502
|
-
getBranchData,
|
|
503
|
-
getUserDetails,
|
|
504
439
|
getTestPlanTestList,
|
|
505
440
|
getSuiteTestList,
|
|
506
|
-
getCompanyByProjectId,
|
|
507
|
-
getProject,
|
|
508
441
|
getUsageForCurrentBillingPeriod,
|
|
509
442
|
getTestResults,
|
|
510
|
-
|
|
443
|
+
getGridByName,
|
|
511
444
|
releaseGridSlot,
|
|
512
445
|
keepAliveGrid,
|
|
513
446
|
getGridById,
|
|
514
447
|
getAllGrids,
|
|
515
448
|
fetchLambdatestConfig,
|
|
516
|
-
getAppUploadUrl,
|
|
517
|
-
createDeviceFarmRun,
|
|
518
|
-
getDeviceFarmRun,
|
|
519
449
|
getRealData,
|
|
520
450
|
updateTestResult,
|
|
521
451
|
clearTestResult,
|
package/executionQueue.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
3
|
const TestRun = require('./testRunHandler.js');
|
|
4
4
|
|
|
5
5
|
class ExecutionQueue {
|
|
6
6
|
constructor(executionId, testList, options, branchToUse, testStatus) {
|
|
7
|
-
this._waitingTests = testList.map(testInfo =>
|
|
8
|
-
return new TestRun(executionId, testInfo, options, branchToUse, testStatus);
|
|
9
|
-
});
|
|
7
|
+
this._waitingTests = testList.map(testInfo => new TestRun(executionId, testInfo, options, branchToUse, testStatus));
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
getNext() {
|
|
@@ -14,6 +12,11 @@ class ExecutionQueue {
|
|
|
14
12
|
if (nextTestRunHandler) {
|
|
15
13
|
return nextTestRunHandler;
|
|
16
14
|
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
hasMoreTests() {
|
|
19
|
+
return Boolean(this._waitingTests.length);
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
|