@testim/testim-cli 3.225.0 → 3.228.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/codim/codim-npm-package/package.json +1 -1
- package/codim/template.js/package.json +1 -1
- package/codim/template.ts/package.json +2 -2
- package/commons/testimDesiredCapabilitiesBuilder.js +1 -0
- package/npm-shrinkwrap.json +1111 -1587
- package/package.json +22 -22
- package/services/gridService.js +1 -19
- package/testRunHandler.js +491 -486
- package/testRunStatus.js +5 -3
- package/workers/BaseWorker.js +7 -7
- package/workers/BaseWorker.test.js +37 -3
- package/workers/WorkerExtensionSingleBrowser.js +2 -1
package/testRunStatus.js
CHANGED
|
@@ -63,7 +63,7 @@ const RunStatus = function (testInfoList, options, testPlanId, branchToUse) {
|
|
|
63
63
|
testPlanId,
|
|
64
64
|
testPlans: options.testPlan,
|
|
65
65
|
testLabels: options.label,
|
|
66
|
-
testSuites: _.uniq(
|
|
66
|
+
testSuites: _.uniq(testInfoList.flatMap(test => test.testSuites)),
|
|
67
67
|
testNames: options.name,
|
|
68
68
|
testIds: options.testId,
|
|
69
69
|
testConfigs: options.testConfigNames,
|
|
@@ -173,10 +173,12 @@ RunStatus.prototype.testStartReport = function (test, executionId, testRetryKey)
|
|
|
173
173
|
return Promise.resolve();
|
|
174
174
|
}
|
|
175
175
|
return runHook(this.options.beforeTest, Object.assign({}, test, { exportsGlobal: this.exportsGlobal }), this.options.userData.loginData.token)
|
|
176
|
-
.then(params => {
|
|
176
|
+
.then(async params => {
|
|
177
177
|
this.options.runParams[test.resultId] = test.config.testData = Object.assign({}, test.config.testData, this.exportsGlobal, this.fileUserParamsData, this.beforeSuiteParams, params);
|
|
178
178
|
test.startTime = Date.now();
|
|
179
|
-
|
|
179
|
+
await this.updateTestStatusRunning(test, executionId, testRetryKey);
|
|
180
|
+
|
|
181
|
+
return test;
|
|
180
182
|
}).catch(err => {
|
|
181
183
|
logger.error('Failed to start test', { err });
|
|
182
184
|
throw err;
|
package/workers/BaseWorker.js
CHANGED
|
@@ -141,8 +141,7 @@ class BaseWorker {
|
|
|
141
141
|
const player = this.initPlayer(testRunHandler);
|
|
142
142
|
try {
|
|
143
143
|
gridInfo = await gridService.handleHybridOrVendorIfNeeded(
|
|
144
|
-
this.options, gridInfo, this.testRunConfig, this.lambdatestService,
|
|
145
|
-
{ maxRetries: getBrowserRetriesNumber, currentRetry: failedGetBrowserAttempts + 1 },
|
|
144
|
+
this.options, gridInfo, this.testRunConfig, this.lambdatestService, { maxRetries: getBrowserRetriesNumber, currentRetry: failedGetBrowserAttempts + 1 },
|
|
146
145
|
);
|
|
147
146
|
this.options.gridData.provider = gridInfo.provider;
|
|
148
147
|
this.options.gridData.host = gridInfo.host;
|
|
@@ -192,9 +191,10 @@ class BaseWorker {
|
|
|
192
191
|
}
|
|
193
192
|
|
|
194
193
|
perf.log('before runTest onTestStarted');
|
|
195
|
-
await this.onTestStarted(this.id, testRunHandler.getTestId(), testRunHandler.getTestResultId(), shouldRerun, testRunHandler.getRetryKey());
|
|
196
|
-
|
|
194
|
+
const test = await this.onTestStarted(this.id, testRunHandler.getTestId(), testRunHandler.getTestResultId(), shouldRerun, testRunHandler.getRetryKey());
|
|
195
|
+
testRunHandler._baseUrl = test.config.baseUrl;
|
|
197
196
|
|
|
197
|
+
const testPlayer = await this.getTestPlayer(testRunHandler, customExtensionLocalLocation);
|
|
198
198
|
try {
|
|
199
199
|
return await this.runTestOnce(testRunHandler, testPlayer);
|
|
200
200
|
} finally {
|
|
@@ -276,13 +276,13 @@ class BaseWorker {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
const msg = err instanceof Error ? err.message : err;
|
|
279
|
-
if (msg.
|
|
279
|
+
if (msg.includes(GET_BROWSER_TIMEOUT_MSG)) {
|
|
280
280
|
return { errorType: SETUP_TIMEOUT, reason: "Test couldn't get browser" };
|
|
281
281
|
}
|
|
282
|
-
if (msg.
|
|
282
|
+
if (msg.includes(TEST_START_TIMEOUT_MSG)) {
|
|
283
283
|
return { errorType: SETUP_TIMEOUT, reason: "Test couldn't be started" };
|
|
284
284
|
}
|
|
285
|
-
if (msg.
|
|
285
|
+
if (msg.includes(TEST_COMPLETE_TIMEOUT_MSG)) {
|
|
286
286
|
if (!this.testRunTimeout) {
|
|
287
287
|
return { errorType: SETUP_TIMEOUT, reason: 'Test timeout reached: test is too long' };
|
|
288
288
|
}
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
+
const proxyquire = require('proxyquire');
|
|
2
|
+
|
|
1
3
|
const { expect, sinon } = require('../../test/utils/testUtils');
|
|
2
|
-
const BaseWorker = require('./BaseWorker');
|
|
3
4
|
const gridService = require('../services/gridService');
|
|
4
5
|
const reporter = require('../reports/reporter');
|
|
5
6
|
const Bluebird = require('bluebird');
|
|
6
7
|
const { PageNotAvailableError, GridError, GetBrowserError } = require('../errors');
|
|
7
8
|
const servicesApi = require('../commons/testimServicesApi');
|
|
9
|
+
const { releasePlayer } = require('./workerUtils');
|
|
10
|
+
|
|
8
11
|
|
|
9
12
|
describe('BaseWorker', () => {
|
|
10
13
|
let worker;
|
|
11
14
|
let handleHybridStub;
|
|
12
15
|
let getGridSlotStub;
|
|
13
|
-
|
|
16
|
+
let runTestOnceStub = sinon.stub();
|
|
14
17
|
let testRunHandlerMock;
|
|
15
18
|
let testPlayerMock;
|
|
19
|
+
const onTestStartedStub = sinon.stub();
|
|
20
|
+
const sandbox = sinon.createSandbox();
|
|
16
21
|
|
|
17
22
|
beforeEach(() => {
|
|
18
|
-
|
|
23
|
+
const BaseWorker = proxyquire.noCallThru()('./BaseWorker', {
|
|
24
|
+
'./workerUtils': {
|
|
25
|
+
releasePlayer: () => sinon.stub().resolves({}),
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
worker = new BaseWorker(null, {}, null, null, onTestStartedStub);
|
|
19
30
|
worker.userData = {};
|
|
20
31
|
worker.options = { gridData: {}, browser: 'chrome', company: { companyId: 'companyId' }, getBrowserTimeout: 1000, getSessionTimeout: 100, getBrowserRetries: 10 };
|
|
21
32
|
worker.testRunConfig = {};
|
|
@@ -25,6 +36,7 @@ describe('BaseWorker', () => {
|
|
|
25
36
|
|
|
26
37
|
sinon.stub(worker, 'initPlayer').returns(testPlayerMock);
|
|
27
38
|
sinon.stub(worker, 'getBrowserOnce').returns({});
|
|
39
|
+
runTestOnceStub = sinon.stub(worker, 'runTestOnce');
|
|
28
40
|
handleHybridStub = sinon.stub(gridService, 'handleHybridOrVendorIfNeeded').callThrough();
|
|
29
41
|
getGridSlotStub = sinon.stub(gridService, 'getGridSlot').resolves({});
|
|
30
42
|
|
|
@@ -154,5 +166,27 @@ describe('BaseWorker', () => {
|
|
|
154
166
|
expect(worker.getBrowserOnce.getCall(2).args[3]).to.shallowDeepEqual({ type: 'testimHybrid', gridId: 'gridId', provider: 'a', host: 'google.com', user: undefined, key: undefined, port: 4444 });
|
|
155
167
|
});
|
|
156
168
|
});
|
|
169
|
+
|
|
170
|
+
describe('runTest', () => {
|
|
171
|
+
it('should call the runTestOnc with the base url of the test object we acquired from onTestStarted', async () => {
|
|
172
|
+
const testRunHandler = {
|
|
173
|
+
_baseUrl: 'https://testim.io',
|
|
174
|
+
getTestStatus: () => sinon.stub().returns(42),
|
|
175
|
+
getTestId: () => sinon.stub().returns(42),
|
|
176
|
+
getTestResultId: () => sinon.stub().returns(42),
|
|
177
|
+
getRetryKey: () => sinon.stub().returns(42),
|
|
178
|
+
getExecutionId: () => sinon.stub().returns(42),
|
|
179
|
+
testRunHandler: () => sinon.stub().returns(42),
|
|
180
|
+
clearTestResult: () => sinon.stub().returns(42),
|
|
181
|
+
};
|
|
182
|
+
onTestStartedStub.returns({
|
|
183
|
+
config: {
|
|
184
|
+
baseUrl: 'http://demo.testim.io/',
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
await worker.runTest(testRunHandler);
|
|
188
|
+
expect(runTestOnceStub.firstCall.firstArg._baseUrl).to.equals('http://demo.testim.io/');
|
|
189
|
+
});
|
|
190
|
+
});
|
|
157
191
|
});
|
|
158
192
|
});
|
|
@@ -45,7 +45,8 @@ class WorkerExtensionSingleBrowser extends WorkerExtension {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
perf.log('before runTest onTestStarted single browser');
|
|
48
|
-
await this.onTestStarted(this.id, testRunHandler.getTestId(), testRunHandler.getTestResultId(), shouldRerun, testRunHandler.getRetryKey());
|
|
48
|
+
const test = await this.onTestStarted(this.id, testRunHandler.getTestId(), testRunHandler.getTestResultId(), shouldRerun, testRunHandler.getRetryKey());
|
|
49
|
+
testRunHandler._baseUrl = test.config.baseUrl;
|
|
49
50
|
const testPlayer = await this.getTestPlayer(testRunHandler, customExtensionLocalLocation);
|
|
50
51
|
|
|
51
52
|
testRunHandler.markClearBrowser();
|