@testim/testim-cli 3.263.0 → 3.265.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commons/featureFlags.js +1 -3
- package/commons/testimDesiredCapabilitiesBuilder.js +24 -67
- package/npm-shrinkwrap.json +818 -1206
- package/package.json +2 -3
- package/player/WebdriverioWebDriverApi.js +15 -26
- package/player/stepActions/baseJsStepAction.js +15 -38
- package/player/stepActions/locateStepAction.js +1 -18
- package/player/stepActions/mouseStepAction.js +9 -20
- package/player/stepActions/pixelValidationStepAction.js +6 -4
- package/player/stepActions/scripts/runCode.js +2 -2
- package/player/stepActions/scripts/wheel.js +8 -23
- package/player/stepActions/textStepAction.js +2 -6
- package/player/stepActions/wheelStepAction.js +2 -6
- package/player/utils/eyeSdkService.js +7 -15
- package/player/webdriver.js +13 -35
- package/runOptions.d.ts +1 -1
- package/runOptions.js +1 -9
- package/runners/runnerUtils.js +1 -1
- package/utils/promiseUtils.js +2 -1
package/player/webdriver.js
CHANGED
|
@@ -80,8 +80,7 @@ class WebDriver extends WebDriverApi {
|
|
|
80
80
|
if (capabilities.capabilities) {
|
|
81
81
|
delete capabilities.capabilities.alwaysMatch.marionette;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
this.initUnsupportedActions(browser, lambdatestService?.isLambdatestRun());
|
|
83
|
+
this.initUnsupportedActions(lambdatestService?.isLambdatestRun());
|
|
85
84
|
this.browserAndOS = null;
|
|
86
85
|
this.seleniumPerfStats = seleniumPerfStats;
|
|
87
86
|
const driverDelay = fastInit ? 0 : 1500;
|
|
@@ -110,8 +109,8 @@ class WebDriver extends WebDriverApi {
|
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
|
|
113
|
-
initUnsupportedActions(
|
|
114
|
-
if (isLambdatestRun
|
|
112
|
+
initUnsupportedActions(isLambdatestRun) {
|
|
113
|
+
if (isLambdatestRun) {
|
|
115
114
|
this.unsupportedActions = {
|
|
116
115
|
...this.unsupportedActions,
|
|
117
116
|
move: true,
|
|
@@ -391,15 +390,7 @@ class WebDriver extends WebDriverApi {
|
|
|
391
390
|
if (isTextElement(element)) {
|
|
392
391
|
return element.value;
|
|
393
392
|
} else if (element instanceof SVGElement) {
|
|
394
|
-
var isIE = navigator.userAgent.indexOf('MSIE') !== -1
|
|
395
|
-
|| navigator.userAgent.indexOf('Trident/') !== -1;
|
|
396
|
-
|
|
397
393
|
var copyElement = element.cloneNode(true);
|
|
398
|
-
// clone doesn't work for SVG elements in IE11
|
|
399
|
-
if (isIE) {
|
|
400
|
-
var svgContent = new XMLSerializer().serializeToString(element);
|
|
401
|
-
copyElement = new DOMParser().parseFromString(svgContent, 'text/html').body.firstChild;
|
|
402
|
-
}
|
|
403
394
|
return clearTitleTags(copyElement).textContent.replace(/(\r\n|\n|\r)/gm, '');
|
|
404
395
|
} else {
|
|
405
396
|
return getFixedTextContent(element);
|
|
@@ -436,9 +427,6 @@ class WebDriver extends WebDriverApi {
|
|
|
436
427
|
return this.executeJS(getHTMLCode)
|
|
437
428
|
.then(result => {
|
|
438
429
|
this.seleniumPerfStats.markEnd(perfId, SELENIUM_PERF_MARKS.GET_HTML);
|
|
439
|
-
if (this.isIE() && result.value.runLocation && this.isIePageNotAvailableUrl(result.value.runLocation.href)) {
|
|
440
|
-
throw this.getIeError('Page is not loaded');
|
|
441
|
-
}
|
|
442
430
|
return result.value;
|
|
443
431
|
})
|
|
444
432
|
.catch(err => !(err instanceof IeError), err => {
|
|
@@ -449,15 +437,7 @@ class WebDriver extends WebDriverApi {
|
|
|
449
437
|
testimInternalError.extraInfo = 'Inside getHtml catch and trying to check if in quirks mode - but the session has already terminated';
|
|
450
438
|
throw testimInternalError;
|
|
451
439
|
}
|
|
452
|
-
|
|
453
|
-
throw testimInternalError;
|
|
454
|
-
}
|
|
455
|
-
return this.executeJS('return navigator.userAgent;')
|
|
456
|
-
.catch(() => { throw testimInternalError; })
|
|
457
|
-
.then(ua => {
|
|
458
|
-
const error = this.isUsingUnsupportedCompabilityMode(ua.value) ? this.getIeError('Can’t run test in IE compatibility mode') : testimInternalError;
|
|
459
|
-
throw error;
|
|
460
|
-
});
|
|
440
|
+
throw testimInternalError;
|
|
461
441
|
});
|
|
462
442
|
}
|
|
463
443
|
|
|
@@ -469,10 +449,9 @@ class WebDriver extends WebDriverApi {
|
|
|
469
449
|
const MAX_TRIES = 5;
|
|
470
450
|
|
|
471
451
|
const getViewportSizeScript = function () {
|
|
472
|
-
var pixelRatio = (/(MSIE)|(Trident)/.test(navigator.userAgent)) ? (window.screen.systemXDPI / window.screen.deviceXDPI) : 1;
|
|
473
452
|
return {
|
|
474
|
-
screenWidth: Math.floor(window.innerWidth || 0)
|
|
475
|
-
screenHeight: Math.floor(window.innerHeight || 0)
|
|
453
|
+
screenWidth: Math.floor(window.innerWidth || 0),
|
|
454
|
+
screenHeight: Math.floor(window.innerHeight || 0)
|
|
476
455
|
};
|
|
477
456
|
};
|
|
478
457
|
|
|
@@ -649,15 +628,14 @@ class WebDriver extends WebDriverApi {
|
|
|
649
628
|
}
|
|
650
629
|
|
|
651
630
|
doubleClickWithJS(eventData) {
|
|
652
|
-
const eventParam = this.isEdge() ? JSON.stringify(eventData) : eventData;
|
|
653
631
|
return this.executeCodeAsync(`
|
|
654
632
|
var getLocatedElement = ${codeSnippets().getLocatedElementCode};
|
|
655
633
|
var dispatchFocus = ${dispatchFocus.toString()};
|
|
656
634
|
var doubleClick = ${doubleClick.toString()};
|
|
657
|
-
var eventData =
|
|
635
|
+
var eventData = arguments[0];
|
|
658
636
|
var done = arguments[1];
|
|
659
637
|
return doubleClick.call(null, eventData, done);
|
|
660
|
-
`, eventData.timeout,
|
|
638
|
+
`, eventData.timeout, eventData);
|
|
661
639
|
}
|
|
662
640
|
|
|
663
641
|
// eslint-disable-next-line default-param-last
|
|
@@ -740,8 +718,8 @@ class WebDriver extends WebDriverApi {
|
|
|
740
718
|
const { rect, clickOffset } = offsets;
|
|
741
719
|
const center = this.inViewCenter(rect);
|
|
742
720
|
// moveto element (actions and legacy) is always vs. the center of an element, so the offset needs to get fixed.
|
|
743
|
-
const xOffset =
|
|
744
|
-
const yOffset =
|
|
721
|
+
const xOffset = Math.floor(clickOffset.x - center.x);
|
|
722
|
+
const yOffset = Math.floor(clickOffset.y - center.y);
|
|
745
723
|
|
|
746
724
|
return this.moveTo(extractElementId(seleniumElement), xOffset, yOffset)
|
|
747
725
|
.catch(err => {
|
|
@@ -813,8 +791,8 @@ class WebDriver extends WebDriverApi {
|
|
|
813
791
|
|
|
814
792
|
drag(seleniumElement, targetRect, xElementOffset, yElementOffset, events) {
|
|
815
793
|
const { width, height } = targetRect;
|
|
816
|
-
const midXRelative =
|
|
817
|
-
const midYRelative =
|
|
794
|
+
const midXRelative = (xElementOffset - width / 2 + 1);
|
|
795
|
+
const midYRelative = (yElementOffset - height / 2);
|
|
818
796
|
return this.getDragCoordinates(events)
|
|
819
797
|
.then(coordinates => {
|
|
820
798
|
const { xDiff, yDiff } = coordinates;
|
|
@@ -893,7 +871,7 @@ class WebDriver extends WebDriverApi {
|
|
|
893
871
|
}
|
|
894
872
|
|
|
895
873
|
dragAndDrop(sourceSeleniumElement, destinationSeleniumElement, rectsAndOffsets) {
|
|
896
|
-
if (this.
|
|
874
|
+
if (this.isSafari()) {
|
|
897
875
|
if (this.unsupportedActions.move) {
|
|
898
876
|
return this.dragAndDropWithActionsAPIWithGeneratedMoves(rectsAndOffsets);
|
|
899
877
|
}
|
package/runOptions.d.ts
CHANGED
|
@@ -163,7 +163,7 @@ interface RunnerOptions extends Partial<Omit<TunnelOptions, 'tunnelOnlyMode' | '
|
|
|
163
163
|
useChromeLauncher?: boolean;
|
|
164
164
|
|
|
165
165
|
disableGridCheck: boolean;
|
|
166
|
-
browser?: '
|
|
166
|
+
browser?: 'edge-chromium' | 'firefox' | 'safari' | 'chrome';
|
|
167
167
|
|
|
168
168
|
proxyForGrid: string;
|
|
169
169
|
|
package/runOptions.js
CHANGED
|
@@ -452,13 +452,8 @@ module.exports = {
|
|
|
452
452
|
|
|
453
453
|
if (program.playerRequirePath) {
|
|
454
454
|
const fullPlayerPath = path.resolve(program.playerRequirePath);
|
|
455
|
-
let projectFile;
|
|
456
455
|
console.log('Using Local Clickim for Player Require Path =', fullPlayerPath);
|
|
457
|
-
|
|
458
|
-
projectFile = path.join(fullPlayerPath, 'tsconfig.ie11.json');
|
|
459
|
-
} else {
|
|
460
|
-
projectFile = path.join(fullPlayerPath, 'tsconfig.node.json');
|
|
461
|
-
}
|
|
456
|
+
const projectFile = path.join(fullPlayerPath, 'tsconfig.node.json');
|
|
462
457
|
|
|
463
458
|
// [NOTE] playerRequirePath is a dev flag
|
|
464
459
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
@@ -655,9 +650,6 @@ module.exports = {
|
|
|
655
650
|
case 'microsoftedge':
|
|
656
651
|
program.browser = 'edge';
|
|
657
652
|
break;
|
|
658
|
-
case 'internet explorer':
|
|
659
|
-
program.browser = 'ie';
|
|
660
|
-
break;
|
|
661
653
|
default:
|
|
662
654
|
program.browser = browserName;
|
|
663
655
|
}
|
package/runners/runnerUtils.js
CHANGED
|
@@ -60,7 +60,7 @@ async function validateConfig(options, testList) {
|
|
|
60
60
|
const supportedBrowsers = options.mode === 'extension' ? [
|
|
61
61
|
'edge-chromium', 'chrome',
|
|
62
62
|
] : [
|
|
63
|
-
'
|
|
63
|
+
'firefox', 'chrome', 'edge-chromium', 'safari', 'safari technology preview', 'browser', 'android', 'ios', 'iphone', 'ipad',
|
|
64
64
|
];
|
|
65
65
|
const diff = _.difference(utils.getUniqBrowsers(options, testList), supportedBrowsers);
|
|
66
66
|
|
package/utils/promiseUtils.js
CHANGED
|
@@ -39,9 +39,10 @@ function delay(time) {
|
|
|
39
39
|
* @param {string=} errMsg
|
|
40
40
|
*/
|
|
41
41
|
function promiseTimeout(promise, timeout, errMsg = 'Timeout Error') {
|
|
42
|
+
const timeoutErr = new TimeoutError(errMsg);
|
|
42
43
|
return Promise.race([
|
|
43
44
|
promise,
|
|
44
|
-
delay(timeout).then(() => { throw
|
|
45
|
+
delay(timeout).then(() => { throw timeoutErr; }),
|
|
45
46
|
]);
|
|
46
47
|
}
|
|
47
48
|
|