@testim/testim-cli 3.288.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 -9
- 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,370 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
const _ = require('lodash');
|
|
4
|
-
const StepAction = require('./stepAction');
|
|
5
|
-
const doClickScript = require('./scripts/doClick');
|
|
6
|
-
const dispatchFocus = require('./scripts/focusElement');
|
|
7
|
-
const doDragPathScript = require('./scripts/doDragPath');
|
|
8
|
-
const html5dndAction = require('./scripts/html5dragAction');
|
|
9
|
-
const html5dndActionV2 = require('./scripts/html5dragActionV2');
|
|
10
|
-
const featureFlagService = require('../../commons/featureFlags');
|
|
11
|
-
|
|
12
|
-
class MouseStepAction extends StepAction {
|
|
13
|
-
getDnDRectsAndOffsets(target, destTarget, clickOffset, toClickOffset) {
|
|
14
|
-
const fromOffsets = this.stepActionUtils.getClickOffset(clickOffset, target.rectWithoutFrameOffset);
|
|
15
|
-
const toOffsets = this.stepActionUtils.getClickOffset(toClickOffset, destTarget.rectWithoutFrameOffset);
|
|
16
|
-
return {
|
|
17
|
-
fromRect: target.rectWithoutFrameOffset,
|
|
18
|
-
fromX: fromOffsets.xOffset,
|
|
19
|
-
fromY: fromOffsets.yOffset,
|
|
20
|
-
toRect: destTarget.rectWithoutFrameOffset,
|
|
21
|
-
toX: toOffsets.xOffset,
|
|
22
|
-
toY: toOffsets.yOffset,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async clickJs() {
|
|
27
|
-
const step = this.step;
|
|
28
|
-
const context = this.context;
|
|
29
|
-
const target = context.data[step.targetId || 'targetId'];
|
|
30
|
-
const timeout = context.data.timeToPlayStep + 3000;
|
|
31
|
-
const events = step.events;
|
|
32
|
-
|
|
33
|
-
if (!events?.length) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const eventMessage = {
|
|
38
|
-
isRoot: target.isRoot,
|
|
39
|
-
locatedElement: target.locatedElement,
|
|
40
|
-
events,
|
|
41
|
-
quirks: step.quirks,
|
|
42
|
-
modifiers: step.modifiers,
|
|
43
|
-
button: step.button,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const doClickCode = `
|
|
47
|
-
var getLocatedElement = ${this.sessionPlayerInit.codeSnippets.getLocatedElementCode};
|
|
48
|
-
var dispatchFocus = ${dispatchFocus.toString()};
|
|
49
|
-
var doClick = ${doClickScript.toString()};
|
|
50
|
-
var eventData = arguments[0];
|
|
51
|
-
var done = arguments[1];
|
|
52
|
-
return doClick.call(null, eventData, done);
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
const result = await this.driver.executeCodeAsync(doClickCode, timeout, eventMessage);
|
|
58
|
-
if (result.value?.success) {
|
|
59
|
-
return { success: true };
|
|
60
|
-
}
|
|
61
|
-
return { success: false };
|
|
62
|
-
} catch (err) {
|
|
63
|
-
return {
|
|
64
|
-
success: false,
|
|
65
|
-
reason: err.message,
|
|
66
|
-
exception: err,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
isWithinBounds(start, end, point) {
|
|
72
|
-
return (point > start) && (point < end);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
getEventSequenceOffset() {
|
|
76
|
-
const initialPosition = this.step.events[0]?.pointerPosition;
|
|
77
|
-
if (!initialPosition) {
|
|
78
|
-
return { xOffset: 0, yOffset: 0 };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const target = this.context.data[this.step.targetId || 'targetId'];
|
|
82
|
-
const targetElementRect = target.rectWithoutFrameOffset;
|
|
83
|
-
const isXWithinBounds = this.isWithinBounds(targetElementRect.left, targetElementRect.left + targetElementRect.width, initialPosition.originX);
|
|
84
|
-
const isYWithinBounds = this.isWithinBounds(targetElementRect.top, targetElementRect.top + targetElementRect.height, initialPosition.originY);
|
|
85
|
-
const xOffset = isXWithinBounds ? 0 : targetElementRect.left + targetElementRect.width / 2 - initialPosition.originX;
|
|
86
|
-
const yOffset = isYWithinBounds ? 0 : targetElementRect.top + targetElementRect.height / 2 - initialPosition.originY;
|
|
87
|
-
return { xOffset, yOffset };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
addOffsetToEvents(offsetFromElement) {
|
|
91
|
-
this.step.events.forEach(event => {
|
|
92
|
-
if (event?.pointerPosition) {
|
|
93
|
-
event.pointerPosition.originX += offsetFromElement.xOffset;
|
|
94
|
-
event.pointerPosition.originY += offsetFromElement.yOffset;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
generateEventOfType(baseEvent, type) {
|
|
100
|
-
const cloneEvent = _.cloneDeep(baseEvent);
|
|
101
|
-
cloneEvent.event = type;
|
|
102
|
-
return cloneEvent;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
fixAbsoluteDragEventSequence() {
|
|
106
|
-
const downEvent = this.step.events.find(event => ['mousedown', 'pointerdown'].includes(event.event));
|
|
107
|
-
if (downEvent) {
|
|
108
|
-
const mousedownEventIndex = this.step.events.indexOf(downEvent);
|
|
109
|
-
this.step.events.splice(mousedownEventIndex, 0, this.generateEventOfType(downEvent, 'mouseover'));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const { recordPointerMoveEvents = false } = this.context.project.defaults || {};
|
|
113
|
-
const mouseUpEvent = this.step.events.find(event => event.event === 'mouseup') || (recordPointerMoveEvents && this.step.events.find(event => event.event === 'pointerup'));
|
|
114
|
-
const lastMouseMoveEventIndex =
|
|
115
|
-
_.findLastIndex(this.step.events, event => event.event === 'mousemove') ||
|
|
116
|
-
(recordPointerMoveEvents && _.findLastIndex(this.step.events, event => event.event === 'pointermove'));
|
|
117
|
-
if (mouseUpEvent && lastMouseMoveEventIndex > 0 && !this.step.allEventsOnSameElement) {
|
|
118
|
-
this.step.events.splice(lastMouseMoveEventIndex + 1, 0, this.generateEventOfType(mouseUpEvent, 'mouseover'));
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (this.step.isHTML5Drag && !this.step.toElement) {
|
|
122
|
-
this.step.events = this.addDragendIfNeeded(this.step.events);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
this.addOffsetToEvents(this.getEventSequenceOffset());
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
async dragPathJs() {
|
|
129
|
-
const step = this.step;
|
|
130
|
-
const context = this.context;
|
|
131
|
-
const target = context.data[step.targetId || 'targetId'];
|
|
132
|
-
const timeout = context.data.timeToPlayStep + 3000;
|
|
133
|
-
|
|
134
|
-
if (!this.step.events?.length) {
|
|
135
|
-
return undefined;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
this.fixAbsoluteDragEventSequence();
|
|
139
|
-
|
|
140
|
-
const events = step.events;
|
|
141
|
-
|
|
142
|
-
const eventMessage = {
|
|
143
|
-
isRoot: target.isRoot,
|
|
144
|
-
locatedElement: target.locatedElement,
|
|
145
|
-
events,
|
|
146
|
-
quirks: step.quirks,
|
|
147
|
-
modifiers: step.modifiers,
|
|
148
|
-
button: step.button,
|
|
149
|
-
isDrag: true,
|
|
150
|
-
allEventsOnSameElement: step.allEventsOnSameElement,
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const doDragPathCode = `
|
|
154
|
-
var getLocatedElement = ${this.sessionPlayerInit.codeSnippets.getLocatedElementCode};
|
|
155
|
-
var dispatchFocus = ${dispatchFocus.toString()};
|
|
156
|
-
var doDragPath = ${doDragPathScript.toString()};
|
|
157
|
-
return doDragPath.apply(null, arguments);
|
|
158
|
-
`;
|
|
159
|
-
|
|
160
|
-
try {
|
|
161
|
-
const result = await this.driver.executeCodeAsync(doDragPathCode, timeout, eventMessage);
|
|
162
|
-
if (result.value?.success) {
|
|
163
|
-
return { success: true };
|
|
164
|
-
}
|
|
165
|
-
return { success: false };
|
|
166
|
-
} catch (err) {
|
|
167
|
-
return {
|
|
168
|
-
success: false,
|
|
169
|
-
reason: err.message,
|
|
170
|
-
exception: err,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
chooseAndRunAction() {
|
|
176
|
-
const target = this.getTarget();
|
|
177
|
-
const { locatedElement, seleniumElement, rectWithoutFrameOffset, rect } = target;
|
|
178
|
-
const { xOffset, yOffset } = this.stepActionUtils.getClickOffset(this.step.element.clickOffset, rectWithoutFrameOffset);
|
|
179
|
-
|
|
180
|
-
// used for fallback native click
|
|
181
|
-
const offsets = {
|
|
182
|
-
frameOffset: {
|
|
183
|
-
x: rect.left - rectWithoutFrameOffset.left,
|
|
184
|
-
y: rect.top - rectWithoutFrameOffset.top,
|
|
185
|
-
},
|
|
186
|
-
rect: rectWithoutFrameOffset,
|
|
187
|
-
clickOffset: { x: xOffset, y: yOffset },
|
|
188
|
-
};
|
|
189
|
-
// will skip left click and double click on Edge.
|
|
190
|
-
const skipFileInputClick =
|
|
191
|
-
featureFlagService.flags.skipFileInputClicks.isEnabled() &&
|
|
192
|
-
target.tagName === 'INPUT' &&
|
|
193
|
-
(target.elementSymbol.includes('type="file"') ||
|
|
194
|
-
target.elementSymbol.includes('type=\'file\'') ||
|
|
195
|
-
target.elementSymbol.includes('type=file'));
|
|
196
|
-
|
|
197
|
-
if (skipFileInputClick) {
|
|
198
|
-
return Promise.resolve({
|
|
199
|
-
keep: true,
|
|
200
|
-
success: 'skipped',
|
|
201
|
-
reason: 'Clicking on input type=file is disabled',
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (this.step.isDoubleClick) {
|
|
206
|
-
const eventData = {
|
|
207
|
-
elementToFocusLocatedElement: target.elementToFocusLocatedElement,
|
|
208
|
-
locatedElement,
|
|
209
|
-
events: this.step.events,
|
|
210
|
-
timeout: this.context.data.timeToPlayStep + 3000,
|
|
211
|
-
};
|
|
212
|
-
return this.driver.doubleClick(seleniumElement, eventData, offsets);
|
|
213
|
-
}
|
|
214
|
-
if (this.step.isDrag) {
|
|
215
|
-
if (this.step.toElement) {
|
|
216
|
-
const destTarget = this.context.data.toElement;
|
|
217
|
-
if (this.step.isHTML5Drag) {
|
|
218
|
-
if (featureFlagService.flags.usePortedHtml5DragDrop.isEnabled()) {
|
|
219
|
-
const events = this.generateHTML5DragEventSequence();
|
|
220
|
-
const timeout = this.context.data.timeToPlayStep + 3000;
|
|
221
|
-
const contextTarget = this.context.data[this.step.targetId || 'targetId'];
|
|
222
|
-
const eventMessage = {
|
|
223
|
-
transactionId: `${this.context.testResultId}:${this.step.id}`,
|
|
224
|
-
id: this.step.id,
|
|
225
|
-
testResultId: this.context.testResultId,
|
|
226
|
-
eventType: this.step.type,
|
|
227
|
-
events,
|
|
228
|
-
eventData: {
|
|
229
|
-
modifiers: this.step.modifiers,
|
|
230
|
-
button: this.step.button,
|
|
231
|
-
},
|
|
232
|
-
quirks: this.step.quirks,
|
|
233
|
-
isDrag: this.step.isDrag,
|
|
234
|
-
useRecordedMousedown: this.step.useRecordedMousedown,
|
|
235
|
-
allEventsOnSameElement: this.step.allEventsOnSameElement,
|
|
236
|
-
elementToFocusLocatedElement: contextTarget.elementToFocusLocatedElement,
|
|
237
|
-
trackActiveElement: this.step.trackActiveElement,
|
|
238
|
-
locatedElement: contextTarget.locatedElement,
|
|
239
|
-
isRoot: contextTarget.isRoot,
|
|
240
|
-
};
|
|
241
|
-
const html5DNDCode = `
|
|
242
|
-
var getLocatedElement = ${this.sessionPlayerInit.codeSnippets.getLocatedElementCode};
|
|
243
|
-
var dnd = ${html5dndActionV2.toString()};
|
|
244
|
-
var eventData = arguments[0];
|
|
245
|
-
var done = arguments[1];
|
|
246
|
-
return dnd.call(null, eventData, done);
|
|
247
|
-
`;
|
|
248
|
-
return this.driver.executeCodeAsync(html5DNDCode, timeout, eventMessage);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const html5DNDCode = `
|
|
252
|
-
var getLocatedElement = ${this.sessionPlayerInit.codeSnippets.getLocatedElementCode};
|
|
253
|
-
var dnd = ${html5dndAction.toString()};
|
|
254
|
-
var eventData = arguments[0];
|
|
255
|
-
return dnd.call(null, eventData);
|
|
256
|
-
`;
|
|
257
|
-
|
|
258
|
-
const eventMessage = { fromLocatedElement: locatedElement, toLocatedElement: destTarget.locatedElement };
|
|
259
|
-
return this.driver.executeJS(html5DNDCode, eventMessage);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
const rectsAndOffsets = this.getDnDRectsAndOffsets(target, destTarget, this.step.element.clickOffset, this.step.toElement.clickOffset);
|
|
263
|
-
return this.driver.dragAndDrop(seleniumElement, destTarget.seleniumElement, rectsAndOffsets);
|
|
264
|
-
}
|
|
265
|
-
return this.dragPathJs();
|
|
266
|
-
|
|
267
|
-
// This is the old way, which uses selenium action (AKA "native" drag).
|
|
268
|
-
// return this.driver.drag(seleniumElement, rectWithoutFrameOffset, xOffset, yOffset, this.step.events);
|
|
269
|
-
}
|
|
270
|
-
const useRightClickJS = this.driver.isSafari() && this.step.button === 2;
|
|
271
|
-
const forceNativeEvent = this.driver.isSafari() && target.tagName === 'SELECT';
|
|
272
|
-
|
|
273
|
-
if (this.driver.isSafari() && forceNativeEvent) {
|
|
274
|
-
// NOTE:
|
|
275
|
-
// We want to skip click on SELECT elements because of a safari driver bug
|
|
276
|
-
// that not allowing to set the selected option after this click.
|
|
277
|
-
return Promise.resolve({
|
|
278
|
-
keep: true, success: 'skipped', forceTreatAsWarning: true, reason: 'Safari does not support clicking on select elements',
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
if (!forceNativeEvent && (!this.step.nativeEvents || useRightClickJS)) {
|
|
282
|
-
return this.clickJs();
|
|
283
|
-
}
|
|
284
|
-
if (this.step.button === 2) {
|
|
285
|
-
return this.driver.rightClick(seleniumElement, offsets);
|
|
286
|
-
}
|
|
287
|
-
return this.driver.leftClick(seleniumElement, offsets);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
async performAction() {
|
|
291
|
-
let res = await this.chooseAndRunAction();
|
|
292
|
-
if (!res.status && res.value && res.value.keep) {
|
|
293
|
-
res = res.value;
|
|
294
|
-
}
|
|
295
|
-
if (res.keep) {
|
|
296
|
-
delete res.keep;
|
|
297
|
-
return res;
|
|
298
|
-
}
|
|
299
|
-
return undefined;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
addDragendIfNeeded(events) {
|
|
303
|
-
if (events.some(event => event.event === 'dragend')) {
|
|
304
|
-
return events;
|
|
305
|
-
}
|
|
306
|
-
const dragendDefaultEvent = {
|
|
307
|
-
event: 'dragend',
|
|
308
|
-
eventInfo: {
|
|
309
|
-
detail: 0,
|
|
310
|
-
},
|
|
311
|
-
pointerPosition: this.getToElementPosition(),
|
|
312
|
-
};
|
|
313
|
-
return events.concat(dragendDefaultEvent);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
getToElementPosition() {
|
|
317
|
-
if (!(this.context.data?.toElement?.rect)) {
|
|
318
|
-
return undefined;
|
|
319
|
-
}
|
|
320
|
-
const { rect } = this.context.data.toElement;
|
|
321
|
-
return {
|
|
322
|
-
originX: rect.left + (rect.width / 2),
|
|
323
|
-
originY: rect.top + (rect.height / 2),
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
addDragOverBeforeDragEnd(events) {
|
|
328
|
-
const dropOrEndEventIndex = events.findIndex(e => ['dragend', 'drop'].includes(e.event));
|
|
329
|
-
const oneBeforeLastEvent = events[dropOrEndEventIndex - 1];
|
|
330
|
-
if (!oneBeforeLastEvent || (oneBeforeLastEvent.event !== 'dragover')) {
|
|
331
|
-
const dragenterDefaultEvent = {
|
|
332
|
-
event: 'dragover',
|
|
333
|
-
eventInfo: {
|
|
334
|
-
detail: 0,
|
|
335
|
-
},
|
|
336
|
-
pointerPosition: this.getToElementPosition(),
|
|
337
|
-
fireOnTarget: true,
|
|
338
|
-
};
|
|
339
|
-
events.splice(dropOrEndEventIndex, 0, dragenterDefaultEvent);
|
|
340
|
-
} else {
|
|
341
|
-
oneBeforeLastEvent.fireOnTarget = true;
|
|
342
|
-
}
|
|
343
|
-
return events;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
fixEventSequence(events) {
|
|
347
|
-
const withDragEnd = this.addDragendIfNeeded(events);
|
|
348
|
-
return this.addDragOverBeforeDragEnd(withDragEnd);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
addElementLocatedElementToDragEvents(events, fromElementLocatedElement, toElementLocatedElement) {
|
|
352
|
-
const isOnToElement = e => e.fireOnTarget || ['drop', 'dragenter'].includes(e.event);
|
|
353
|
-
events.forEach(event => (event.locatedElement = isOnToElement(event) ? toElementLocatedElement : fromElementLocatedElement));
|
|
354
|
-
return events;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
generateHTML5DragEventSequence() {
|
|
358
|
-
const fromElement = this.context.data.targetId;
|
|
359
|
-
const toElement = this.context.data.toElement;
|
|
360
|
-
let events = this.step.events.filter(event => event.event !== 'mousemove' && event.event !== 'pointermove');
|
|
361
|
-
events = this.fixEventSequence(events);
|
|
362
|
-
events = this.addElementLocatedElementToDragEvents(events, fromElement.locatedElement, toElement.locatedElement);
|
|
363
|
-
if (this.step.dispatchDragEventsOnClosestDraggable) {
|
|
364
|
-
events.forEach(event => (event.dispatchDragEventsOnClosestDraggable = true));
|
|
365
|
-
}
|
|
366
|
-
return events;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
module.exports = MouseStepAction;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const StepAction = require('./stepAction');
|
|
4
|
-
const requiredUrl = require('url');
|
|
5
|
-
|
|
6
|
-
class NavigationStepAction extends StepAction {
|
|
7
|
-
async updateBaseUrl(location) {
|
|
8
|
-
const orgUrl = requiredUrl.parse(location);
|
|
9
|
-
const baseLocation = requiredUrl.parse(this.context.recordedBaseUrl);
|
|
10
|
-
const newBaseLocation = requiredUrl.parse(this.context.baseUrl);
|
|
11
|
-
if (orgUrl.host === baseLocation.host && baseLocation.host !== newBaseLocation.host) {
|
|
12
|
-
orgUrl.host = newBaseLocation.host;
|
|
13
|
-
}
|
|
14
|
-
return orgUrl.href;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async performAction() {
|
|
18
|
-
const url = this.context.data.testimNavigationStepDestination || this.context.data.url;
|
|
19
|
-
// Opens a new tab and switches to new tab
|
|
20
|
-
if (this.step.openInNewTab) {
|
|
21
|
-
await this.driver.client.newWindow(url);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const updatedUrl = await this.updateBaseUrl(url);
|
|
25
|
-
await this.driver.url(updatedUrl);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
module.exports = NavigationStepAction;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const StepAction = require('./stepAction');
|
|
4
|
-
const { NpmPackageError } = require('../../errors');
|
|
5
|
-
|
|
6
|
-
const service = require('../../agent/routers/cliJsCode/service');
|
|
7
|
-
const utils = require('../../utils');
|
|
8
|
-
|
|
9
|
-
class NodePackageStepAction extends StepAction {
|
|
10
|
-
async performAction() {
|
|
11
|
-
const { context } = this;
|
|
12
|
-
const { stepId, packageData, resultId, retryIndex, stepResultId, timeToPlayBeforeExec } = context;
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
const data = await service.installPackage(
|
|
16
|
-
stepId,
|
|
17
|
-
resultId,
|
|
18
|
-
retryIndex,
|
|
19
|
-
packageData,
|
|
20
|
-
stepResultId,
|
|
21
|
-
timeToPlayBeforeExec,
|
|
22
|
-
);
|
|
23
|
-
return ({ data, success: true });
|
|
24
|
-
} catch (err) {
|
|
25
|
-
if (err instanceof NpmPackageError) {
|
|
26
|
-
return {
|
|
27
|
-
success: false,
|
|
28
|
-
code: 'invalid-node-package',
|
|
29
|
-
message: err.message,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
if (err instanceof utils.TimeoutError) {
|
|
33
|
-
return {
|
|
34
|
-
success: false,
|
|
35
|
-
code: 'timeout',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
success: false,
|
|
40
|
-
reason: err.message,
|
|
41
|
-
exception: err,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports = NodePackageStepAction;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const _ = require('lodash');
|
|
4
|
-
const StepAction = require('./stepAction');
|
|
5
|
-
const { eyeSdkService } = require('../utils/eyeSdkService');
|
|
6
|
-
const { getLogger } = require('../../commons/logger');
|
|
7
|
-
|
|
8
|
-
const logger = getLogger('pixel-validation-step-action');
|
|
9
|
-
|
|
10
|
-
class PixelValidationStepAction extends StepAction {
|
|
11
|
-
async performAction() {
|
|
12
|
-
const { shouldUseVisualGrid, applitoolsSdkConfig: config, applitoolsSdkLogger, testResultId } = this.context;
|
|
13
|
-
this.runContext = this.context.getRunContext(undefined);
|
|
14
|
-
const finalParams = this.runContext.incomingParams?.final || {};
|
|
15
|
-
const batchId = config.batch?.id || testResultId;
|
|
16
|
-
const eyeManager = await eyeSdkService.getManager(shouldUseVisualGrid, this.context.config.applitoolsConcurrency || 5, batchId, this.runContext.applitoolsIntegrationData);
|
|
17
|
-
const targetElementData = this.getTarget() || {};
|
|
18
|
-
let result;
|
|
19
|
-
try {
|
|
20
|
-
const openedEye = await eyeManager.openEyes({ driver: this.driver.client, config, logger: applitoolsSdkLogger });
|
|
21
|
-
const region = (this.step.action === 'element' && targetElementData.seleniumElement) || undefined;
|
|
22
|
-
const settings = { region, fully: this.step.action === 'stitched' };
|
|
23
|
-
if (_.isPlainObject(finalParams.applitoolsStepSettings)) {
|
|
24
|
-
Object.assign(settings, finalParams.applitoolsStepSettings);
|
|
25
|
-
logger.info('Applitools SDK step executed with applitoolsStepSettings parameter', { applitoolsStepSettings: finalParams.applitoolsStepSettings });
|
|
26
|
-
}
|
|
27
|
-
await openedEye.check({ settings });
|
|
28
|
-
const eyesResults = await openedEye.close();
|
|
29
|
-
|
|
30
|
-
result = { isApplitoolsSdkResult: true, success: true, eyesResults };
|
|
31
|
-
} catch (err) {
|
|
32
|
-
logger.error('Applitools SDK step failed', { err, info: err.info });
|
|
33
|
-
result = { isApplitoolsSdkResult: true, success: false, err };
|
|
34
|
-
}
|
|
35
|
-
return await eyeSdkService.handleApplitoolsSdkResult(this.context, result, this.step);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
module.exports = PixelValidationStepAction;
|