@testim/testim-cli 3.289.0 → 3.290.0-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 +8 -29129
- 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,253 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const utils = require('../utils');
|
|
4
|
-
const BaseWorker = require('./BaseWorker');
|
|
5
|
-
const reporter = require('../reports/reporter');
|
|
6
|
-
const perf = require('../commons/performance-logger');
|
|
7
|
-
const WindowUtils = require('../player/utils/windowUtils');
|
|
8
|
-
const SeleniumTestPlayer = require('../player/seleniumTestPlayer');
|
|
9
|
-
const { getLogger } = require('../commons/logger');
|
|
10
|
-
const { PageNotAvailableError } = require('../errors');
|
|
11
|
-
const { preloadTests } = require('../commons/preloadTests');
|
|
12
|
-
const { timeoutMessages } = require('../commons/constants');
|
|
13
|
-
const { getSessionPlayer } = require('../commons/getSessionPlayerRequire');
|
|
14
|
-
|
|
15
|
-
const logger = getLogger('worker-selenium');
|
|
16
|
-
|
|
17
|
-
// this navigation timeout is handled from outside the worker, so don't pass a small timeout to navigate
|
|
18
|
-
const NO_NAVIGATION_TIME_LIMIT = 1e9;
|
|
19
|
-
|
|
20
|
-
class WorkerSelenium extends BaseWorker {
|
|
21
|
-
/**
|
|
22
|
-
* @override
|
|
23
|
-
* @param {import('../testRunHandler')} testRunHandler
|
|
24
|
-
*/
|
|
25
|
-
initPlayer(testRunHandler) {
|
|
26
|
-
return new SeleniumTestPlayer(
|
|
27
|
-
this.id,
|
|
28
|
-
testRunHandler.runParams,
|
|
29
|
-
this.options.shouldMonitorPerformance,
|
|
30
|
-
testRunHandler.automationMode,
|
|
31
|
-
undefined,
|
|
32
|
-
testRunHandler.retryCount,
|
|
33
|
-
testRunHandler.previousTestResultId,
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @override
|
|
39
|
-
* @param {import('../testRunHandler')} testRunHandler
|
|
40
|
-
* @param {string=} customExtensionLocalLocation
|
|
41
|
-
* @param {SeleniumTestPlayer} seleniumTestPlayer
|
|
42
|
-
* @param {Awaited<ReturnType<import('../services/gridService')['handleHybridOrVendorIfNeeded']>>} gridInfo
|
|
43
|
-
*/
|
|
44
|
-
async getBrowserOnce(testRunHandler, customExtensionLocalLocation, seleniumTestPlayer, gridInfo) {
|
|
45
|
-
perf.log('in WorkerSelenium getBrowserOnce');
|
|
46
|
-
reporter.onGetSession(this.id, this.testName, testRunHandler.runMode);
|
|
47
|
-
const { driver } = seleniumTestPlayer;
|
|
48
|
-
|
|
49
|
-
this.windowUtils = new WindowUtils(this.id, driver);
|
|
50
|
-
seleniumTestPlayer.clearSessionTabs();
|
|
51
|
-
|
|
52
|
-
const { browserValue } = this.testRunConfig;
|
|
53
|
-
const baseUrl = testRunHandler.baseUrl;
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
const fastInit = this.options.useLocalChromeDriver;
|
|
57
|
-
await driver.init(
|
|
58
|
-
this.options,
|
|
59
|
-
this.testName,
|
|
60
|
-
this.testRunConfig,
|
|
61
|
-
gridInfo,
|
|
62
|
-
customExtensionLocalLocation,
|
|
63
|
-
this.executionId,
|
|
64
|
-
this.testResultId,
|
|
65
|
-
testRunHandler.seleniumPerfStats,
|
|
66
|
-
fastInit,
|
|
67
|
-
this.lambdatestService,
|
|
68
|
-
);
|
|
69
|
-
perf.log('in WorkerSelenium after driver.init');
|
|
70
|
-
await seleniumTestPlayer.addTab(undefined, { skipLoadInfo: fastInit });
|
|
71
|
-
perf.log('in WorkerSelenium after addTab');
|
|
72
|
-
if (!fastInit) {
|
|
73
|
-
await this.windowUtils.navigate(baseUrl, NO_NAVIGATION_TIME_LIMIT);
|
|
74
|
-
}
|
|
75
|
-
await this.windowUtils.validatePageIsAvailable();
|
|
76
|
-
perf.log('in WorkerSelenium after navigate');
|
|
77
|
-
} catch (err) {
|
|
78
|
-
const firefoxPageNotAvailable = err.message && (err.message.startsWith('Malformed URL') || err.message.includes('Reached error page: about:neterror')) &&
|
|
79
|
-
browserValue === 'firefox';
|
|
80
|
-
|
|
81
|
-
const invalidURL = (err.message && err.message === 'invalid argument');
|
|
82
|
-
|
|
83
|
-
if (err instanceof PageNotAvailableError || firefoxPageNotAvailable || invalidURL) {
|
|
84
|
-
throw new PageNotAvailableError(`Page '${baseUrl}' is not available`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
logger.error('failed to navigate to page', { err });
|
|
88
|
-
throw err;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @override
|
|
94
|
-
* @param {import('../testRunHandler')} testRunHandler
|
|
95
|
-
* @param {import('../player/seleniumTestPlayer')} seleniumTestPlayer
|
|
96
|
-
*/
|
|
97
|
-
async runTestOnce(testRunHandler, seleniumTestPlayer) {
|
|
98
|
-
const sessionPlayerInit = getSessionPlayer();
|
|
99
|
-
const { driver, sessionPlayer } = seleniumTestPlayer;
|
|
100
|
-
|
|
101
|
-
const version = sessionPlayerInit.manifestVersion || 'runner';
|
|
102
|
-
|
|
103
|
-
reporter.onWaitToTestComplete(this.id, this.isCodeMode);
|
|
104
|
-
|
|
105
|
-
setupCliPerformanceMonitoring(sessionPlayer);
|
|
106
|
-
|
|
107
|
-
sessionPlayer.playbackManager.executionId = testRunHandler.executionId;
|
|
108
|
-
sessionPlayer.playbackManager.executionName = testRunHandler.executionName;
|
|
109
|
-
|
|
110
|
-
sessionPlayer.setLightweightMode(this.options.lightweightMode);
|
|
111
|
-
if (testRunHandler.sfdcCredential) {
|
|
112
|
-
sessionPlayer.setSfdcCredential(testRunHandler.sfdcCredential);
|
|
113
|
-
}
|
|
114
|
-
if (sessionPlayerInit.localAssetService) {
|
|
115
|
-
sessionPlayerInit.localAssetService.initialize({ serverUrl: this.options.localRCASaver });
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let preloadedTest = null;
|
|
119
|
-
if (this.options.lightweightMode?.preloadTests) {
|
|
120
|
-
const preloadedTests = await preloadTests(this.options);
|
|
121
|
-
preloadedTest = preloadedTests[this.testId];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const runSeleniumTest = async () => {
|
|
125
|
-
if (testRunHandler.automationMode === 'codeful') {
|
|
126
|
-
// Testim Development Kit test;
|
|
127
|
-
if (!sessionPlayer.callOrderScheduler) { // old session player
|
|
128
|
-
await testRunHandler.waitForExecutionStartedFinished();
|
|
129
|
-
} else {
|
|
130
|
-
sessionPlayer.callOrderScheduler.schedule(
|
|
131
|
-
() => testRunHandler.waitForExecutionStartedFinished(),
|
|
132
|
-
// this key is shared by clickim and this ensures that we do wait for the execution to be created before we do this.
|
|
133
|
-
{ key: `test-result:${this.userData.projectId}:${this.testResultId}` },
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
perf.log('right before playTestByCode');
|
|
137
|
-
// TODO: Fix promise constructor anti-pattern
|
|
138
|
-
const playTestByCodePromise = new Promise((resolve, reject) => {
|
|
139
|
-
sessionPlayer.playTestByCode(
|
|
140
|
-
this.testId,
|
|
141
|
-
this.executionId,
|
|
142
|
-
this.testResultId,
|
|
143
|
-
this.baseUrl,
|
|
144
|
-
this.userData,
|
|
145
|
-
version,
|
|
146
|
-
resolve,
|
|
147
|
-
false,
|
|
148
|
-
this.overrideTestConfigId,
|
|
149
|
-
this.branch,
|
|
150
|
-
testRunHandler.code,
|
|
151
|
-
testRunHandler.testName,
|
|
152
|
-
).catch(reject);
|
|
153
|
-
});
|
|
154
|
-
return utils
|
|
155
|
-
.promiseTimeout(
|
|
156
|
-
playTestByCodePromise.then((testResult) => {
|
|
157
|
-
perf.log('right after playTestByCode');
|
|
158
|
-
return testResult;
|
|
159
|
-
}),
|
|
160
|
-
this.testRunTimeout,
|
|
161
|
-
timeoutMessages.TEST_COMPLETE_TIMEOUT_MSG,
|
|
162
|
-
)
|
|
163
|
-
.catch(err => {
|
|
164
|
-
if (err instanceof utils.TimeoutError) {
|
|
165
|
-
sessionPlayer.stopPlayingOnTestTimeout?.();
|
|
166
|
-
}
|
|
167
|
-
throw err;
|
|
168
|
-
})
|
|
169
|
-
.then(testResult => {
|
|
170
|
-
testResult.resultId = this.testResultId;
|
|
171
|
-
return testResult;
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
const INCOGNITO = false;
|
|
175
|
-
|
|
176
|
-
return utils.promiseTimeout(
|
|
177
|
-
// TODO: Fix promise constructor anti-pattern
|
|
178
|
-
new Promise((resolve, reject) => {
|
|
179
|
-
sessionPlayer.playByTestId(
|
|
180
|
-
this.testId,
|
|
181
|
-
this.executionId,
|
|
182
|
-
this.testResultId,
|
|
183
|
-
this.baseUrl,
|
|
184
|
-
this.userData,
|
|
185
|
-
version,
|
|
186
|
-
resolve,
|
|
187
|
-
false,
|
|
188
|
-
this.overrideTestConfigId,
|
|
189
|
-
this.branch,
|
|
190
|
-
INCOGNITO,
|
|
191
|
-
testRunHandler.remoteRunId,
|
|
192
|
-
undefined,
|
|
193
|
-
undefined,
|
|
194
|
-
preloadedTest,
|
|
195
|
-
).catch(reject);
|
|
196
|
-
}),
|
|
197
|
-
this.testRunTimeout,
|
|
198
|
-
timeoutMessages.TEST_COMPLETE_TIMEOUT_MSG,
|
|
199
|
-
)
|
|
200
|
-
.catch((err) => {
|
|
201
|
-
if (err instanceof utils.TimeoutError) {
|
|
202
|
-
sessionPlayer.stopPlayingOnTestTimeout?.();
|
|
203
|
-
}
|
|
204
|
-
throw err;
|
|
205
|
-
})
|
|
206
|
-
.then(async (testResult) => {
|
|
207
|
-
if (sessionPlayerInit.localAssetService) {
|
|
208
|
-
await sessionPlayerInit.localAssetService.drain();
|
|
209
|
-
}
|
|
210
|
-
testResult.stepsResults = null;
|
|
211
|
-
testResult.resultId = this.testResultId;
|
|
212
|
-
if (!driver.isAlive()) {
|
|
213
|
-
logger.warn(`possible grid unresponsive for test ${this.testId}, result ${this.testResultId} (execution: ${this.executionId})`);
|
|
214
|
-
testResult.gridIssues = 'could not validate grid is alive';
|
|
215
|
-
}
|
|
216
|
-
const maxKeepAliveGap = driver.maxKeepAliveGap();
|
|
217
|
-
const MAX_KEEP_ALIVE_GAP = 30000;
|
|
218
|
-
if (maxKeepAliveGap >= MAX_KEEP_ALIVE_GAP) {
|
|
219
|
-
logger.warn(`possible browser keep alive issue ${this.testId}, result ${this.testResultId} (execution: ${this.executionId})`);
|
|
220
|
-
testResult.keepAliveIssue = maxKeepAliveGap;
|
|
221
|
-
}
|
|
222
|
-
const resultWithStats = { ...testResult, ...testRunHandler.seleniumPerfStats.getStats() };
|
|
223
|
-
if (this.lambdatestService.isLambdatestRun()) {
|
|
224
|
-
await driver.executeJS(`lambda-status=${!resultWithStats.success ? 'failed' : 'passed'}`).catch(() => {});
|
|
225
|
-
}
|
|
226
|
-
return resultWithStats;
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
driver.start();
|
|
231
|
-
|
|
232
|
-
perf.log('right before super.runTestOnce in workerSelenium');
|
|
233
|
-
try {
|
|
234
|
-
await super.runTestOnce(testRunHandler, seleniumTestPlayer);
|
|
235
|
-
perf.log('right after super.runTestOnce in workerSelenium');
|
|
236
|
-
await runSeleniumTest();
|
|
237
|
-
perf.log('right after runSeleniumTest');
|
|
238
|
-
} catch (err) {
|
|
239
|
-
logger.error('failed to run test once', { err });
|
|
240
|
-
throw err;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function setupCliPerformanceMonitoring(sessionPlayer) {
|
|
245
|
-
const { playback } = getSessionPlayer().commonConstants;
|
|
246
|
-
function monitorEvent(event) {
|
|
247
|
-
sessionPlayer.playbackManager.on(event, () => {
|
|
248
|
-
perf.log(`Got event ${event}`);
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
Object.values(playback).forEach(monitorEvent);
|
|
252
|
-
}
|
|
253
|
-
module.exports = WorkerSelenium;
|
package/workers/workerUtils.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const gridService = require('../services/gridService');
|
|
2
|
-
const logger = require('../commons/logger').getLogger('worker-utils');
|
|
3
|
-
|
|
4
|
-
const releaseGridSlot = async (workerId, releaseSlotOnTestFinished, projectId) => {
|
|
5
|
-
if (!releaseSlotOnTestFinished) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
await gridService.releaseGridSlot(workerId, projectId);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const releasePlayer = async (workerId, releaseSlotOnTestFinished, projectId, player) => {
|
|
12
|
-
logger.info('releasing player', { hasPlayer: Boolean(player) });
|
|
13
|
-
try {
|
|
14
|
-
await player?.onDone();
|
|
15
|
-
} finally {
|
|
16
|
-
await releaseGridSlot(workerId, releaseSlotOnTestFinished, projectId);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
module.exports.releasePlayer = releasePlayer;
|