@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,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { extractElementId } = require('../../utils');
|
|
4
|
-
const StepAction = require('./stepAction');
|
|
5
|
-
|
|
6
|
-
const keyMap = {
|
|
7
|
-
8: '\uE008', // (Backspace)
|
|
8
|
-
9: '\uE004', // (tab)
|
|
9
|
-
13: '\uE007', // (enter)
|
|
10
|
-
27: '\uE00C', // (esc)
|
|
11
|
-
33: '\uE00E', // (page up)
|
|
12
|
-
34: '\uE00F', // (page down)
|
|
13
|
-
35: '\uE010', // (end)
|
|
14
|
-
36: '\uE011', // (home)
|
|
15
|
-
45: '\uE016', // (insert)
|
|
16
|
-
112: '\uE031', // (f1)
|
|
17
|
-
113: '\uE032', // (f2)
|
|
18
|
-
114: '\uE033', // (f3)
|
|
19
|
-
115: '\uE034', // (f4)
|
|
20
|
-
116: '\uE035', // (f5)
|
|
21
|
-
117: '\uE036', // (f6)
|
|
22
|
-
118: '\uE037', // (f7)
|
|
23
|
-
119: '\uE038', // (f8)
|
|
24
|
-
120: '\uE039', // (f9)
|
|
25
|
-
121: '\uE03A', // (f10)
|
|
26
|
-
122: '\uE03B', // (f11)
|
|
27
|
-
123: '\uE03C', // (f12)
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
class SpecialKeyStepAction extends StepAction {
|
|
31
|
-
setWithValueApi(keys) {
|
|
32
|
-
const target = this.getTarget();
|
|
33
|
-
if (target?.seleniumElement) {
|
|
34
|
-
return this.driver.elementIdValue(extractElementId(target.seleniumElement), keys);
|
|
35
|
-
}
|
|
36
|
-
return Promise.reject(new Error('missing selenium element'));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
performAction() {
|
|
40
|
-
const keys = [];
|
|
41
|
-
const keyCode = this.step.events[0].eventData.keyCode;
|
|
42
|
-
|
|
43
|
-
if (keyCode >= 32 && keyCode <= 127) {
|
|
44
|
-
keys.push(String.fromCharCode(keyCode));
|
|
45
|
-
} else {
|
|
46
|
-
keys.push(keyMap[keyCode]);
|
|
47
|
-
}
|
|
48
|
-
return this.setWithValueApi(keys);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
module.exports = SpecialKeyStepAction;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { getSessionPlayer } = require('../../commons/getSessionPlayerRequire');
|
|
4
|
-
|
|
5
|
-
/** @typedef {typeof import('clickim/src/background/stepActions/stepAction').StepAction} ClickimStepActionCtor */
|
|
6
|
-
/** @typedef {ConstructorParameters<ClickimStepActionCtor>} ClickimStepActionCtorParams */
|
|
7
|
-
/** @typedef {InstanceType<ClickimStepActionCtor>} ClickimStepAction */
|
|
8
|
-
|
|
9
|
-
class StepAction {
|
|
10
|
-
/** @type {(...args: ClickimStepActionCtorParams) => this} */
|
|
11
|
-
constructor(
|
|
12
|
-
step,
|
|
13
|
-
context,
|
|
14
|
-
frameHandler,
|
|
15
|
-
exportsGlobal = {},
|
|
16
|
-
stepActionUtils = undefined,
|
|
17
|
-
locateElementPlayer = undefined,
|
|
18
|
-
exportsTest = {},
|
|
19
|
-
) {
|
|
20
|
-
this.step = step;
|
|
21
|
-
this.context = context;
|
|
22
|
-
this.frameHandler = frameHandler;
|
|
23
|
-
this.frameId = 0;
|
|
24
|
-
/** @type {import('../utils/stepActionUtils'))} */
|
|
25
|
-
this.stepActionUtils = stepActionUtils;
|
|
26
|
-
this.locateElementPlayer = locateElementPlayer;
|
|
27
|
-
this.exportsGlobal = exportsGlobal;
|
|
28
|
-
this.exportsTest = exportsTest;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
get driver() {
|
|
32
|
-
return this.stepActionUtils.driver;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @protected */
|
|
36
|
-
get sessionPlayerInit() {
|
|
37
|
-
return getSessionPlayer();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async performAction() {
|
|
41
|
-
throw new Error('not implemented');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getTarget() {
|
|
45
|
-
const targetId = this.step.targetId || 'targetId';
|
|
46
|
-
return this.context.data[targetId];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** @type {ClickimStepAction['execute']} */
|
|
50
|
-
async execute(stepActionFactory, step) {
|
|
51
|
-
try {
|
|
52
|
-
const res = await this.performAction(stepActionFactory, step);
|
|
53
|
-
return { success: true, ...res };
|
|
54
|
-
} catch (err) {
|
|
55
|
-
const errorMsg = err?.message || err?.seleniumStack?.message;
|
|
56
|
-
const displayMsg = err?.displayMessage;
|
|
57
|
-
return {
|
|
58
|
-
success: false,
|
|
59
|
-
reason: errorMsg,
|
|
60
|
-
exception: err,
|
|
61
|
-
errorType: this.sessionPlayerInit.commonConstants.stepResult.ACTION_EXCEPTION,
|
|
62
|
-
resultInfo: {
|
|
63
|
-
exception: `selenium exception: ${errorMsg}`,
|
|
64
|
-
// clickim -> playbackStepResultHandler.js -> FAILURE_REASON_MAPPING -> ACTION_EXCEPTION
|
|
65
|
-
// expects resultInfo.error or resultInfo.reason
|
|
66
|
-
error: displayMsg || errorMsg,
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
module.exports = StepAction;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
const LocateStepAction = require('./locateStepAction');
|
|
6
|
-
const ScrollStepAction = require('./scrollStepAction');
|
|
7
|
-
const MouseStepAction = require('./mouseStepAction');
|
|
8
|
-
const TextValidationStepAction = require('./textValidationStepAction');
|
|
9
|
-
const EvaluateExpressionStepAction = require('./evaluateExpressionStepAction');
|
|
10
|
-
const TextStepAction = require('./textStepAction');
|
|
11
|
-
const JsCodeStepAction = require('./jsCodeStepAction');
|
|
12
|
-
const JsConditionStepAction = require('./jsConditionStepAction');
|
|
13
|
-
const SpecialKeyStepAction = require('./specialKeyStepAction');
|
|
14
|
-
const SelectOptionStepAction = require('./selectOptionStepAction');
|
|
15
|
-
const SubmitStepAction = require('./submitStepAction');
|
|
16
|
-
const HoverStepAction = require('./hoverStepAction');
|
|
17
|
-
const WheelStepAction = require('./wheelStepAction');
|
|
18
|
-
const DropFileStepAction = require('./dropFileStepAction');
|
|
19
|
-
const InputFileStepAction = require('./inputFileStepAction');
|
|
20
|
-
const NavigationStepAction = require('./navigationStepAction');
|
|
21
|
-
const SleepStepAction = require('./sleepStepAction');
|
|
22
|
-
const RefreshStepAction = require('./RefreshStepAction');
|
|
23
|
-
const ApiStepAction = require('./apiStepAction');
|
|
24
|
-
const ExtractTextStepAction = require('./extractTextStepAction');
|
|
25
|
-
const TdkHybridStepAction = require('./tdkHybridStepAction');
|
|
26
|
-
const PixelValidationStepAction = require('./pixelValidationStepAction');
|
|
27
|
-
const CliJsStepAction = require('./cliJsStepAction');
|
|
28
|
-
const CliConditionStepAction = require('./cliConditionStepAction');
|
|
29
|
-
const NodePackageStepAction = require('./nodePackageStepAction');
|
|
30
|
-
const ExtensionOnlyStepAction = require('./extensionOnlyStepAction');
|
|
31
|
-
const SfdcStepAction = require('./sfdcStepAction');
|
|
32
|
-
const SfdcRecordedStepAction = require('./sfdcRecordedStepAction');
|
|
33
|
-
|
|
34
|
-
function register(stepActionByType, stepActionFactory) {
|
|
35
|
-
Object.keys(stepActionByType).forEach(type => {
|
|
36
|
-
stepActionFactory.registerStepAction(type, stepActionByType[type]);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const STEP_ACTION_MAPPING = {
|
|
41
|
-
locate: LocateStepAction,
|
|
42
|
-
scroll: ScrollStepAction,
|
|
43
|
-
mouse: MouseStepAction,
|
|
44
|
-
submit: SubmitStepAction,
|
|
45
|
-
text: TextStepAction,
|
|
46
|
-
'special-key': SpecialKeyStepAction,
|
|
47
|
-
'user-code': JsCodeStepAction,
|
|
48
|
-
'validation-code-step': JsCodeStepAction,
|
|
49
|
-
'wait-for-code-step': JsCodeStepAction,
|
|
50
|
-
'action-code-step': JsCodeStepAction,
|
|
51
|
-
'condition-step': JsConditionStepAction,
|
|
52
|
-
'skip-code-step': JsConditionStepAction,
|
|
53
|
-
'element-code-step': JsConditionStepAction,
|
|
54
|
-
'evaluate-expression': EvaluateExpressionStepAction,
|
|
55
|
-
'text-validation': TextValidationStepAction,
|
|
56
|
-
'wait-for-text-validation': TextValidationStepAction,
|
|
57
|
-
'select-option': SelectOptionStepAction,
|
|
58
|
-
'drop-file': DropFileStepAction,
|
|
59
|
-
'input-file': InputFileStepAction,
|
|
60
|
-
hover: HoverStepAction,
|
|
61
|
-
navigation: NavigationStepAction,
|
|
62
|
-
wheel: WheelStepAction,
|
|
63
|
-
sleep: SleepStepAction,
|
|
64
|
-
refresh: RefreshStepAction,
|
|
65
|
-
'api-validation': ApiStepAction,
|
|
66
|
-
'api-action': ApiStepAction,
|
|
67
|
-
'api-code-step': JsCodeStepAction,
|
|
68
|
-
'extract-text': ExtractTextStepAction,
|
|
69
|
-
'simple-ui-verification': PixelValidationStepAction,
|
|
70
|
-
'wait-for-simple-ui-verification': PixelValidationStepAction,
|
|
71
|
-
|
|
72
|
-
'cli-validation-download-file': ExtensionOnlyStepAction,
|
|
73
|
-
'cli-wait-for-download-file': ExtensionOnlyStepAction,
|
|
74
|
-
'network-validation-step': ExtensionOnlyStepAction,
|
|
75
|
-
|
|
76
|
-
'cli-validation-code-step': CliJsStepAction,
|
|
77
|
-
'cli-wait-for-code-step': CliJsStepAction,
|
|
78
|
-
'cli-action-code-step': CliJsStepAction,
|
|
79
|
-
'cli-api-code-step': CliJsStepAction,
|
|
80
|
-
|
|
81
|
-
'cli-condition-step': CliConditionStepAction,
|
|
82
|
-
'node-package': NodePackageStepAction,
|
|
83
|
-
|
|
84
|
-
'email-code-step': JsCodeStepAction,
|
|
85
|
-
'cli-email-code-step': CliJsStepAction,
|
|
86
|
-
'tdk-hybrid': TdkHybridStepAction,
|
|
87
|
-
|
|
88
|
-
'sfdc-recorded-step': SfdcRecordedStepAction,
|
|
89
|
-
'sfdc-step-login': SfdcStepAction,
|
|
90
|
-
'sfdc-step-logout': SfdcStepAction,
|
|
91
|
-
'sfdc-step-sobjectcreate': SfdcStepAction,
|
|
92
|
-
'sfdc-step-sobjectdelete': SfdcStepAction,
|
|
93
|
-
'sfdc-step-findrecord': SfdcStepAction,
|
|
94
|
-
'sfdc-step-quickaction': SfdcStepAction,
|
|
95
|
-
'sfdc-step-sobjectedit': SfdcStepAction,
|
|
96
|
-
'sfdc-step-sobjectvalidate': SfdcStepAction,
|
|
97
|
-
'sfdc-step-launchapp': SfdcStepAction,
|
|
98
|
-
'sfdc-step-closeconsoletabs': SfdcStepAction,
|
|
99
|
-
'sfdc-step-relatedlistaction': SfdcStepAction,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* @param {import('../webdriver')} driver
|
|
104
|
-
* @param {import('clickim/src/background/stepActions/stepActionFactory').StepActionFactory} stepActionFactory
|
|
105
|
-
*/
|
|
106
|
-
module.exports = function (driver, stepActionFactory, runMode) {
|
|
107
|
-
register(STEP_ACTION_MAPPING, stepActionFactory);
|
|
108
|
-
if (stepActionFactory.registerLocateStepActionUtils) {
|
|
109
|
-
stepActionFactory.registerLocateStepActionUtils(LocateStepAction.getUtils(driver));
|
|
110
|
-
}
|
|
111
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const StepAction = require('./stepAction');
|
|
4
|
-
const { execute } = require('../../stepPlayers/hybridStepPlayback');
|
|
5
|
-
|
|
6
|
-
class TdkHybridStepAction extends StepAction {
|
|
7
|
-
async performAction() {
|
|
8
|
-
return await execute(
|
|
9
|
-
this.step,
|
|
10
|
-
this.context,
|
|
11
|
-
this.driver,
|
|
12
|
-
this.stepActionUtils.testimServicesApi.authenticationManager.getLoggedUserInfo(),
|
|
13
|
-
this.frameHandler.frameManager
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
module.exports = TdkHybridStepAction;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const StepAction = require('./stepAction');
|
|
4
|
-
const setTextScript = require('./scripts/setText');
|
|
5
|
-
const dispatchFocus = require('./scripts/focusElement');
|
|
6
|
-
const { extractElementId, delay } = require('../../utils');
|
|
7
|
-
|
|
8
|
-
class TextStepAction extends StepAction {
|
|
9
|
-
async setValueNative() {
|
|
10
|
-
const context = this.context;
|
|
11
|
-
const target = this.getTarget();
|
|
12
|
-
if (!this.step.delayBetweenChars) {
|
|
13
|
-
return this.driver.setValue(target.seleniumElement, context.stepText);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
await this.driver.elementIdClear(extractElementId(target.seleniumElement));
|
|
17
|
-
return await this.setTextDelayed();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async setValueJS() {
|
|
21
|
-
const step = this.step;
|
|
22
|
-
const context = this.context;
|
|
23
|
-
const target = context.data[step.targetId || 'targetId'];
|
|
24
|
-
const timeout = context.data.timeToPlayStep + 3000;
|
|
25
|
-
const events = step.events;
|
|
26
|
-
|
|
27
|
-
const { setTextDraftJs } = this.sessionPlayerInit.codeSnippets;
|
|
28
|
-
if (target.isDraftEditor && setTextDraftJs) {
|
|
29
|
-
return this.driver.executeJS(setTextDraftJs(target.locatedElement, context.stepText));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (!events?.length) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const eventMessage = {
|
|
37
|
-
eventType: step.type,
|
|
38
|
-
events,
|
|
39
|
-
quirks: step.quirks,
|
|
40
|
-
locatedElement: target.locatedElement,
|
|
41
|
-
isRoot: target.isRoot,
|
|
42
|
-
elementToFocusLocatedElement: target.elementToFocusLocatedElement,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const setTextCode = `
|
|
46
|
-
var getLocatedElement = ${this.sessionPlayerInit.codeSnippets.getLocatedElementCode};
|
|
47
|
-
var dispatchFocus = ${dispatchFocus};
|
|
48
|
-
var setText = ${setTextScript.toString()};
|
|
49
|
-
var eventData = arguments[0];
|
|
50
|
-
var done = arguments[1];
|
|
51
|
-
return setText.call(null, eventData, done);
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
const result = await this.driver.executeCodeAsync(setTextCode, timeout, eventMessage);
|
|
55
|
-
return { success: Boolean(result.value?.success) };
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async setTextDelayed() {
|
|
59
|
-
const letters = this.context.stepText;
|
|
60
|
-
const target = this.getTarget();
|
|
61
|
-
for (let i = 0; i < letters.length; i++) {
|
|
62
|
-
await this.driver.elementIdValue(extractElementId(target.seleniumElement), letters[i]);
|
|
63
|
-
// don't delay on last step.
|
|
64
|
-
if (i < letters.length - 1) {
|
|
65
|
-
await delay(this.step.delayBetweenChars);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async setValueAppendNative() {
|
|
71
|
-
const keys = [];
|
|
72
|
-
const context = this.context;
|
|
73
|
-
const target = this.getTarget();
|
|
74
|
-
|
|
75
|
-
if (target?.seleniumElement) {
|
|
76
|
-
if (!this.step.delayBetweenChars) {
|
|
77
|
-
keys.push(Array.from(context.stepText));
|
|
78
|
-
return this.driver.elementIdValue(extractElementId(target.seleniumElement), keys);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return this.setTextDelayed();
|
|
82
|
-
}
|
|
83
|
-
throw new Error('missing selenium element');
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async performAction() {
|
|
87
|
-
const target = this.getTarget();
|
|
88
|
-
const forceJsEvent = this.driver.isSafari() &&
|
|
89
|
-
target.locatedElement && target.locatedElement.shadowPath &&
|
|
90
|
-
Array.isArray(target.locatedElement.shadowPath) && target.locatedElement.shadowPath.length > 1;
|
|
91
|
-
|
|
92
|
-
if (this.step.appendText) {
|
|
93
|
-
if (this.step.nativeEvents) {
|
|
94
|
-
return this.setValueAppendNative();
|
|
95
|
-
}
|
|
96
|
-
const { stepResult } = this.sessionPlayerInit.commonConstants;
|
|
97
|
-
return {
|
|
98
|
-
success: false,
|
|
99
|
-
errorType: stepResult.TEXT_ACTION_FAILURE,
|
|
100
|
-
resultInfo: { error: "'Append Text' is only supported in Native Mode" },
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
if (this.step.nativeEvents && !forceJsEvent) {
|
|
104
|
-
return this.setValueNative();
|
|
105
|
-
}
|
|
106
|
-
return this.setValueJS();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
module.exports = TextStepAction;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const StepAction = require('./stepAction');
|
|
4
|
-
|
|
5
|
-
class TextValidationStepAction extends StepAction {
|
|
6
|
-
async performAction(stepActionFactory) {
|
|
7
|
-
const { step, context, frameHandler, sessionPlayerInit: { paramEvaluator, utils, commonConstants } } = this;
|
|
8
|
-
const target = this.getTarget();
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
const text = await this.stepActionUtils.extractTargetText(target);
|
|
12
|
-
let actual;
|
|
13
|
-
let expected;
|
|
14
|
-
if (paramEvaluator) {
|
|
15
|
-
const evaluation = paramEvaluator.computeExpression(
|
|
16
|
-
step.expression2,
|
|
17
|
-
context,
|
|
18
|
-
this.exportsGlobal,
|
|
19
|
-
this.exportsTest,
|
|
20
|
-
);
|
|
21
|
-
actual = text;
|
|
22
|
-
expected = evaluation.evaluatedText;
|
|
23
|
-
} else {
|
|
24
|
-
const res = await stepActionFactory.executeStep(
|
|
25
|
-
step.expression2,
|
|
26
|
-
context,
|
|
27
|
-
frameHandler,
|
|
28
|
-
this.exportsGlobal,
|
|
29
|
-
this.locateElementPlayer,
|
|
30
|
-
this.exportsTest,
|
|
31
|
-
);
|
|
32
|
-
actual = text;
|
|
33
|
-
expected = res.evaluatedText;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
const compareResult = utils.compareOrMatch(expected, actual);
|
|
37
|
-
if (compareResult) {
|
|
38
|
-
return { success: true };
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
success: false,
|
|
42
|
-
errorType: commonConstants.stepResult.TEXT_COMPARE_FAILURE,
|
|
43
|
-
resultInfo: { expected: String(expected), actual },
|
|
44
|
-
};
|
|
45
|
-
} catch (err) {
|
|
46
|
-
return {
|
|
47
|
-
success: false,
|
|
48
|
-
errorType: commonConstants.stepResult.TEXT_COMPARE_FAILURE,
|
|
49
|
-
resultInfo: { expected: expected.toString(), actual },
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
} catch (err) {
|
|
53
|
-
return {
|
|
54
|
-
success: false,
|
|
55
|
-
reason: err.message,
|
|
56
|
-
exception: err,
|
|
57
|
-
shouldRetry: true,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
module.exports = TextValidationStepAction;
|
|
64
|
-
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const StepAction = require('./stepAction');
|
|
4
|
-
const wheelScript = require('./scripts/wheel');
|
|
5
|
-
|
|
6
|
-
class WheelStepAction extends StepAction {
|
|
7
|
-
async performAction() {
|
|
8
|
-
const step = this.step;
|
|
9
|
-
const context = this.context;
|
|
10
|
-
const events = step.events;
|
|
11
|
-
|
|
12
|
-
if (!events?.length) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const eventMessage = {
|
|
17
|
-
events,
|
|
18
|
-
eventData: {
|
|
19
|
-
modifiers: step.modifiers,
|
|
20
|
-
button: step.button,
|
|
21
|
-
},
|
|
22
|
-
locatedElement: this.getTarget().locatedElement,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const timeout = context.data.timeToPlayStep + 3000;
|
|
26
|
-
|
|
27
|
-
const wheelCode = `
|
|
28
|
-
var getLocatedElement = ${this.sessionPlayerInit.codeSnippets.getLocatedElementCode};
|
|
29
|
-
var wheel = ${wheelScript.toString()};
|
|
30
|
-
var eventData = arguments[0];
|
|
31
|
-
var done = arguments[1];
|
|
32
|
-
return wheel.call(null, eventData, done);
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
const result = await this.driver.executeCodeAsync(wheelCode, timeout, eventMessage);
|
|
36
|
-
return { success: result.value?.state === 'success' };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
module.exports = WheelStepAction;
|
|
41
|
-
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const logger = require('../../commons/logger').getLogger('cookies-utils');
|
|
4
|
-
|
|
5
|
-
module.exports = function (driver) {
|
|
6
|
-
class CookieUtils {
|
|
7
|
-
set(cookie) {
|
|
8
|
-
let domain = cookie.domain;
|
|
9
|
-
if(!cookie.hostOnly) {
|
|
10
|
-
if (domain && !domain.startsWith('.')) {
|
|
11
|
-
domain = `.${domain}`;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return driver.setCookie(cookie.name, cookie.value, domain, cookie.httpOnly, cookie.secure, cookie.path, cookie.expirationDate)
|
|
15
|
-
.catch(err => {
|
|
16
|
-
logger.error("failed to set cookie", {err});
|
|
17
|
-
throw err;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
get(cookie) {
|
|
22
|
-
return driver.getCookie(cookie.name)
|
|
23
|
-
.catch(err => {
|
|
24
|
-
logger.error("failed to get cookie", {err});
|
|
25
|
-
throw err;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
remove(cookie) {
|
|
30
|
-
return driver.deleteCookie(cookie.name)
|
|
31
|
-
.catch(err => {
|
|
32
|
-
logger.error("failed to remove cookie", {err});
|
|
33
|
-
throw err;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return new CookieUtils();
|
|
39
|
-
};
|