@testim/testim-cli 3.267.0 → 3.268.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/commons/socket/baseSocketServiceSocketIO.js +25 -2
- package/commons/socket/testResultService.js +0 -1
- package/commons/testimDesiredCapabilitiesBuilder.js +14 -7
- package/commons/testimServicesApi.js +31 -5
- package/npm-shrinkwrap.json +38 -38
- package/package.json +1 -1
- package/reports/consoleReporter.js +6 -2
- package/runOptions.d.ts +4 -3
- package/runOptions.js +3 -2
- package/runner.js +1 -1
- package/testRunHandler.js +216 -235
- package/testimNpmDriver.js +15 -18
- package/workers/BaseWorker.js +22 -22
- package/workers/BaseWorker.test.js +1 -6
- package/workers/WorkerAppium.js +64 -19
- package/workers/WorkerExtension.js +11 -5
- package/workers/WorkerExtensionSingleBrowser.js +7 -2
- package/workers/WorkerSelenium.js +14 -14
package/testimNpmDriver.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
const Promise = require('bluebird');
|
|
3
2
|
const semver = require('semver');
|
|
4
3
|
const config = require('./commons/config');
|
|
5
4
|
const fs = require('fs');
|
|
@@ -7,10 +6,9 @@ const logger = require('./commons/logger').getLogger('npm-driver');
|
|
|
7
6
|
const localRunnerCache = require('./commons/runnerFileCache');
|
|
8
7
|
const npmWrapper = require('./commons/npmWrapper');
|
|
9
8
|
const chalk = require('chalk');
|
|
9
|
+
const utils = require('./utils');
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
return Promise.resolve(npmWrapper.getLatestPackageVersion(packName));
|
|
13
|
-
}
|
|
11
|
+
const getNpmVersion = localRunnerCache.memoize(() => npmWrapper.getLatestPackageVersion('@testim/testim-cli'), 'getNpmVersion');
|
|
14
12
|
|
|
15
13
|
function getPackageVersion() {
|
|
16
14
|
try {
|
|
@@ -29,22 +27,21 @@ function getPackageVersion() {
|
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
function checkNpmVersion() {
|
|
30
|
+
async function checkNpmVersion() {
|
|
33
31
|
if (config.IS_ON_PREM) {
|
|
34
|
-
return
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const latestVersion = await utils.promiseTimeout(getNpmVersion('@testim/testim-cli'), 5000, 'The API call to NPM timed out');
|
|
36
|
+
const packVersion = getPackageVersion();
|
|
37
|
+
if (packVersion && semver.lt(packVersion, latestVersion)) {
|
|
38
|
+
console.log(chalk.yellow(
|
|
39
|
+
`Warning: You are using version ${packVersion}, a newer version is available. To update please run npm install (npm install -g @testim/testim-cli)`)
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
} catch (err) {
|
|
43
|
+
logger.warn('Failed to get NPM version', { err });
|
|
35
44
|
}
|
|
36
|
-
return localRunnerCache.memoize(() => getNpmVersion('@testim/testim-cli')
|
|
37
|
-
.timeout(5000, 'The API call to NPM timed out')
|
|
38
|
-
.then(latestVersion => {
|
|
39
|
-
const packVersion = getPackageVersion();
|
|
40
|
-
if (packVersion && semver.lt(packVersion, latestVersion)) {
|
|
41
|
-
console.log(chalk.yellow(
|
|
42
|
-
`Warning: You are using version ${packVersion}, a newer version is available. To update please run npm install (npm install -g @testim/testim-cli)`)
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
.catch(err => logger.warn('Failed to get NPM version', { err }))
|
|
47
|
-
.then(() => true), 'checkNpmVersion');
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
module.exports = {
|
package/workers/BaseWorker.js
CHANGED
|
@@ -86,8 +86,8 @@ class BaseWorker {
|
|
|
86
86
|
* @param {import('../testRunHandler')} testRunHandler
|
|
87
87
|
*/
|
|
88
88
|
async getGridSlot(browser, testRunHandler) {
|
|
89
|
-
const slot = await gridService.getGridSlot(browser, testRunHandler.
|
|
90
|
-
this.onGridSlot(testRunHandler.
|
|
89
|
+
const slot = await gridService.getGridSlot(browser, testRunHandler.executionId, this.options, this.id);
|
|
90
|
+
this.onGridSlot(testRunHandler.testResultId, slot);
|
|
91
91
|
return slot;
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -116,10 +116,10 @@ class BaseWorker {
|
|
|
116
116
|
* @param {ReturnType<typeof this['initPlayer']>} player
|
|
117
117
|
*/
|
|
118
118
|
async runTestOnce(testRunHandler, player) {
|
|
119
|
-
testRunHandler.
|
|
119
|
+
testRunHandler.sessionId = player.getSessionId();
|
|
120
120
|
logger.info('Test run started', {
|
|
121
|
-
testId: testRunHandler.
|
|
122
|
-
resultId: testRunHandler.
|
|
121
|
+
testId: testRunHandler.testId,
|
|
122
|
+
resultId: testRunHandler.testResultId,
|
|
123
123
|
seleniumSession: player.getSessionId(),
|
|
124
124
|
});
|
|
125
125
|
|
|
@@ -128,15 +128,15 @@ class BaseWorker {
|
|
|
128
128
|
|
|
129
129
|
/** @param {import('../testRunHandler')} testRunHandler */
|
|
130
130
|
handleQuarantine(testRunHandler) {
|
|
131
|
-
if (!utils.isQuarantineAndNotRemoteRun({ testStatus: testRunHandler.
|
|
131
|
+
if (!utils.isQuarantineAndNotRemoteRun({ testStatus: testRunHandler.testStatus }, this.options)) {
|
|
132
132
|
return undefined;
|
|
133
133
|
}
|
|
134
134
|
const testResult = {
|
|
135
|
-
name: testRunHandler.
|
|
136
|
-
testId: testRunHandler.
|
|
137
|
-
resultId: testRunHandler.
|
|
135
|
+
name: testRunHandler.testName,
|
|
136
|
+
testId: testRunHandler.testId,
|
|
137
|
+
resultId: testRunHandler.testResultId,
|
|
138
138
|
runnerStatus: runnerTestStatus.SKIPPED,
|
|
139
|
-
testStatus: testRunHandler.
|
|
139
|
+
testStatus: testRunHandler.testStatus,
|
|
140
140
|
};
|
|
141
141
|
this.onTestIgnored(this.id, testResult);
|
|
142
142
|
return testResult;
|
|
@@ -242,7 +242,7 @@ class BaseWorker {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
perf.log('before runTest onTestStarted');
|
|
245
|
-
const test = await this.onTestStarted(this.id, testRunHandler.
|
|
245
|
+
const test = await this.onTestStarted(this.id, testRunHandler.testId, testRunHandler.testResultId, shouldRerun, testRunHandler.retryKey);
|
|
246
246
|
testRunHandler._baseUrl = test.config.baseUrl;
|
|
247
247
|
|
|
248
248
|
const testPlayer = await this.getTestPlayer(testRunHandler, customExtensionLocalLocation);
|
|
@@ -273,7 +273,7 @@ class BaseWorker {
|
|
|
273
273
|
if (utils.isQuarantineAndNotRemoteRun(testResult, this.options)) {
|
|
274
274
|
return runNextTest();
|
|
275
275
|
}
|
|
276
|
-
const sessionId = testRunHandler.
|
|
276
|
+
const sessionId = testRunHandler.sessionId;
|
|
277
277
|
|
|
278
278
|
const isTimeoutError = (timeoutMsg) => err.message.includes(timeoutMsg);
|
|
279
279
|
const isIgnoreErrors = err && (err instanceof GetBrowserError);
|
|
@@ -287,7 +287,7 @@ class BaseWorker {
|
|
|
287
287
|
);
|
|
288
288
|
|
|
289
289
|
try {
|
|
290
|
-
const testRetryKey = testRunHandler.
|
|
290
|
+
const testRetryKey = testRunHandler.retryKey;
|
|
291
291
|
testResult.testRetryKey = testRetryKey;
|
|
292
292
|
await this.onTestCompleted(this.id, this.testId, testResult, sessionId, shouldRerun);
|
|
293
293
|
if (this.executionQueue.hasMoreTests() && !this.options.lightweightMode?.general) {
|
|
@@ -307,7 +307,7 @@ class BaseWorker {
|
|
|
307
307
|
testRetryKey,
|
|
308
308
|
totalRetries: testRunHandler._totalRetryCount,
|
|
309
309
|
});
|
|
310
|
-
this.testResultId = testRunHandler.
|
|
310
|
+
this.testResultId = testRunHandler.testResultId;
|
|
311
311
|
return await runTestAndCalcResult(testRunHandler, shouldRerun);
|
|
312
312
|
}
|
|
313
313
|
return await runNextTest();
|
|
@@ -404,9 +404,9 @@ class BaseWorker {
|
|
|
404
404
|
success: false,
|
|
405
405
|
reason,
|
|
406
406
|
errorType,
|
|
407
|
-
testRetryKey: testRunHandler.
|
|
407
|
+
testRetryKey: testRunHandler.retryKey,
|
|
408
408
|
setupStepResult: { status: testRunStatus.COMPLETED, success: false, reason, errorType },
|
|
409
|
-
}, testRunHandler.
|
|
409
|
+
}, testRunHandler.remoteRunId);
|
|
410
410
|
await onRunComplete(buildFailureResult(this.testId, this.testName, this.testResultId, reason), testRunHandler, err);
|
|
411
411
|
};
|
|
412
412
|
|
|
@@ -478,12 +478,12 @@ class BaseWorker {
|
|
|
478
478
|
if (!testRunHandler) { // no more tests to run
|
|
479
479
|
return this.onQueueCompleted();
|
|
480
480
|
}
|
|
481
|
-
this.testId = testRunHandler.
|
|
482
|
-
this.testName = testRunHandler.
|
|
483
|
-
this.testResultId = testRunHandler.
|
|
484
|
-
this.overrideTestConfigId = testRunHandler.
|
|
485
|
-
this.testRunConfig = testRunHandler.
|
|
486
|
-
this.branch = testRunHandler.
|
|
481
|
+
this.testId = testRunHandler.testId;
|
|
482
|
+
this.testName = testRunHandler.testName;
|
|
483
|
+
this.testResultId = testRunHandler.testResultId;
|
|
484
|
+
this.overrideTestConfigId = testRunHandler.overrideTestConfigId;
|
|
485
|
+
this.testRunConfig = testRunHandler.runConfig;
|
|
486
|
+
this.branch = testRunHandler.branch;
|
|
487
487
|
|
|
488
488
|
return runTestAndCalcResult(testRunHandler);
|
|
489
489
|
}
|
|
@@ -30,7 +30,7 @@ describe('BaseWorker', () => {
|
|
|
30
30
|
worker.options = { gridData: {}, browser: 'chrome', company: { companyId: 'companyId' }, getBrowserTimeout: 1000, getSessionTimeout: 100, getBrowserRetries: 10 };
|
|
31
31
|
worker.testRunConfig = {};
|
|
32
32
|
|
|
33
|
-
testRunHandlerMock = {
|
|
33
|
+
testRunHandlerMock = { executionId: 'executionId', testResultId: 'testResultId' };
|
|
34
34
|
testPlayerMock = { onDone: sinon.spy() };
|
|
35
35
|
|
|
36
36
|
sinon.stub(worker, 'initPlayer').returns(testPlayerMock);
|
|
@@ -170,11 +170,6 @@ describe('BaseWorker', () => {
|
|
|
170
170
|
it('should call the runTestOnc with the base url of the test object we acquired from onTestStarted', async () => {
|
|
171
171
|
const testRunHandler = {
|
|
172
172
|
_baseUrl: 'https://testim.io',
|
|
173
|
-
getTestStatus: () => sinon.stub().returns(42),
|
|
174
|
-
getTestId: () => sinon.stub().returns(42),
|
|
175
|
-
getTestResultId: () => sinon.stub().returns(42),
|
|
176
|
-
getRetryKey: () => sinon.stub().returns(42),
|
|
177
|
-
getExecutionId: () => sinon.stub().returns(42),
|
|
178
173
|
testRunHandler: () => sinon.stub().returns(42),
|
|
179
174
|
clearTestResult: () => sinon.stub().returns(42),
|
|
180
175
|
};
|
package/workers/WorkerAppium.js
CHANGED
|
@@ -8,28 +8,46 @@ const AppiumTestPlayer = require('../player/appiumTestPlayer');
|
|
|
8
8
|
const sessionPlayerInit = require('../commons/getSessionPlayerRequire');
|
|
9
9
|
const AppiumApi = require('../commons/getSessionPlayerRequire').AppiumApi;
|
|
10
10
|
const desiredCapabilitiesBuilder = require('../commons/testimDesiredCapabilitiesBuilder');
|
|
11
|
+
const testimServicesApi = require('../commons/testimServicesApi');
|
|
12
|
+
const config = require('../commons/config');
|
|
11
13
|
|
|
12
14
|
class WorkerAppium extends BaseWorker {
|
|
15
|
+
/**
|
|
16
|
+
* @override
|
|
17
|
+
* @param {import('../testRunHandler')} testRunHandler
|
|
18
|
+
*/
|
|
13
19
|
initPlayer(testRunHandler) {
|
|
14
|
-
return new AppiumTestPlayer(
|
|
15
|
-
|
|
20
|
+
return new AppiumTestPlayer(
|
|
21
|
+
this.id,
|
|
22
|
+
testRunHandler.runParams,
|
|
16
23
|
this.options.shouldMonitorPerformance,
|
|
17
|
-
testRunHandler.
|
|
24
|
+
testRunHandler.automationMode,
|
|
18
25
|
undefined,
|
|
19
|
-
testRunHandler.
|
|
20
|
-
testRunHandler.
|
|
26
|
+
testRunHandler.retryCount,
|
|
27
|
+
testRunHandler.previousTestResultId,
|
|
28
|
+
);
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
async getBrowserOnce(testRunHandler, customExtensionLocalLocation, appiumTestPlayer, gridInfo) {
|
|
24
|
-
reporter.onGetSession(this.id, this.testName, testRunHandler.
|
|
32
|
+
reporter.onGetSession(this.id, this.testName, testRunHandler.runMode);
|
|
25
33
|
const { driver } = appiumTestPlayer;
|
|
26
|
-
|
|
34
|
+
let appPath = null;
|
|
35
|
+
if (this.options.appId) {
|
|
36
|
+
const { project: projectId, appId } = this.options;
|
|
37
|
+
const mobileApp = await testimServicesApi.getAppDetails({ appId, projectId });
|
|
38
|
+
if (!mobileApp) {
|
|
39
|
+
logger.error('mobile app not found', { appId, projectId });
|
|
40
|
+
throw new Error('mobile app not found');
|
|
41
|
+
}
|
|
42
|
+
appPath = `${config.SERVICES_HOST}/storage${mobileApp.filePath}?access_token=${this.options.authData.token}`;
|
|
43
|
+
}
|
|
44
|
+
const nativeApp = await testRunHandler.getNativeAppData();
|
|
27
45
|
const projectType = this.options.projectData.type;
|
|
28
|
-
const capabilities = desiredCapabilitiesBuilder.buildAppiumOptions({ projectType, gridInfo, testRunConfig: this.testRunConfig, nativeApp, options: this.options });
|
|
29
46
|
try {
|
|
30
|
-
|
|
47
|
+
const capabilities = desiredCapabilitiesBuilder.buildAppiumOptions({ projectType, gridInfo, testRunConfig: this.testRunConfig, nativeApp, options: this.options, appPath });
|
|
31
48
|
const activeSession = await driver.remote(capabilities);
|
|
32
49
|
driver.activeSession = activeSession;
|
|
50
|
+
await this.updateDeviceInfo(testRunHandler, activeSession);
|
|
33
51
|
logger.info(`init new appium session testName: ${this.testName}`, { sessionId: activeSession.sessionId, testResultId: this.testResultId, nativeApp });
|
|
34
52
|
} catch (err) {
|
|
35
53
|
//TODO: catch app status validation
|
|
@@ -39,10 +57,34 @@ class WorkerAppium extends BaseWorker {
|
|
|
39
57
|
}
|
|
40
58
|
|
|
41
59
|
getServerAddressFromGrid(testRunHandler) {
|
|
42
|
-
const {
|
|
60
|
+
const { host, port, accessToken } = testRunHandler._options.gridData;
|
|
43
61
|
return `https://${host}:${port}/v0/${accessToken}/wd/hub`;
|
|
44
62
|
}
|
|
45
63
|
|
|
64
|
+
async updateDeviceInfo(testRunHandler, activeSession) {
|
|
65
|
+
const {
|
|
66
|
+
_executionId, _testId, _testResultId,
|
|
67
|
+
_options: { project: projectId },
|
|
68
|
+
} = testRunHandler;
|
|
69
|
+
const device = {
|
|
70
|
+
name: activeSession.capabilities.deviceName,
|
|
71
|
+
model: activeSession.capabilities.deviceModel,
|
|
72
|
+
osVersion: activeSession.capabilities.platformVersion,
|
|
73
|
+
udid: activeSession.capabilities.udid,
|
|
74
|
+
osType: activeSession.capabilities.platformName,
|
|
75
|
+
scaleFactor: activeSession.capabilities.pixelRatio,
|
|
76
|
+
virtual: false,
|
|
77
|
+
};
|
|
78
|
+
await testimServicesApi.updateTestStatus(
|
|
79
|
+
projectId,
|
|
80
|
+
_executionId,
|
|
81
|
+
_testId,
|
|
82
|
+
_testResultId,
|
|
83
|
+
'RUNNING',
|
|
84
|
+
{ device },
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
46
88
|
getDirectAddressConnection(activeSessionCapabilities) {
|
|
47
89
|
const { directConnectProtocol: protocol, directConnectHost: host, directConnectPort: port, directConnectPath: path } = activeSessionCapabilities;
|
|
48
90
|
if (protocol && host && port && path) {
|
|
@@ -51,27 +93,29 @@ class WorkerAppium extends BaseWorker {
|
|
|
51
93
|
return undefined;
|
|
52
94
|
}
|
|
53
95
|
|
|
96
|
+
/**
|
|
97
|
+
* @param {import('../testRunHandler')} testRunHandler
|
|
98
|
+
* @param {import('../player/appiumTestPlayer')} appiumTestPlayer
|
|
99
|
+
*/
|
|
54
100
|
async runTestOnce(testRunHandler, appiumTestPlayer) {
|
|
55
101
|
const { driver, sessionPlayer } = appiumTestPlayer;
|
|
56
102
|
const version = sessionPlayerInit.manifestVersion || 'runner';
|
|
57
103
|
|
|
58
104
|
reporter.onWaitToTestComplete(this.id, this.isCodeMode);
|
|
59
105
|
|
|
60
|
-
sessionPlayer.playbackManager.executionId = testRunHandler.
|
|
61
|
-
sessionPlayer.playbackManager.executionName = testRunHandler.
|
|
106
|
+
sessionPlayer.playbackManager.executionId = testRunHandler.executionId;
|
|
107
|
+
sessionPlayer.playbackManager.executionName = testRunHandler.executionName;
|
|
62
108
|
|
|
63
109
|
const serverAddress = this.getDirectAddressConnection(driver.activeSession.capabilities) || this.getServerAddressFromGrid(testRunHandler);
|
|
64
|
-
const DOMParser = new
|
|
110
|
+
const DOMParser = new jsdom.JSDOM('').window.DOMParser;
|
|
65
111
|
sessionPlayer.playbackManager.appiumApi = new AppiumApi(serverAddress, driver.activeSession.sessionId, DOMParser);
|
|
66
|
-
|
|
67
|
-
|
|
68
112
|
if (sessionPlayerInit.localAssetService) {
|
|
69
113
|
sessionPlayerInit.localAssetService.initialize({ serverUrl: this.options.localRCASaver });
|
|
70
114
|
}
|
|
71
115
|
async function runAppiumTest() {
|
|
72
116
|
try {
|
|
73
117
|
const INCOGNITO = false;
|
|
74
|
-
const testResult = await
|
|
118
|
+
const testResult = await new Promise((resolve, reject) =>
|
|
75
119
|
// eslint-disable-next-line no-promise-executor-return
|
|
76
120
|
sessionPlayer.playByTestId(
|
|
77
121
|
this.testId,
|
|
@@ -85,11 +129,12 @@ class WorkerAppium extends BaseWorker {
|
|
|
85
129
|
this.overrideTestConfigId,
|
|
86
130
|
this.branch,
|
|
87
131
|
INCOGNITO,
|
|
88
|
-
testRunHandler.
|
|
89
|
-
undefined,
|
|
132
|
+
testRunHandler.remoteRunId,
|
|
90
133
|
undefined,
|
|
91
134
|
undefined,
|
|
92
|
-
|
|
135
|
+
undefined
|
|
136
|
+
)
|
|
137
|
+
);
|
|
93
138
|
if (sessionPlayerInit.localAssetService) {
|
|
94
139
|
await sessionPlayerInit.localAssetService.drain();
|
|
95
140
|
}
|
|
@@ -21,6 +21,12 @@ class WorkerExtension extends BaseWorker {
|
|
|
21
21
|
return new ExtensionTestPlayer(this.id);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @param {import('../testRunHandler')} testRunHandler
|
|
26
|
+
* @param {string=} customExtensionLocalLocation
|
|
27
|
+
* @param {import('../player/extensionTestPlayer')} player
|
|
28
|
+
* @param {Awaited<ReturnType<import('../services/gridService')['getGridSlot']>>} gridInfo
|
|
29
|
+
*/
|
|
24
30
|
async _getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo) {
|
|
25
31
|
const { driver } = player;
|
|
26
32
|
try {
|
|
@@ -40,8 +46,8 @@ class WorkerExtension extends BaseWorker {
|
|
|
40
46
|
logger.error('failed to get browser', {
|
|
41
47
|
err,
|
|
42
48
|
gridInfo,
|
|
43
|
-
testId: testRunHandler.
|
|
44
|
-
resultId: testRunHandler.
|
|
49
|
+
testId: testRunHandler.testId,
|
|
50
|
+
resultId: testRunHandler.testResultId,
|
|
45
51
|
});
|
|
46
52
|
throw err;
|
|
47
53
|
}
|
|
@@ -49,7 +55,7 @@ class WorkerExtension extends BaseWorker {
|
|
|
49
55
|
|
|
50
56
|
/** @override */
|
|
51
57
|
async getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo) {
|
|
52
|
-
reporter.onGetSession(this.id, this.testName, testRunHandler.
|
|
58
|
+
reporter.onGetSession(this.id, this.testName, testRunHandler.runMode);
|
|
53
59
|
return this._getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo);
|
|
54
60
|
}
|
|
55
61
|
|
|
@@ -175,8 +181,8 @@ class WorkerExtension extends BaseWorker {
|
|
|
175
181
|
} catch (err) {
|
|
176
182
|
logger.error('failed to run test', {
|
|
177
183
|
err,
|
|
178
|
-
testId: testRunHandler.
|
|
179
|
-
resultId: testRunHandler.
|
|
184
|
+
testId: testRunHandler.testId,
|
|
185
|
+
resultId: testRunHandler.testResultId,
|
|
180
186
|
});
|
|
181
187
|
throw err;
|
|
182
188
|
}
|
|
@@ -23,7 +23,7 @@ class WorkerExtensionSingleBrowser extends WorkerExtension {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo) {
|
|
26
|
-
reporter.onGetSession(this.id, `worker ${this.id}`, testRunHandler.
|
|
26
|
+
reporter.onGetSession(this.id, `worker ${this.id}`, testRunHandler.runMode);
|
|
27
27
|
return this._getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -43,6 +43,11 @@ class WorkerExtensionSingleBrowser extends WorkerExtension {
|
|
|
43
43
|
return this.testPlayer;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @param {import('../testRunHandler')} testRunHandler
|
|
48
|
+
* @param {string=} customExtensionLocalLocation
|
|
49
|
+
* @param {boolean=} shouldRerun
|
|
50
|
+
*/
|
|
46
51
|
async runTest(testRunHandler, customExtensionLocalLocation, shouldRerun) {
|
|
47
52
|
const quarantineResult = this.handleQuarantine(testRunHandler);
|
|
48
53
|
if (quarantineResult) {
|
|
@@ -50,7 +55,7 @@ class WorkerExtensionSingleBrowser extends WorkerExtension {
|
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
perf.log('before runTest onTestStarted single browser');
|
|
53
|
-
const test = await this.onTestStarted(this.id, testRunHandler.
|
|
58
|
+
const test = await this.onTestStarted(this.id, testRunHandler.testId, testRunHandler.testResultId, shouldRerun, testRunHandler.retryKey);
|
|
54
59
|
testRunHandler._baseUrl = test.config.baseUrl;
|
|
55
60
|
const testPlayer = await this.getTestPlayer(testRunHandler, customExtensionLocalLocation);
|
|
56
61
|
|
|
@@ -24,12 +24,12 @@ class WorkerSelenium extends BaseWorker {
|
|
|
24
24
|
initPlayer(testRunHandler) {
|
|
25
25
|
return new SeleniumTestPlayer(
|
|
26
26
|
this.id,
|
|
27
|
-
testRunHandler.
|
|
27
|
+
testRunHandler.runParams,
|
|
28
28
|
this.options.shouldMonitorPerformance,
|
|
29
|
-
testRunHandler.
|
|
29
|
+
testRunHandler.automationMode,
|
|
30
30
|
undefined,
|
|
31
|
-
testRunHandler.
|
|
32
|
-
testRunHandler.
|
|
31
|
+
testRunHandler.retryCount,
|
|
32
|
+
testRunHandler.previousTestResultId,
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -42,14 +42,14 @@ class WorkerSelenium extends BaseWorker {
|
|
|
42
42
|
*/
|
|
43
43
|
async getBrowserOnce(testRunHandler, customExtensionLocalLocation, seleniumTestPlayer, gridInfo) {
|
|
44
44
|
perf.log('in WorkerSelenium getBrowserOnce');
|
|
45
|
-
reporter.onGetSession(this.id, this.testName, testRunHandler.
|
|
45
|
+
reporter.onGetSession(this.id, this.testName, testRunHandler.runMode);
|
|
46
46
|
const { driver } = seleniumTestPlayer;
|
|
47
47
|
|
|
48
48
|
this.windowUtils = new WindowUtils(this.id, driver);
|
|
49
49
|
seleniumTestPlayer.clearSessionTabs();
|
|
50
50
|
|
|
51
51
|
const { browserValue } = this.testRunConfig;
|
|
52
|
-
const baseUrl = testRunHandler.
|
|
52
|
+
const baseUrl = testRunHandler.baseUrl;
|
|
53
53
|
|
|
54
54
|
try {
|
|
55
55
|
const fastInit = this.options.useLocalChromeDriver;
|
|
@@ -101,12 +101,12 @@ class WorkerSelenium extends BaseWorker {
|
|
|
101
101
|
|
|
102
102
|
setupCliPerformanceMonitoring(sessionPlayer);
|
|
103
103
|
|
|
104
|
-
sessionPlayer.playbackManager.executionId = testRunHandler.
|
|
105
|
-
sessionPlayer.playbackManager.executionName = testRunHandler.
|
|
104
|
+
sessionPlayer.playbackManager.executionId = testRunHandler.executionId;
|
|
105
|
+
sessionPlayer.playbackManager.executionName = testRunHandler.executionName;
|
|
106
106
|
|
|
107
107
|
sessionPlayer.setLightweightMode(this.options.lightweightMode);
|
|
108
|
-
if (testRunHandler.
|
|
109
|
-
sessionPlayer.setSfdcCredential(testRunHandler.
|
|
108
|
+
if (testRunHandler.sfdcCredential) {
|
|
109
|
+
sessionPlayer.setSfdcCredential(testRunHandler.sfdcCredential);
|
|
110
110
|
}
|
|
111
111
|
if (sessionPlayerInit.localAssetService) {
|
|
112
112
|
sessionPlayerInit.localAssetService.initialize({ serverUrl: this.options.localRCASaver });
|
|
@@ -119,7 +119,7 @@ class WorkerSelenium extends BaseWorker {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
async function runSeleniumTest() {
|
|
122
|
-
if (testRunHandler.
|
|
122
|
+
if (testRunHandler.automationMode === 'codeful') {
|
|
123
123
|
// Testim Development Kit test;
|
|
124
124
|
if (!sessionPlayer.callOrderScheduler) { // old session player
|
|
125
125
|
await testRunHandler.waitForExecutionStartedFinished();
|
|
@@ -142,8 +142,8 @@ class WorkerSelenium extends BaseWorker {
|
|
|
142
142
|
false,
|
|
143
143
|
this.overrideTestConfigId,
|
|
144
144
|
this.branch,
|
|
145
|
-
testRunHandler.
|
|
146
|
-
testRunHandler.
|
|
145
|
+
testRunHandler.code,
|
|
146
|
+
testRunHandler.testName
|
|
147
147
|
).catch(reject))
|
|
148
148
|
.log('right after playTestByCode')
|
|
149
149
|
.timeout(this.testRunTimeout, timeoutMessages.TEST_COMPLETE_TIMEOUT_MSG)
|
|
@@ -173,7 +173,7 @@ class WorkerSelenium extends BaseWorker {
|
|
|
173
173
|
this.overrideTestConfigId,
|
|
174
174
|
this.branch,
|
|
175
175
|
INCOGNITO,
|
|
176
|
-
testRunHandler.
|
|
176
|
+
testRunHandler.remoteRunId,
|
|
177
177
|
undefined,
|
|
178
178
|
undefined,
|
|
179
179
|
preloadedTest
|