@testim/testim-cli 3.289.0 → 3.290.1-beta
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/cli.js +22390 -122
- package/cli.js.map +1 -0
- package/npm-shrinkwrap.json +1169 -12846
- package/package.json +16 -10
- package/OverrideTestDataBuilder.js +0 -117
- package/agent/routers/cliJsCode/index.js +0 -13
- package/agent/routers/cliJsCode/router.js +0 -63
- package/agent/routers/cliJsCode/service.js +0 -705
- package/agent/routers/codim/router.js +0 -69
- package/agent/routers/codim/router.test.js +0 -60
- package/agent/routers/codim/service.js +0 -193
- package/agent/routers/general/index.js +0 -36
- package/agent/routers/hybrid/registerRoutes.js +0 -81
- package/agent/routers/index.js +0 -56
- package/agent/routers/playground/router.js +0 -77
- package/agent/routers/playground/service.js +0 -96
- package/agent/routers/standalone-browser/registerRoutes.js +0 -47
- package/agent/server.js +0 -150
- package/cdpTestRunner.js +0 -86
- package/chromiumInstaller.js +0 -91
- package/cli/isCiRun.js +0 -10
- package/cli/onExit.js +0 -65
- package/cli/writeStackTrace.js +0 -27
- package/cliAgentMode.js +0 -384
- package/codim/codim-cli.js +0 -91
- package/codim/codim-npm-package/index.ts +0 -427
- package/codim/codim-npm-package/package-lock.json +0 -14
- package/codim/codim-npm-package/package.json +0 -14
- package/codim/hybrid-utils.js +0 -28
- package/codim/measure-perf.js +0 -41
- package/codim/template.js/.idea/workspace.xml +0 -57
- package/codim/template.js/.vscode/launch.json +0 -53
- package/codim/template.ts/.idea/workspace.xml +0 -57
- package/codim/template.ts/.vscode/launch.json +0 -55
- package/commons/AbortError.js +0 -12
- package/commons/SeleniumPerfStats.js +0 -58
- package/commons/chrome-launcher.js +0 -15
- package/commons/chromedriverWrapper.js +0 -70
- package/commons/config.js +0 -39
- package/commons/constants.js +0 -67
- package/commons/detectDebugger.js +0 -19
- package/commons/featureAvailabilityService.js +0 -26
- package/commons/featureFlags.js +0 -132
- package/commons/getSessionPlayerRequire.js +0 -28
- package/commons/httpRequest.js +0 -261
- package/commons/httpRequestCounters.js +0 -98
- package/commons/httpRequestCounters.test.js +0 -38
- package/commons/initializeUserWithAuth.js +0 -55
- package/commons/lazyRequire.js +0 -105
- package/commons/logUtils.js +0 -15
- package/commons/logUtils.test.js +0 -21
- package/commons/logger.js +0 -178
- package/commons/mockNetworkRuleFileSchema.json +0 -140
- package/commons/npmWrapper.js +0 -174
- package/commons/npmWrapper.test.js +0 -374
- package/commons/performance-logger.js +0 -71
- package/commons/preloadTests.js +0 -29
- package/commons/prepareRunner.js +0 -85
- package/commons/prepareRunner.test.js +0 -144
- package/commons/prepareRunnerAndTestimStartUtils.js +0 -198
- package/commons/prepareRunnerAndTestimStartUtils.test.js +0 -73
- package/commons/requireWithFallback.js +0 -25
- package/commons/runnerFileCache.js +0 -204
- package/commons/socket/baseSocketServiceSocketIO.js +0 -197
- package/commons/socket/realDataService.js +0 -59
- package/commons/socket/realDataServiceSocketIO.js +0 -33
- package/commons/socket/remoteStepService.js +0 -55
- package/commons/socket/remoteStepServiceSocketIO.js +0 -61
- package/commons/socket/socketService.js +0 -175
- package/commons/socket/testResultService.js +0 -62
- package/commons/socket/testResultServiceSocketIO.js +0 -64
- package/commons/testimAnalytics.js +0 -40
- package/commons/testimCloudflare.js +0 -83
- package/commons/testimCloudflare.test.js +0 -185
- package/commons/testimCustomToken.js +0 -124
- package/commons/testimDesiredCapabilitiesBuilder.js +0 -647
- package/commons/testimNgrok.js +0 -90
- package/commons/testimNgrok.test.js +0 -140
- package/commons/testimServicesApi.js +0 -631
- package/commons/testimTunnel.js +0 -73
- package/commons/testimTunnel.test.js +0 -172
- package/commons/xhr2.js +0 -897
- package/coverage/SummaryToObjectReport.js +0 -19
- package/coverage/jsCoverage.js +0 -252
- package/credentialsManager.js +0 -142
- package/errors.js +0 -161
- package/executionQueue.js +0 -37
- package/fixLocalBuild.js +0 -24
- package/inputFileUtils.js +0 -103
- package/lib/coralogix-winston.transport.js +0 -99
- package/player/SeleniumProtocolError.js +0 -100
- package/player/WebDriverHttpRequest.js +0 -177
- package/player/WebdriverioWebDriverApi.js +0 -671
- package/player/appiumTestPlayer.js +0 -90
- package/player/chromeLauncherTestPlayer.js +0 -67
- package/player/constants.js +0 -332
- package/player/extensionTestPlayer.js +0 -32
- package/player/findElementStrategy.js +0 -154
- package/player/scripts/isElementDisplayed.js +0 -252
- package/player/seleniumTestPlayer.js +0 -140
- package/player/services/frameLocator.js +0 -170
- package/player/services/mobileFrameLocatorMock.js +0 -32
- package/player/services/playbackTimeoutCalculator.js +0 -175
- package/player/services/portSelector.js +0 -19
- package/player/services/tabService.js +0 -551
- package/player/services/tabServiceMock.js +0 -167
- package/player/services/windowCreationListener.js +0 -8
- package/player/stepActions/RefreshStepAction.js +0 -16
- package/player/stepActions/apiStepAction.js +0 -89
- package/player/stepActions/baseCliJsStepAction.js +0 -51
- package/player/stepActions/baseJsStepAction.js +0 -277
- package/player/stepActions/cliConditionStepAction.js +0 -11
- package/player/stepActions/cliJsStepAction.js +0 -11
- package/player/stepActions/dropFileStepAction.js +0 -34
- package/player/stepActions/evaluateExpressionStepAction.js +0 -52
- package/player/stepActions/extensionOnlyStepAction.js +0 -12
- package/player/stepActions/extractTextStepAction.js +0 -19
- package/player/stepActions/hoverStepAction.js +0 -55
- package/player/stepActions/inputFileStepAction.js +0 -199
- package/player/stepActions/jsCodeStepAction.js +0 -11
- package/player/stepActions/jsConditionStepAction.js +0 -11
- package/player/stepActions/locateStepAction.js +0 -159
- package/player/stepActions/mouseStepAction.js +0 -370
- package/player/stepActions/navigationStepAction.js +0 -29
- package/player/stepActions/nodePackageStepAction.js +0 -47
- package/player/stepActions/pixelValidationStepAction.js +0 -39
- package/player/stepActions/scripts/dispatchEvents.js +0 -282
- package/player/stepActions/scripts/doClick.js +0 -221
- package/player/stepActions/scripts/doDragPath.js +0 -225
- package/player/stepActions/scripts/doubleClick.js +0 -119
- package/player/stepActions/scripts/dropEvent.js +0 -63
- package/player/stepActions/scripts/focusElement.js +0 -46
- package/player/stepActions/scripts/html5dragAction.js +0 -56
- package/player/stepActions/scripts/html5dragActionV2.js +0 -312
- package/player/stepActions/scripts/runCode.js +0 -147
- package/player/stepActions/scripts/scroll.js +0 -90
- package/player/stepActions/scripts/selectOption.js +0 -51
- package/player/stepActions/scripts/setText.js +0 -415
- package/player/stepActions/scripts/wheel.js +0 -61
- package/player/stepActions/scrollStepAction.js +0 -96
- package/player/stepActions/selectOptionStepAction.js +0 -49
- package/player/stepActions/sfdcRecordedStepAction.js +0 -24
- package/player/stepActions/sfdcStepAction.js +0 -28
- package/player/stepActions/sleepStepAction.js +0 -12
- package/player/stepActions/specialKeyStepAction.js +0 -52
- package/player/stepActions/stepAction.js +0 -73
- package/player/stepActions/stepActionRegistrar.js +0 -111
- package/player/stepActions/submitStepAction.js +0 -12
- package/player/stepActions/tdkHybridStepAction.js +0 -18
- package/player/stepActions/textStepAction.js +0 -110
- package/player/stepActions/textValidationStepAction.js +0 -64
- package/player/stepActions/wheelStepAction.js +0 -41
- package/player/utils/cookieUtils.js +0 -39
- package/player/utils/eyeSdkService.js +0 -250
- package/player/utils/imageCaptureUtils.js +0 -267
- package/player/utils/screenshotUtils.js +0 -68
- package/player/utils/stepActionUtils.js +0 -90
- package/player/utils/windowUtils.js +0 -195
- package/player/webDriverUtils.js +0 -40
- package/player/webDriverUtils.test.js +0 -116
- package/player/webdriver.js +0 -976
- package/polyfills/Array.prototype.at.js +0 -13
- package/polyfills/index.js +0 -13
- package/processHandler.js +0 -79
- package/processHandler.test.js +0 -55
- package/reports/chromeReporter.js +0 -17
- package/reports/consoleReporter.js +0 -190
- package/reports/debugReporter.js +0 -82
- package/reports/jsonReporter.js +0 -55
- package/reports/junitReporter.js +0 -183
- package/reports/reporter.js +0 -166
- package/reports/reporterUtils.js +0 -54
- package/reports/teamCityReporter.js +0 -73
- package/runOptions.d.ts +0 -305
- package/runOptions.js +0 -1288
- package/runOptionsAgentFlow.js +0 -87
- package/runOptionsUtils.js +0 -60
- package/runner.js +0 -355
- package/runners/ParallelWorkerManager.js +0 -284
- package/runners/TestPlanRunner.js +0 -419
- package/runners/buildCodeTests.js +0 -159
- package/runners/runnerUtils.js +0 -81
- package/services/analyticsService.js +0 -96
- package/services/branchService.js +0 -29
- package/services/gridService.js +0 -357
- package/services/gridService.test.js +0 -357
- package/services/labFeaturesService.js +0 -64
- package/services/lambdatestService.js +0 -227
- package/services/lambdatestService.test.js +0 -353
- package/services/localRCASaver.js +0 -124
- package/stepPlayers/cliJsStepPlayback.js +0 -40
- package/stepPlayers/hybridStepPlayback.js +0 -140
- package/stepPlayers/nodePackageStepPlayback.js +0 -28
- package/stepPlayers/playwrightHybridStepPlayback.js +0 -61
- package/stepPlayers/puppeteerHybridStepPlayback.js +0 -76
- package/stepPlayers/remoteStepPlayback.js +0 -80
- package/stepPlayers/seleniumHybridStepPlayback.js +0 -84
- package/stepPlayers/tdkHybridStepPlayback.js +0 -112
- package/testRunHandler.js +0 -603
- package/testRunStatus.js +0 -567
- package/testimNpmDriver.js +0 -52
- package/utils/argsUtils.js +0 -91
- package/utils/argsUtils.test.js +0 -32
- package/utils/fsUtils.js +0 -174
- package/utils/index.js +0 -197
- package/utils/promiseUtils.js +0 -85
- package/utils/stringUtils.js +0 -98
- package/utils/stringUtils.test.js +0 -22
- package/utils/timeUtils.js +0 -25
- package/utils/utils.test.js +0 -27
- package/workers/BaseWorker.js +0 -498
- package/workers/BaseWorker.test.js +0 -186
- package/workers/WorkerAppium.js +0 -180
- package/workers/WorkerExtension.js +0 -192
- package/workers/WorkerExtensionSingleBrowser.js +0 -77
- package/workers/WorkerSelenium.js +0 -253
- package/workers/workerUtils.js +0 -20
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
const proxyquire = require('proxyquire');
|
|
2
|
-
|
|
3
|
-
const { expect, sinon } = require('../../test/utils/testUtils');
|
|
4
|
-
const gridService = require('../services/gridService');
|
|
5
|
-
const reporter = require('../reports/reporter');
|
|
6
|
-
const { PageNotAvailableError, GridError, GetBrowserError } = require('../errors');
|
|
7
|
-
const servicesApi = require('../commons/testimServicesApi');
|
|
8
|
-
const utils = require('../utils');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
describe('BaseWorker', () => {
|
|
12
|
-
let worker;
|
|
13
|
-
let handleHybridStub;
|
|
14
|
-
let getGridSlotStub;
|
|
15
|
-
let runTestOnceStub = sinon.stub();
|
|
16
|
-
let testRunHandlerMock;
|
|
17
|
-
let testPlayerMock;
|
|
18
|
-
const onTestStartedStub = sinon.stub();
|
|
19
|
-
const sandbox = sinon.createSandbox();
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
const BaseWorker = proxyquire.noCallThru()('./BaseWorker', {
|
|
23
|
-
'./workerUtils': {
|
|
24
|
-
releasePlayer: () => sinon.stub().resolves({}),
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
worker = new BaseWorker(null, {}, null, null, onTestStartedStub, null, () => { /* noop */ });
|
|
29
|
-
worker.userData = {};
|
|
30
|
-
worker.options = { gridData: {}, browser: 'chrome', company: { companyId: 'companyId' }, getBrowserTimeout: 1000, getSessionTimeout: 100, getBrowserRetries: 10 };
|
|
31
|
-
worker.testRunConfig = {};
|
|
32
|
-
|
|
33
|
-
testRunHandlerMock = { executionId: 'executionId', testResultId: 'testResultId' };
|
|
34
|
-
testPlayerMock = { onDone: sinon.spy() };
|
|
35
|
-
|
|
36
|
-
sinon.stub(worker, 'initPlayer').returns(testPlayerMock);
|
|
37
|
-
sinon.stub(worker, 'getBrowserOnce').returns({});
|
|
38
|
-
runTestOnceStub = sinon.stub(worker, 'runTestOnce');
|
|
39
|
-
handleHybridStub = sinon.stub(gridService, 'handleHybridOrVendorIfNeeded').callThrough();
|
|
40
|
-
getGridSlotStub = sinon.stub(gridService, 'getGridSlot').resolves({});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
sandbox.stub(utils, 'delay').returns(Promise.resolve());
|
|
44
|
-
sandbox.stub(reporter);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
afterEach(() => {
|
|
48
|
-
handleHybridStub.restore();
|
|
49
|
-
getGridSlotStub.restore();
|
|
50
|
-
|
|
51
|
-
sandbox.restore();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
describe('getTestPlayer', () => {
|
|
55
|
-
describe('getSlot', () => {
|
|
56
|
-
it('should get grid slot from server', async () => {
|
|
57
|
-
await worker.getTestPlayer(testRunHandlerMock);
|
|
58
|
-
sinon.assert.calledOnce(getGridSlotStub);
|
|
59
|
-
sinon.assert.notCalled(utils.delay);
|
|
60
|
-
});
|
|
61
|
-
it('should retry getting slot until it succeeds', async () => {
|
|
62
|
-
getGridSlotStub.onFirstCall().rejects();
|
|
63
|
-
getGridSlotStub.onSecondCall().resolves({});
|
|
64
|
-
|
|
65
|
-
await worker.getTestPlayer(testRunHandlerMock);
|
|
66
|
-
sinon.assert.calledTwice(getGridSlotStub);
|
|
67
|
-
sinon.assert.calledOnce(utils.delay);
|
|
68
|
-
});
|
|
69
|
-
it('should not proceed to getting browser if all retries used for getting a slot', async () => {
|
|
70
|
-
getGridSlotStub.resolves({});
|
|
71
|
-
worker.options.getBrowserRetries = 0;
|
|
72
|
-
await expect(worker.getTestPlayer(testRunHandlerMock)).to.eventually.be.rejectedWith('No free browser slots in desired grid');
|
|
73
|
-
sinon.assert.calledOnce(getGridSlotStub);
|
|
74
|
-
sinon.assert.notCalled(worker.getBrowserOnce);
|
|
75
|
-
sinon.assert.notCalled(worker.initPlayer);
|
|
76
|
-
sinon.assert.notCalled(utils.delay);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
describe('getBrowserOnce', () => {
|
|
81
|
-
it('should get browser from grid', async () => {
|
|
82
|
-
await worker.getTestPlayer(testRunHandlerMock);
|
|
83
|
-
sinon.assert.calledOnce(getGridSlotStub);
|
|
84
|
-
sinon.assert.calledOnce(worker.getBrowserOnce);
|
|
85
|
-
sinon.assert.calledOnce(worker.initPlayer);
|
|
86
|
-
sinon.assert.notCalled(utils.delay);
|
|
87
|
-
});
|
|
88
|
-
it('should retry getting browser until it succeeds', async () => {
|
|
89
|
-
worker.getBrowserOnce.onFirstCall().rejects();
|
|
90
|
-
worker.getBrowserOnce.onSecondCall().resolves({});
|
|
91
|
-
|
|
92
|
-
await worker.getTestPlayer(testRunHandlerMock);
|
|
93
|
-
sinon.assert.calledOnce(getGridSlotStub);
|
|
94
|
-
sinon.assert.calledTwice(worker.getBrowserOnce);
|
|
95
|
-
sinon.assert.calledTwice(worker.initPlayer);
|
|
96
|
-
sinon.assert.calledOnce(testPlayerMock.onDone);
|
|
97
|
-
sinon.assert.calledOnce(utils.delay);
|
|
98
|
-
});
|
|
99
|
-
it('should not retry if page is not available', async () => {
|
|
100
|
-
worker.getBrowserOnce.throws(() => new PageNotAvailableError());
|
|
101
|
-
|
|
102
|
-
await expect(worker.getTestPlayer(testRunHandlerMock)).to.eventually.be.rejectedWith(Error);
|
|
103
|
-
sinon.assert.calledOnce(getGridSlotStub);
|
|
104
|
-
sinon.assert.calledOnce(worker.getBrowserOnce);
|
|
105
|
-
sinon.assert.calledOnce(testPlayerMock.onDone);
|
|
106
|
-
sinon.assert.notCalled(utils.delay);
|
|
107
|
-
});
|
|
108
|
-
it('should handle get grid error', async () => {
|
|
109
|
-
worker.getBrowserOnce.throws(() => new GridError());
|
|
110
|
-
worker.options.getBrowserRetries = 1;
|
|
111
|
-
|
|
112
|
-
await expect(worker.getTestPlayer(testRunHandlerMock)).to.eventually.be.rejectedWith(GetBrowserError);
|
|
113
|
-
sinon.assert.calledOnce(testPlayerMock.onDone);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
describe('hybrid grid', () => {
|
|
118
|
-
let getHybridGridProviderStub;
|
|
119
|
-
|
|
120
|
-
beforeEach(() => {
|
|
121
|
-
getHybridGridProviderStub = sinon.stub(servicesApi, 'getHybridGridProvider');
|
|
122
|
-
handleHybridStub.callThrough();
|
|
123
|
-
});
|
|
124
|
-
afterEach(() => {
|
|
125
|
-
getHybridGridProviderStub.restore();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('should not get hybrid provider for non hybrid grid types', async () => {
|
|
129
|
-
getGridSlotStub.resolves({ type: 'testim', gridId: 'gridId' });
|
|
130
|
-
|
|
131
|
-
await worker.getTestPlayer(testRunHandlerMock);
|
|
132
|
-
sinon.assert.notCalled(getHybridGridProviderStub);
|
|
133
|
-
sinon.assert.calledOnce(handleHybridStub);
|
|
134
|
-
|
|
135
|
-
expect(worker.getBrowserOnce.getCall(0).args[3]).to.shallowDeepEqual({ type: 'testim', gridId: 'gridId' });
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it('should get hybrid provider after getting grid slot', async () => {
|
|
139
|
-
getGridSlotStub.resolves({ type: 'testimHybrid', gridId: 'gridId' });
|
|
140
|
-
getHybridGridProviderStub.resolves({ provider: 'loacker', connectionDetails: { host: 'localhost' } });
|
|
141
|
-
|
|
142
|
-
await worker.getTestPlayer(testRunHandlerMock);
|
|
143
|
-
sinon.assert.calledOnce(handleHybridStub);
|
|
144
|
-
sinon.assert.calledWith(handleHybridStub, worker.options, { type: 'testimHybrid', gridId: 'gridId' });
|
|
145
|
-
|
|
146
|
-
expect(worker.getBrowserOnce.getCall(0).args[3]).to.shallowDeepEqual({ type: 'testimHybrid', gridId: 'gridId', provider: 'loacker', host: 'localhost' });
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('should get browser from different provider on each retry', async () => {
|
|
150
|
-
getGridSlotStub.resolves({ type: 'testimHybrid', gridId: 'gridId' });
|
|
151
|
-
|
|
152
|
-
getHybridGridProviderStub.onFirstCall().resolves({ provider: 'loacker', connectionDetails: { host: 'localhost', external: { user: 'user', key: 'password' } } });
|
|
153
|
-
getHybridGridProviderStub.onSecondCall().resolves({ provider: 'nitzan', connectionDetails: { host: 'google.com', port: 443 } });
|
|
154
|
-
getHybridGridProviderStub.onThirdCall().resolves({ provider: 'a', connectionDetails: { host: 'google.com', port: 4444 } });
|
|
155
|
-
worker.getBrowserOnce.onFirstCall().rejects(new Error());
|
|
156
|
-
worker.getBrowserOnce.onSecondCall().rejects(new Error());
|
|
157
|
-
worker.getBrowserOnce.onThirdCall().resolves({});
|
|
158
|
-
|
|
159
|
-
await worker.getTestPlayer(testRunHandlerMock);
|
|
160
|
-
sinon.assert.calledThrice(handleHybridStub);
|
|
161
|
-
sinon.assert.calledWith(handleHybridStub, worker.options, { type: 'testimHybrid', gridId: 'gridId' });
|
|
162
|
-
|
|
163
|
-
expect(worker.getBrowserOnce.getCall(0).args[3]).to.shallowDeepEqual({ type: 'testimHybrid', gridId: 'gridId', provider: 'loacker', host: 'localhost', user: 'user', key: 'password' });
|
|
164
|
-
expect(worker.getBrowserOnce.getCall(1).args[3]).to.shallowDeepEqual({ type: 'testimHybrid', gridId: 'gridId', provider: 'nitzan', host: 'google.com', user: undefined, key: undefined, port: 443 });
|
|
165
|
-
expect(worker.getBrowserOnce.getCall(2).args[3]).to.shallowDeepEqual({ type: 'testimHybrid', gridId: 'gridId', provider: 'a', host: 'google.com', user: undefined, key: undefined, port: 4444 });
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
describe('runTest', () => {
|
|
170
|
-
it('should call the runTestOnc with the base url of the test object we acquired from onTestStarted', async () => {
|
|
171
|
-
const testRunHandler = {
|
|
172
|
-
_baseUrl: 'https://testim.io',
|
|
173
|
-
testRunHandler: () => sinon.stub().returns(42),
|
|
174
|
-
clearTestResult: () => sinon.stub().returns(42),
|
|
175
|
-
};
|
|
176
|
-
onTestStartedStub.returns({
|
|
177
|
-
config: {
|
|
178
|
-
baseUrl: 'http://demo.testim.io/',
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
await worker.runTest(testRunHandler);
|
|
182
|
-
expect(runTestOnceStub.firstCall.firstArg._baseUrl).to.equals('http://demo.testim.io/');
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
});
|
package/workers/WorkerAppium.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const jsdom = require('jsdom');
|
|
4
|
-
const BaseWorker = require('./BaseWorker');
|
|
5
|
-
const config = require('../commons/config');
|
|
6
|
-
const reporter = require('../reports/reporter');
|
|
7
|
-
const AppiumTestPlayer = require('../player/appiumTestPlayer');
|
|
8
|
-
const testimServicesApi = require('../commons/testimServicesApi');
|
|
9
|
-
const desiredCapabilitiesBuilder = require('../commons/testimDesiredCapabilitiesBuilder');
|
|
10
|
-
const { getSessionPlayer } = require('../commons/getSessionPlayerRequire');
|
|
11
|
-
const { getLogger } = require('../commons/logger');
|
|
12
|
-
|
|
13
|
-
const logger = getLogger('worker-appium');
|
|
14
|
-
|
|
15
|
-
class WorkerAppium extends BaseWorker {
|
|
16
|
-
/**
|
|
17
|
-
* @override
|
|
18
|
-
* @param {import('../testRunHandler')} testRunHandler
|
|
19
|
-
*/
|
|
20
|
-
initPlayer(testRunHandler) {
|
|
21
|
-
return new AppiumTestPlayer(
|
|
22
|
-
this.id,
|
|
23
|
-
testRunHandler.runParams,
|
|
24
|
-
this.options.shouldMonitorPerformance,
|
|
25
|
-
testRunHandler.automationMode,
|
|
26
|
-
undefined,
|
|
27
|
-
testRunHandler.retryCount,
|
|
28
|
-
testRunHandler.previousTestResultId,
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async getBrowserOnce(testRunHandler, customExtensionLocalLocation, appiumTestPlayer, gridInfo) {
|
|
33
|
-
reporter.onGetSession(this.id, this.testName, testRunHandler.runMode);
|
|
34
|
-
const { driver } = appiumTestPlayer;
|
|
35
|
-
const projectType = this.options.projectData.type;
|
|
36
|
-
const nativeApp = await testRunHandler.getNativeAppData();
|
|
37
|
-
const androidActivityWait = projectType === 'android' ? testRunHandler.androidActivityWait : null;
|
|
38
|
-
let appPath = testRunHandler.nativeAppLink;
|
|
39
|
-
if (this.options.appId) {
|
|
40
|
-
const { project: projectId, appId } = this.options;
|
|
41
|
-
const mobileApp = await testimServicesApi.getAppDetails({ appId, projectId });
|
|
42
|
-
if (!mobileApp) {
|
|
43
|
-
logger.error('mobile app not found', { appId, projectId });
|
|
44
|
-
throw new Error('mobile app not found');
|
|
45
|
-
}
|
|
46
|
-
appPath = `${config.SERVICES_HOST}/storage${mobileApp.filePath}?access_token=${this.options.authData.token}`;
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
const capabilities = desiredCapabilitiesBuilder.buildAppiumOptions({
|
|
50
|
-
projectType,
|
|
51
|
-
gridInfo,
|
|
52
|
-
testRunConfig: this.testRunConfig,
|
|
53
|
-
nativeApp,
|
|
54
|
-
options: this.options,
|
|
55
|
-
appPath,
|
|
56
|
-
androidActivityWait,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const activeSession = await driver.remote(capabilities);
|
|
60
|
-
driver.activeSession = activeSession;
|
|
61
|
-
await this.updateDeviceInfo(testRunHandler, activeSession);
|
|
62
|
-
logger.info(`init new appium session testName: ${this.testName}`, { sessionId: activeSession.sessionId, testResultId: this.testResultId, nativeApp });
|
|
63
|
-
} catch (err) {
|
|
64
|
-
//TODO: catch app status validation
|
|
65
|
-
logger.error('failed to start application', { err });
|
|
66
|
-
throw err;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
getServerAddressFromGrid(testRunHandler) {
|
|
71
|
-
const { host, port, accessToken } = testRunHandler._options.gridData;
|
|
72
|
-
return `https://${host}:${port}/v0/${accessToken}/wd/hub`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async updateDeviceInfo(testRunHandler, activeSession) {
|
|
76
|
-
const {
|
|
77
|
-
_executionId, _testId, _testResultId,
|
|
78
|
-
_options: { project: projectId },
|
|
79
|
-
} = testRunHandler;
|
|
80
|
-
const { projectData: { type: projectType }, company: { companyId }, gridData: { gridId } } = this.options;
|
|
81
|
-
|
|
82
|
-
const selectedDeviceArr = await testimServicesApi.getMobileDevicesFromGrid({ projectId, projectType, companyId, gridId, selectors: `device_id:${activeSession.capabilities.udid}` });
|
|
83
|
-
const deviceName = selectedDeviceArr[0]?.name;
|
|
84
|
-
|
|
85
|
-
const device = {
|
|
86
|
-
name: deviceName,
|
|
87
|
-
model: activeSession.capabilities.deviceModel,
|
|
88
|
-
osVersion: activeSession.capabilities.platformVersion,
|
|
89
|
-
udid: activeSession.capabilities.udid,
|
|
90
|
-
osType: activeSession.capabilities.platformName,
|
|
91
|
-
scaleFactor: activeSession.capabilities.pixelRatio,
|
|
92
|
-
virtual: false,
|
|
93
|
-
};
|
|
94
|
-
await testimServicesApi.updateTestStatus(
|
|
95
|
-
projectId,
|
|
96
|
-
_executionId,
|
|
97
|
-
_testId,
|
|
98
|
-
_testResultId,
|
|
99
|
-
'RUNNING',
|
|
100
|
-
{ device },
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
getDirectAddressConnection(activeSessionCapabilities) {
|
|
105
|
-
const { directConnectProtocol: protocol, directConnectHost: host, directConnectPort: port, directConnectPath: path } = activeSessionCapabilities;
|
|
106
|
-
if (protocol && host && port && path) {
|
|
107
|
-
return `${protocol}://${host}:${port}${path}`;
|
|
108
|
-
}
|
|
109
|
-
return undefined;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @param {import('../testRunHandler')} testRunHandler
|
|
114
|
-
* @param {import('../player/appiumTestPlayer')} appiumTestPlayer
|
|
115
|
-
*/
|
|
116
|
-
async runTestOnce(testRunHandler, appiumTestPlayer) {
|
|
117
|
-
const sessionPlayerInit = getSessionPlayer();
|
|
118
|
-
const { driver, sessionPlayer } = appiumTestPlayer;
|
|
119
|
-
const version = sessionPlayerInit.manifestVersion || 'runner';
|
|
120
|
-
|
|
121
|
-
reporter.onWaitToTestComplete(this.id, this.isCodeMode);
|
|
122
|
-
|
|
123
|
-
sessionPlayer.playbackManager.executionId = testRunHandler.executionId;
|
|
124
|
-
sessionPlayer.playbackManager.executionName = testRunHandler.executionName;
|
|
125
|
-
|
|
126
|
-
const serverAddress = this.getDirectAddressConnection(driver.activeSession.capabilities) || this.getServerAddressFromGrid(testRunHandler);
|
|
127
|
-
const DOMParser = new jsdom.JSDOM('').window.DOMParser;
|
|
128
|
-
sessionPlayer.playbackManager.appiumApi = new sessionPlayerInit.AppiumApi(serverAddress, driver.activeSession.sessionId, DOMParser);
|
|
129
|
-
if (sessionPlayerInit.localAssetService) {
|
|
130
|
-
sessionPlayerInit.localAssetService.initialize({ serverUrl: this.options.localRCASaver });
|
|
131
|
-
}
|
|
132
|
-
async function runAppiumTest() {
|
|
133
|
-
try {
|
|
134
|
-
const INCOGNITO = false;
|
|
135
|
-
const testResult = await new Promise((resolve, reject) =>
|
|
136
|
-
// eslint-disable-next-line no-promise-executor-return
|
|
137
|
-
sessionPlayer.playByTestId(
|
|
138
|
-
this.testId,
|
|
139
|
-
this.executionId,
|
|
140
|
-
this.testResultId,
|
|
141
|
-
this.baseUrl,
|
|
142
|
-
this.userData,
|
|
143
|
-
version,
|
|
144
|
-
resolve,
|
|
145
|
-
false,
|
|
146
|
-
this.overrideTestConfigId,
|
|
147
|
-
this.branch,
|
|
148
|
-
INCOGNITO,
|
|
149
|
-
testRunHandler.remoteRunId,
|
|
150
|
-
undefined,
|
|
151
|
-
undefined,
|
|
152
|
-
undefined,
|
|
153
|
-
).catch(reject),
|
|
154
|
-
);
|
|
155
|
-
if (sessionPlayerInit.localAssetService) {
|
|
156
|
-
await sessionPlayerInit.localAssetService.drain();
|
|
157
|
-
}
|
|
158
|
-
testResult.stepsResults = null;
|
|
159
|
-
testResult.resultId = this.testResultId;
|
|
160
|
-
const resultWithStats = { ...testResult, ...testRunHandler.seleniumPerfStats.getStats() };
|
|
161
|
-
return resultWithStats;
|
|
162
|
-
} catch (err) {
|
|
163
|
-
//TODO: add test timeout and handle Timeout Error TBD
|
|
164
|
-
// if (err instanceof TimeoutError && sessionPlayer.stopPlayingOnTestTimeout) {
|
|
165
|
-
// sessionPlayer.stopPlayingOnTestTimeout();
|
|
166
|
-
// }
|
|
167
|
-
logger.error('error while running appium tests', { err });
|
|
168
|
-
throw err;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
try {
|
|
172
|
-
await super.runTestOnce(testRunHandler, appiumTestPlayer);
|
|
173
|
-
return await runAppiumTest.call(this);
|
|
174
|
-
} catch (err) {
|
|
175
|
-
logger.error('failed to run test once', { err });
|
|
176
|
-
throw err;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
module.exports = WorkerAppium;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const BaseWorker = require('./BaseWorker');
|
|
4
|
-
const reporter = require('../reports/reporter');
|
|
5
|
-
const perf = require('../commons/performance-logger');
|
|
6
|
-
const ExtensionTestPlayer = require('../player/extensionTestPlayer');
|
|
7
|
-
const ChromeLauncherTestPlayer = require('../player/chromeLauncherTestPlayer');
|
|
8
|
-
const { TimeoutError } = require('../errors');
|
|
9
|
-
const { promiseTimeout } = require('../utils');
|
|
10
|
-
const { getLogger } = require('../commons/logger');
|
|
11
|
-
const { timeoutMessages, stepResult } = require('../commons/constants');
|
|
12
|
-
|
|
13
|
-
const logger = getLogger('worker-ext');
|
|
14
|
-
|
|
15
|
-
class WorkerExtension extends BaseWorker {
|
|
16
|
-
/** @override */
|
|
17
|
-
initPlayer() {
|
|
18
|
-
if (this.options.useChromeLauncher) {
|
|
19
|
-
return new ChromeLauncherTestPlayer(this.id);
|
|
20
|
-
}
|
|
21
|
-
return new ExtensionTestPlayer(this.id);
|
|
22
|
-
}
|
|
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
|
-
*/
|
|
30
|
-
async _getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo) {
|
|
31
|
-
const { driver } = player;
|
|
32
|
-
try {
|
|
33
|
-
return await driver.init(
|
|
34
|
-
this.options,
|
|
35
|
-
this.testName,
|
|
36
|
-
this.testRunConfig,
|
|
37
|
-
gridInfo,
|
|
38
|
-
customExtensionLocalLocation,
|
|
39
|
-
this.executionId,
|
|
40
|
-
this.testResultId,
|
|
41
|
-
testRunHandler.seleniumPerfStats,
|
|
42
|
-
this.options.lightweightMode?.general,
|
|
43
|
-
this.lambdatestService
|
|
44
|
-
);
|
|
45
|
-
} catch (err) {
|
|
46
|
-
logger.error('failed to get browser', {
|
|
47
|
-
err,
|
|
48
|
-
gridInfo,
|
|
49
|
-
testId: testRunHandler.testId,
|
|
50
|
-
resultId: testRunHandler.testResultId,
|
|
51
|
-
});
|
|
52
|
-
throw err;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** @override */
|
|
57
|
-
async getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo) {
|
|
58
|
-
reporter.onGetSession(this.id, this.testName, testRunHandler.runMode);
|
|
59
|
-
return this._getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @override
|
|
64
|
-
* @param {import('../testRunHandler')} testRunHandler
|
|
65
|
-
* @param {import('../player/extensionTestPlayer') | import('../player/chromeLauncherTestPlayer')} player
|
|
66
|
-
*/
|
|
67
|
-
async runTestOnce(testRunHandler, player) {
|
|
68
|
-
const { driver } = player;
|
|
69
|
-
const { testResultId, executionId, testId } = this;
|
|
70
|
-
perf.log('WorkerExtension runTestOnce');
|
|
71
|
-
|
|
72
|
-
const runViaCdpOrFallbackToAPI = async () => {
|
|
73
|
-
const testTimeout = this.options.timeoutWasGiven ? Math.max(10000, this.options.timeout) : this.options.testStartTimeout;
|
|
74
|
-
try {
|
|
75
|
-
return await promiseTimeout(testRunHandler.runTestUsingCDP(driver.cdpTestRunner), testTimeout, timeoutMessages.TEST_START_TIMEOUT_MSG);
|
|
76
|
-
} catch (err) {
|
|
77
|
-
if (!(err instanceof TimeoutError)) {
|
|
78
|
-
throw err;
|
|
79
|
-
}
|
|
80
|
-
logger.warn('timeout while running test using CDP. Running checkViaRestAPIIfTestStarted', { testResultId });
|
|
81
|
-
return await testRunHandler.checkViaRestAPIIfTestStarted();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const navigateChromeSessionToRunTestim = async (url, startStatusDetails) => {
|
|
85
|
-
try {
|
|
86
|
-
const res = await driver.url(url);
|
|
87
|
-
startStatusDetails.driverUrlFinished = true;
|
|
88
|
-
return res;
|
|
89
|
-
} catch (err) {
|
|
90
|
-
logger.error('error from driver.url', { err, testResultId, executionId, testId, url, urlLength: url.length });
|
|
91
|
-
throw err;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const updateRunHandlerThatTestStartedAndChangeStatusDetails = async (startStatusDetails) => {
|
|
95
|
-
const res = await testRunHandler.onStarted(this.options.testStartTimeout);
|
|
96
|
-
startStatusDetails.testRunHandlerOnStartedHadFinished = true;
|
|
97
|
-
return res;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const runExtTest = async () => {
|
|
101
|
-
perf.log('WorkerExtension runExtTest');
|
|
102
|
-
const disableRemoteStep = this.options.lightweightMode?.disableRemoteStep || this.options.disableSockets;
|
|
103
|
-
if (!disableRemoteStep) {
|
|
104
|
-
testRunHandler.listenToRemoteStep(driver);
|
|
105
|
-
}
|
|
106
|
-
if (this.options.useChromeLauncher) {
|
|
107
|
-
reporter.onWaitToTestStart(this.id);
|
|
108
|
-
reporter.onWaitToTestComplete(this.id, this.isCodeMode);
|
|
109
|
-
try {
|
|
110
|
-
const testResult = await runViaCdpOrFallbackToAPI();
|
|
111
|
-
return { ...testResult, ...testRunHandler.seleniumPerfStats.getStats() };
|
|
112
|
-
} catch (err) {
|
|
113
|
-
logger.warn('failed to run test via CDP', { err });
|
|
114
|
-
throw err;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const startStatusDetails = { driverUrlFinished: false, testRunHandlerOnStartedHadFinished: false }; //for logging / debugging purposes
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
const url = await testRunHandler.getRunTestUrl();
|
|
122
|
-
reporter.onWaitToTestStart(this.id);
|
|
123
|
-
try {
|
|
124
|
-
await promiseTimeout(Promise.all([
|
|
125
|
-
navigateChromeSessionToRunTestim(url, startStatusDetails),
|
|
126
|
-
updateRunHandlerThatTestStartedAndChangeStatusDetails(startStatusDetails),
|
|
127
|
-
]), this.options.testStartTimeout, timeoutMessages.TEST_START_TIMEOUT_MSG);
|
|
128
|
-
} catch (err) {
|
|
129
|
-
if (!(err instanceof TimeoutError)) {
|
|
130
|
-
throw err;
|
|
131
|
-
}
|
|
132
|
-
logger.warn('timeout occurred (see log\'s payload). Running checkViaRestAPIIfTestStarted', { testResultId, executionId, testId, ...startStatusDetails });
|
|
133
|
-
await testRunHandler.checkViaRestAPIIfTestStarted();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
reporter.onWaitToTestComplete(this.id, this.isCodeMode);
|
|
137
|
-
const onBrowserClosed = (err) => {
|
|
138
|
-
testRunHandler.onCompletedCleanup();
|
|
139
|
-
logger.warn('on browser closed error detected', { err, testResultId, executionId, testId });
|
|
140
|
-
driver.unregisterToClosedBrowser(onBrowserClosed);
|
|
141
|
-
err.type = stepResult.BROWSER_CLOSED;
|
|
142
|
-
throw err;
|
|
143
|
-
};
|
|
144
|
-
driver.registerToClosedBrowser(onBrowserClosed);
|
|
145
|
-
try {
|
|
146
|
-
const testResult = await promiseTimeout(testRunHandler.onCompleted(), this.testRunTimeout, timeoutMessages.TEST_COMPLETE_TIMEOUT_MSG);
|
|
147
|
-
driver.unregisterToClosedBrowser(onBrowserClosed);
|
|
148
|
-
if (this.lambdatestService.isLambdatestRun()) {
|
|
149
|
-
await driver.executeJS(`lambda-status=${!testResult.success ? 'failed' : 'passed'}`).catch(() => { });
|
|
150
|
-
}
|
|
151
|
-
if (!driver.isAlive()) {
|
|
152
|
-
logger.warn(`possible grid unresponsive for test ${this.testId}, result ${this.testResultId} (execution: ${this.executionId})`);
|
|
153
|
-
testResult.gridIssues = 'could not validate grid is alive';
|
|
154
|
-
}
|
|
155
|
-
const maxKeepAliveGap = driver.maxKeepAliveGap();
|
|
156
|
-
const MAX_KEEP_ALIVE_GAP = 30000;
|
|
157
|
-
if (maxKeepAliveGap >= MAX_KEEP_ALIVE_GAP) {
|
|
158
|
-
logger.warn(`possible browser keep alive issue ${this.testId}, result ${this.testResultId} (execution: ${this.executionId})`);
|
|
159
|
-
testResult.keepAliveIssue = maxKeepAliveGap;
|
|
160
|
-
}
|
|
161
|
-
return { ...testResult, ...testRunHandler.seleniumPerfStats.getStats() };
|
|
162
|
-
} catch (err) {
|
|
163
|
-
logger.warn('timeout wait until test completed', { err, testResultId, executionId, testId });
|
|
164
|
-
// complete time out
|
|
165
|
-
throw new Error(err);
|
|
166
|
-
} finally {
|
|
167
|
-
driver.unregisterToClosedBrowser(onBrowserClosed);
|
|
168
|
-
}
|
|
169
|
-
} catch (err) {
|
|
170
|
-
logger.warn('failed to start url', { err });
|
|
171
|
-
throw new Error(err);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
driver.start();
|
|
176
|
-
|
|
177
|
-
try {
|
|
178
|
-
await super.runTestOnce(testRunHandler, player);
|
|
179
|
-
perf.log('WorkerExtension super.runTestOnce');
|
|
180
|
-
return await runExtTest();
|
|
181
|
-
} catch (err) {
|
|
182
|
-
logger.error('failed to run test', {
|
|
183
|
-
err,
|
|
184
|
-
testId: testRunHandler.testId,
|
|
185
|
-
resultId: testRunHandler.testResultId,
|
|
186
|
-
});
|
|
187
|
-
throw err;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
module.exports = WorkerExtension;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { delay } = require('../utils');
|
|
4
|
-
const { releasePlayer } = require('./workerUtils');
|
|
5
|
-
const WorkerExtension = require('./WorkerExtension');
|
|
6
|
-
const perf = require('../commons/performance-logger');
|
|
7
|
-
const reporter = require('../reports/reporter');
|
|
8
|
-
const logger = require('../commons/logger').getLogger('base-worker');
|
|
9
|
-
|
|
10
|
-
const DELAY_BETWEEN_TESTS = 500;
|
|
11
|
-
|
|
12
|
-
class WorkerExtensionSingleBrowser extends WorkerExtension {
|
|
13
|
-
async _releasePlayer() {
|
|
14
|
-
if (!this.testPlayer) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
await releasePlayer(this.id, this.releaseSlotOnTestFinished, this.userData?.projectId, this.testPlayer);
|
|
18
|
-
this.testPlayer = null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
onQueueCompleted() {
|
|
22
|
-
return this._releasePlayer();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo) {
|
|
26
|
-
reporter.onGetSession(this.id, `worker ${this.id}`, testRunHandler.runMode);
|
|
27
|
-
return this._getBrowserOnce(testRunHandler, customExtensionLocalLocation, player, gridInfo);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @override
|
|
32
|
-
* @param {import('../testRunHandler')} testRunHandler
|
|
33
|
-
* @param {string=} customExtensionLocalLocation
|
|
34
|
-
*/
|
|
35
|
-
async getTestPlayer(testRunHandler, customExtensionLocalLocation) {
|
|
36
|
-
if (this.testPlayer && !this.testPlayer.driver.isAlive()) {
|
|
37
|
-
logger.warn('WorkerExtensionSingleBrowser is releasing a dead player', { workerId: this.id });
|
|
38
|
-
await this._releasePlayer();
|
|
39
|
-
}
|
|
40
|
-
if (!this.testPlayer) {
|
|
41
|
-
this.testPlayer = await super.getTestPlayer(testRunHandler, customExtensionLocalLocation);
|
|
42
|
-
}
|
|
43
|
-
return this.testPlayer;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @param {import('../testRunHandler')} testRunHandler
|
|
48
|
-
* @param {string=} customExtensionLocalLocation
|
|
49
|
-
* @param {boolean=} shouldRerun
|
|
50
|
-
*/
|
|
51
|
-
async runTest(testRunHandler, customExtensionLocalLocation, shouldRerun) {
|
|
52
|
-
const quarantineResult = this.handleQuarantine(testRunHandler);
|
|
53
|
-
if (quarantineResult) {
|
|
54
|
-
return quarantineResult;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
perf.log('before runTest onTestStarted single browser');
|
|
58
|
-
const test = await this.onTestStarted(this.id, testRunHandler.testId, testRunHandler.testResultId, shouldRerun, testRunHandler.retryKey);
|
|
59
|
-
testRunHandler._baseUrl = test.config.baseUrl;
|
|
60
|
-
const testPlayer = await this.getTestPlayer(testRunHandler, customExtensionLocalLocation);
|
|
61
|
-
|
|
62
|
-
testRunHandler.markClearBrowser();
|
|
63
|
-
return await this.runTestOnce(testRunHandler, testPlayer);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async runTestCleanup() {
|
|
67
|
-
if (!this.executionQueue.hasMoreTests()) {
|
|
68
|
-
await this.onQueueCompleted();
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (this.options.lightweightMode?.general) {
|
|
72
|
-
await delay(DELAY_BETWEEN_TESTS);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
module.exports = WorkerExtensionSingleBrowser;
|