@testim/testim-cli 3.263.0 → 3.264.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 +32 -32
- package/package.json +1 -1
- 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/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/webdriver.js +13 -35
- package/runOptions.d.ts +1 -1
- package/runOptions.js +1 -9
- package/runners/runnerUtils.js +1 -1
package/commons/featureFlags.js
CHANGED
|
@@ -37,10 +37,8 @@ class FeatureFlagsService {
|
|
|
37
37
|
constructor() {
|
|
38
38
|
this.flags = {
|
|
39
39
|
useNewWSCLI: new Rox.Flag(),
|
|
40
|
-
disableEdgeVisibilityChecks: new Rox.Flag(),
|
|
41
40
|
useSafariWebdriverVisibilityChecks: new Rox.Flag(),
|
|
42
41
|
useClickimVisibilityChecks: new Rox.Flag(),
|
|
43
|
-
useIEWebdriverVisibilityChecks: new Rox.Flag(),
|
|
44
42
|
runGetElementCodeInAut: new Rox.Flag(),
|
|
45
43
|
enableFrameSwitchOptimization: new Rox.Flag(),
|
|
46
44
|
maximumJsResultSize: new Rox.Configuration(2000 * 1024),
|
|
@@ -53,7 +51,7 @@ class FeatureFlagsService {
|
|
|
53
51
|
autoSaveDownloadFileFireFox: new Rox.Flag(true),
|
|
54
52
|
safariSelectOptionDispatchEventOnSelectElement: new Rox.Flag(true),
|
|
55
53
|
experimentalPreCodeCompilation: new Rox.Flag(true),
|
|
56
|
-
/** Enables using top level await inside custom actions
|
|
54
|
+
/** Enables using top level await inside custom actions */
|
|
57
55
|
experimentalAsyncCustomCode: new Rox.Flag(),
|
|
58
56
|
useSameBrowserForMultiTests: new LabFeatureFlag('labs'),
|
|
59
57
|
highSpeedMode: new LabFeatureFlag(),
|
|
@@ -67,15 +67,6 @@ const convertToNewCapabilitiesFormat = (desiredCapabilities) => {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
function buildEdgeOptions(opts) {
|
|
71
|
-
Object.assign(opts.desiredCapabilities, {
|
|
72
|
-
browserName: 'MicrosoftEdge',
|
|
73
|
-
_isOldEdge: true,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
return opts;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
70
|
function buildSafariOptions(opts, browserName) {
|
|
80
71
|
const safariOptions = { browserName: 'safari' };
|
|
81
72
|
|
|
@@ -87,48 +78,12 @@ function buildSafariOptions(opts, browserName) {
|
|
|
87
78
|
return opts;
|
|
88
79
|
}
|
|
89
80
|
|
|
90
|
-
function buildIEOptions(opts, browserOptions, gridInfo, lambdatestService) {
|
|
91
|
-
const ieOptions = {
|
|
92
|
-
ignoreProtectedModeSettings: true,
|
|
93
|
-
'ie.ensureCleanSession': true,
|
|
94
|
-
'ie.enableFullPageScreenshot': false,
|
|
95
|
-
'ie.fileUploadDialogTimeout': 3000,
|
|
96
|
-
'ie.acceptSslCerts': true,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
let version = '11';
|
|
100
|
-
if (isDFGrid(gridInfo)) {
|
|
101
|
-
version = 'latest';
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
Object.assign(opts.desiredCapabilities, {
|
|
105
|
-
browserName: 'internet explorer',
|
|
106
|
-
version,
|
|
107
|
-
pageLoadStrategy: 'none',
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
const isLambdatestRun = lambdatestService && lambdatestService.isLambdatestRun();
|
|
111
|
-
if (isLambdatestRun) {
|
|
112
|
-
opts.desiredCapabilities.ignoreProtectedModeSettings = true; // this might be the correct way to do it for all grids
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (browserOptions.oldCapabilities && !isLambdatestRun) {
|
|
116
|
-
Object.assign(opts.desiredCapabilities, ieOptions);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (browserOptions.w3cCapabilities) {
|
|
120
|
-
opts.desiredCapabilities['se:ieOptions'] = ieOptions;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return opts;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
81
|
function readFileToBase64(fileLocation) {
|
|
127
82
|
return fs.readFileSync(fileLocation, { encoding: 'base64' });
|
|
128
83
|
}
|
|
129
84
|
|
|
130
85
|
function setCustomExtension(customExtensionLocalLocation, extensions, lambdatestService) {
|
|
131
|
-
if (lambdatestService
|
|
86
|
+
if (lambdatestService?.isLambdatestRun() && utils.isURL(customExtensionLocalLocation)) {
|
|
132
87
|
return;
|
|
133
88
|
}
|
|
134
89
|
|
|
@@ -141,7 +96,7 @@ function setCustomExtension(customExtensionLocalLocation, extensions, lambdatest
|
|
|
141
96
|
}
|
|
142
97
|
|
|
143
98
|
function setTestimExtension(browserOptions, extensions, args, predefinedTestimExtension, lambdatestService) {
|
|
144
|
-
if (lambdatestService
|
|
99
|
+
if (lambdatestService?.isLambdatestRun()) {
|
|
145
100
|
return;
|
|
146
101
|
}
|
|
147
102
|
|
|
@@ -219,7 +174,7 @@ function _buildChromiumOptions(opts, browserOptions, testRunConfig, customExtens
|
|
|
219
174
|
args.push(`--user-data-dir=${browserOptions.chromeUserDataDir}`);
|
|
220
175
|
}
|
|
221
176
|
|
|
222
|
-
if (browserOptions.projectData
|
|
177
|
+
if (browserOptions.projectData?.defaults?.disableChromiumGpu) {
|
|
223
178
|
args.push('--disable-gpu');
|
|
224
179
|
}
|
|
225
180
|
|
|
@@ -264,7 +219,7 @@ function _buildChromiumOptions(opts, browserOptions, testRunConfig, customExtens
|
|
|
264
219
|
delete chromiumOptions.w3c;
|
|
265
220
|
}
|
|
266
221
|
|
|
267
|
-
if (browserOptions.oldCapabilities && gridInfo.type !== 'testimEnterprise' && !
|
|
222
|
+
if (browserOptions.oldCapabilities && gridInfo.type !== 'testimEnterprise' && !lambdatestService?.isLambdatestRun()) {
|
|
268
223
|
opts.desiredCapabilities[optionsKey] = chromiumOptions;
|
|
269
224
|
}
|
|
270
225
|
|
|
@@ -353,13 +308,14 @@ function buildFirefoxOptions(opts, browserOptions) {
|
|
|
353
308
|
}
|
|
354
309
|
|
|
355
310
|
function buildSaucelabs(browserOptions, testName, testRunConfig) {
|
|
356
|
-
|
|
311
|
+
const { saucelabs } = browserOptions;
|
|
312
|
+
if (saucelabs?.username && saucelabs.accessKey) {
|
|
357
313
|
if (testRunConfig) {
|
|
358
314
|
testRunConfig.sl.version = testRunConfig.browserValue === 'safari' ? testRunConfig.sl.safari_version : testRunConfig.sl.version;
|
|
359
|
-
testRunConfig.sl.appiumVersion =
|
|
360
|
-
return Object.assign({}, testRunConfig.sl,
|
|
315
|
+
testRunConfig.sl.appiumVersion = saucelabs.appiumVersion || testRunConfig.sl.appiumVersion;
|
|
316
|
+
return Object.assign({}, testRunConfig.sl, saucelabs, { name: testName });
|
|
361
317
|
}
|
|
362
|
-
return Object.assign({},
|
|
318
|
+
return Object.assign({}, saucelabs, { name: testName });
|
|
363
319
|
}
|
|
364
320
|
return {};
|
|
365
321
|
}
|
|
@@ -524,8 +480,7 @@ function buildSeleniumOptions(browserOptions, testName, testRunConfig, gridInfo,
|
|
|
524
480
|
}
|
|
525
481
|
|
|
526
482
|
const browserTimeoutSec = Number(browserOptions.browserTimeout / 1000);
|
|
527
|
-
const browser = browserOptions.browser ||
|
|
528
|
-
|
|
483
|
+
const browser = browserOptions.browser || testRunConfig?.browserValue;
|
|
529
484
|
|
|
530
485
|
_.merge(
|
|
531
486
|
opts.desiredCapabilities,
|
|
@@ -533,11 +488,11 @@ function buildSeleniumOptions(browserOptions, testName, testRunConfig, gridInfo,
|
|
|
533
488
|
buildBrowserstack(browserOptions, testName, testRunConfig),
|
|
534
489
|
buildPerfecto(browserOptions, testName, testRunConfig),
|
|
535
490
|
buildExperitest(browserOptions, browser, browserTimeoutSec),
|
|
536
|
-
lambdatestService
|
|
491
|
+
lambdatestService?.getCapabilities(browserOptions, browser, executionId, testResultId, testName),
|
|
537
492
|
);
|
|
538
493
|
|
|
539
494
|
let predefinedTestimExtension = null;
|
|
540
|
-
if (!browserOptions.ext && !browserOptions.extensionPath &&
|
|
495
|
+
if (!browserOptions.ext && !browserOptions.extensionPath && gridInfo.host?.endsWith('.testim.io') && !browserOptions.canary && browserOptions.mode === CLI_MODE.EXTENSION) {
|
|
541
496
|
if (browser === 'chrome') {
|
|
542
497
|
predefinedTestimExtension = '/opt/testim-headless';
|
|
543
498
|
} else if (browser === 'edge-chromium') {
|
|
@@ -545,7 +500,7 @@ function buildSeleniumOptions(browserOptions, testName, testRunConfig, gridInfo,
|
|
|
545
500
|
}
|
|
546
501
|
}
|
|
547
502
|
|
|
548
|
-
if (
|
|
503
|
+
if (gridInfo.host?.endsWith('.testim.io') && browser === 'edge-chromium') {
|
|
549
504
|
opts.desiredCapabilities.version = '83'; // Need to match GGR filter
|
|
550
505
|
}
|
|
551
506
|
|
|
@@ -557,16 +512,10 @@ function buildSeleniumOptions(browserOptions, testName, testRunConfig, gridInfo,
|
|
|
557
512
|
case 'firefox':
|
|
558
513
|
opts = buildFirefoxOptions(opts, browserOptions);
|
|
559
514
|
break;
|
|
560
|
-
case 'edge':
|
|
561
|
-
opts = buildEdgeOptions(opts);
|
|
562
|
-
break;
|
|
563
515
|
case 'safari':
|
|
564
516
|
case 'safari technology preview':
|
|
565
517
|
opts = buildSafariOptions(opts, browser);
|
|
566
518
|
break;
|
|
567
|
-
case 'ie11':
|
|
568
|
-
opts = buildIEOptions(opts, browserOptions, gridInfo, lambdatestService);
|
|
569
|
-
break;
|
|
570
519
|
default:
|
|
571
520
|
break;
|
|
572
521
|
}
|
|
@@ -582,7 +531,12 @@ function buildSeleniumOptions(browserOptions, testName, testRunConfig, gridInfo,
|
|
|
582
531
|
*/
|
|
583
532
|
const hostToProvider = { 'hub.lambdatest.com': 'lambdatest', 'public-grid.testim.io': 'testim', 'testgrid-devicefarm.us-west-2.amazonaws.com': 'devicefarm' };
|
|
584
533
|
const byGrid = (capabilities) => capabilities[gridInfo.provider] || capabilities[opts.host] || capabilities[hostToProvider[opts.host]];
|
|
585
|
-
const getTargetingGroup =
|
|
534
|
+
const getTargetingGroup = capabilities =>
|
|
535
|
+
byGrid(capabilities) ||
|
|
536
|
+
capabilities[opts.desiredCapabilities?.browserName] ||
|
|
537
|
+
capabilities[opts.desiredCapabilities?.version] ||
|
|
538
|
+
capabilities ||
|
|
539
|
+
{};
|
|
586
540
|
const capabilities = JSON.parse(featureFlags.flags.addCustomCapabilities.getValue() || '{}');
|
|
587
541
|
const customCapabilities = getTargetingGroup(getTargetingGroup(capabilities));
|
|
588
542
|
|
|
@@ -590,8 +544,11 @@ function buildSeleniumOptions(browserOptions, testName, testRunConfig, gridInfo,
|
|
|
590
544
|
logger.info(`Adding custom capabilities: ${JSON.stringify(customCapabilities)}`);
|
|
591
545
|
Object.assign(opts.desiredCapabilities, customCapabilities);
|
|
592
546
|
}
|
|
593
|
-
} catch (
|
|
594
|
-
logger.error(
|
|
547
|
+
} catch (error) {
|
|
548
|
+
logger.error('Failed to load custom capabilities', {
|
|
549
|
+
error,
|
|
550
|
+
customCapabilities: featureFlags.flags.addCustomCapabilities.getValue(),
|
|
551
|
+
});
|
|
595
552
|
}
|
|
596
553
|
|
|
597
554
|
if (isDFGrid(gridInfo) && opts.desiredCapabilities && !opts.capabilities) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testim/testim-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.264.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@testim/testim-cli",
|
|
9
|
-
"version": "3.
|
|
9
|
+
"version": "3.264.0",
|
|
10
10
|
"license": "Proprietary",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@applitools/eyes-sdk-core": "13.6.23",
|
|
@@ -1594,9 +1594,9 @@
|
|
|
1594
1594
|
}
|
|
1595
1595
|
},
|
|
1596
1596
|
"node_modules/@wdio/types/node_modules/@types/node": {
|
|
1597
|
-
"version": "18.11.
|
|
1598
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.
|
|
1599
|
-
"integrity": "sha512-
|
|
1597
|
+
"version": "18.11.10",
|
|
1598
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.10.tgz",
|
|
1599
|
+
"integrity": "sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ=="
|
|
1600
1600
|
},
|
|
1601
1601
|
"node_modules/@wdio/utils": {
|
|
1602
1602
|
"version": "7.24.0",
|
|
@@ -4189,9 +4189,9 @@
|
|
|
4189
4189
|
"integrity": "sha512-ic1yEvwT6GuvaYwBLLY6/aFFgjZdySKTE8en/fkU3QICTmRtgtSlFn0u0BXN06InZwtfCelR7j8LRiDI/02iGA=="
|
|
4190
4190
|
},
|
|
4191
4191
|
"node_modules/decode-uri-component": {
|
|
4192
|
-
"version": "0.2.
|
|
4193
|
-
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.
|
|
4194
|
-
"integrity": "sha512-
|
|
4192
|
+
"version": "0.2.2",
|
|
4193
|
+
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz",
|
|
4194
|
+
"integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==",
|
|
4195
4195
|
"engines": {
|
|
4196
4196
|
"node": ">=0.10"
|
|
4197
4197
|
}
|
|
@@ -4610,9 +4610,9 @@
|
|
|
4610
4610
|
"integrity": "sha512-+iipnm2hvmlWs4MVNx7HwSTxhDxsXnQyK5F1OalZVXeUhdPgP/23T42NCyg0TK3wL/Yg92SVrSuGKqdg12o54w=="
|
|
4611
4611
|
},
|
|
4612
4612
|
"node_modules/devtools/node_modules/@types/node": {
|
|
4613
|
-
"version": "18.11.
|
|
4614
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.
|
|
4615
|
-
"integrity": "sha512-
|
|
4613
|
+
"version": "18.11.10",
|
|
4614
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.10.tgz",
|
|
4615
|
+
"integrity": "sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ=="
|
|
4616
4616
|
},
|
|
4617
4617
|
"node_modules/devtools/node_modules/ua-parser-js": {
|
|
4618
4618
|
"version": "1.0.32",
|
|
@@ -15647,9 +15647,9 @@
|
|
|
15647
15647
|
}
|
|
15648
15648
|
},
|
|
15649
15649
|
"node_modules/webdriver/node_modules/@types/node": {
|
|
15650
|
-
"version": "18.11.
|
|
15651
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.
|
|
15652
|
-
"integrity": "sha512-
|
|
15650
|
+
"version": "18.11.10",
|
|
15651
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.10.tgz",
|
|
15652
|
+
"integrity": "sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ=="
|
|
15653
15653
|
},
|
|
15654
15654
|
"node_modules/webdriverio": {
|
|
15655
15655
|
"version": "7.24.0",
|
|
@@ -15689,9 +15689,9 @@
|
|
|
15689
15689
|
}
|
|
15690
15690
|
},
|
|
15691
15691
|
"node_modules/webdriverio/node_modules/@types/node": {
|
|
15692
|
-
"version": "18.11.
|
|
15693
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.
|
|
15694
|
-
"integrity": "sha512-
|
|
15692
|
+
"version": "18.11.10",
|
|
15693
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.10.tgz",
|
|
15694
|
+
"integrity": "sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ=="
|
|
15695
15695
|
},
|
|
15696
15696
|
"node_modules/webdriverio/node_modules/brace-expansion": {
|
|
15697
15697
|
"version": "2.0.1",
|
|
@@ -17420,9 +17420,9 @@
|
|
|
17420
17420
|
},
|
|
17421
17421
|
"dependencies": {
|
|
17422
17422
|
"@types/node": {
|
|
17423
|
-
"version": "18.11.
|
|
17424
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.
|
|
17425
|
-
"integrity": "sha512-
|
|
17423
|
+
"version": "18.11.10",
|
|
17424
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.10.tgz",
|
|
17425
|
+
"integrity": "sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ=="
|
|
17426
17426
|
}
|
|
17427
17427
|
}
|
|
17428
17428
|
},
|
|
@@ -19510,9 +19510,9 @@
|
|
|
19510
19510
|
"integrity": "sha512-ic1yEvwT6GuvaYwBLLY6/aFFgjZdySKTE8en/fkU3QICTmRtgtSlFn0u0BXN06InZwtfCelR7j8LRiDI/02iGA=="
|
|
19511
19511
|
},
|
|
19512
19512
|
"decode-uri-component": {
|
|
19513
|
-
"version": "0.2.
|
|
19514
|
-
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.
|
|
19515
|
-
"integrity": "sha512-
|
|
19513
|
+
"version": "0.2.2",
|
|
19514
|
+
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz",
|
|
19515
|
+
"integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ=="
|
|
19516
19516
|
},
|
|
19517
19517
|
"decompress": {
|
|
19518
19518
|
"version": "4.2.1",
|
|
@@ -19833,9 +19833,9 @@
|
|
|
19833
19833
|
},
|
|
19834
19834
|
"dependencies": {
|
|
19835
19835
|
"@types/node": {
|
|
19836
|
-
"version": "18.11.
|
|
19837
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.
|
|
19838
|
-
"integrity": "sha512-
|
|
19836
|
+
"version": "18.11.10",
|
|
19837
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.10.tgz",
|
|
19838
|
+
"integrity": "sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ=="
|
|
19839
19839
|
},
|
|
19840
19840
|
"ua-parser-js": {
|
|
19841
19841
|
"version": "1.0.32",
|
|
@@ -28377,9 +28377,9 @@
|
|
|
28377
28377
|
},
|
|
28378
28378
|
"dependencies": {
|
|
28379
28379
|
"@types/node": {
|
|
28380
|
-
"version": "18.11.
|
|
28381
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.
|
|
28382
|
-
"integrity": "sha512-
|
|
28380
|
+
"version": "18.11.10",
|
|
28381
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.10.tgz",
|
|
28382
|
+
"integrity": "sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ=="
|
|
28383
28383
|
}
|
|
28384
28384
|
}
|
|
28385
28385
|
},
|
|
@@ -28418,9 +28418,9 @@
|
|
|
28418
28418
|
},
|
|
28419
28419
|
"dependencies": {
|
|
28420
28420
|
"@types/node": {
|
|
28421
|
-
"version": "18.11.
|
|
28422
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.
|
|
28423
|
-
"integrity": "sha512-
|
|
28421
|
+
"version": "18.11.10",
|
|
28422
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.10.tgz",
|
|
28423
|
+
"integrity": "sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ=="
|
|
28424
28424
|
},
|
|
28425
28425
|
"brace-expansion": {
|
|
28426
28426
|
"version": "2.0.1",
|
package/package.json
CHANGED
|
@@ -17,12 +17,9 @@ Queue.configure(Promise);
|
|
|
17
17
|
const perf = require('../commons/performance-logger');
|
|
18
18
|
|
|
19
19
|
const getViewportSizeHelper = function () {
|
|
20
|
-
// this runs on the AUT, should be compatible with old browsers
|
|
21
|
-
// eslint-disable-next-line no-var
|
|
22
|
-
var pixelRatio = (/(MSIE)|(Trident)/.test(navigator.userAgent)) ? (window.screen.systemXDPI / window.screen.deviceXDPI) : 1;
|
|
23
20
|
return {
|
|
24
|
-
screenWidth: Math.floor(
|
|
25
|
-
screenHeight: Math.floor(
|
|
21
|
+
screenWidth: Math.floor(window.innerWidth || 0),
|
|
22
|
+
screenHeight: Math.floor(window.innerHeight || 0),
|
|
26
23
|
};
|
|
27
24
|
};
|
|
28
25
|
|
|
@@ -49,7 +46,7 @@ class WebdriverioWebDriverApi {
|
|
|
49
46
|
|
|
50
47
|
initQueueRequests() {
|
|
51
48
|
let maxConcurrent = Infinity;
|
|
52
|
-
if (this.
|
|
49
|
+
if (this.isAndroid()) {
|
|
53
50
|
maxConcurrent = 1;
|
|
54
51
|
}
|
|
55
52
|
if (typeof config.REQUESTS_QUEUE_SIZE !== 'undefined') {
|
|
@@ -90,7 +87,7 @@ class WebdriverioWebDriverApi {
|
|
|
90
87
|
}
|
|
91
88
|
|
|
92
89
|
getSessionId() {
|
|
93
|
-
return this.client
|
|
90
|
+
return this.client?.requestHandler?.sessionID;
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
isChrome() {
|
|
@@ -109,18 +106,10 @@ class WebdriverioWebDriverApi {
|
|
|
109
106
|
return this.client.desiredCapabilities.browserName === 'safari' || this.client.desiredCapabilities.browserName === 'safari technology preview';
|
|
110
107
|
}
|
|
111
108
|
|
|
112
|
-
isIE() {
|
|
113
|
-
return this.client.desiredCapabilities.browserName === 'internet explorer';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
109
|
isAndroid() {
|
|
117
110
|
return this.client.desiredCapabilities.platformName === 'Android';
|
|
118
111
|
}
|
|
119
112
|
|
|
120
|
-
isEdge() {
|
|
121
|
-
return this.client.desiredCapabilities.browserName === 'MicrosoftEdge' && this.client.desiredCapabilities._isOldEdge;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
113
|
isEdgeChromium() {
|
|
125
114
|
return this.client.desiredCapabilities.browserName === 'MicrosoftEdge' && !this.client.desiredCapabilities._isOldEdge;
|
|
126
115
|
}
|
|
@@ -169,7 +158,7 @@ class WebdriverioWebDriverApi {
|
|
|
169
158
|
return newEndpoint();
|
|
170
159
|
}
|
|
171
160
|
|
|
172
|
-
|
|
161
|
+
throw err;
|
|
173
162
|
});
|
|
174
163
|
});
|
|
175
164
|
}
|
|
@@ -220,7 +209,7 @@ class WebdriverioWebDriverApi {
|
|
|
220
209
|
return newEndpoint();
|
|
221
210
|
}
|
|
222
211
|
|
|
223
|
-
|
|
212
|
+
throw err;
|
|
224
213
|
});
|
|
225
214
|
});
|
|
226
215
|
}
|
|
@@ -275,7 +264,7 @@ class WebdriverioWebDriverApi {
|
|
|
275
264
|
return newEndpoint();
|
|
276
265
|
}
|
|
277
266
|
|
|
278
|
-
|
|
267
|
+
throw err;
|
|
279
268
|
});
|
|
280
269
|
});
|
|
281
270
|
}
|
|
@@ -299,7 +288,7 @@ class WebdriverioWebDriverApi {
|
|
|
299
288
|
return newEndpoint();
|
|
300
289
|
}
|
|
301
290
|
|
|
302
|
-
|
|
291
|
+
throw err;
|
|
303
292
|
});
|
|
304
293
|
});
|
|
305
294
|
}
|
|
@@ -337,7 +326,7 @@ class WebdriverioWebDriverApi {
|
|
|
337
326
|
this.w3cRequests.timeouts = true;
|
|
338
327
|
return newEndpoint();
|
|
339
328
|
}
|
|
340
|
-
|
|
329
|
+
throw err;
|
|
341
330
|
});
|
|
342
331
|
});
|
|
343
332
|
}
|
|
@@ -373,7 +362,7 @@ class WebdriverioWebDriverApi {
|
|
|
373
362
|
}
|
|
374
363
|
|
|
375
364
|
keys(value) {
|
|
376
|
-
const checkUnicode =
|
|
365
|
+
const checkUnicode = _value => (UNICODE_CHARACTERS.hasOwnProperty(_value) ? [UNICODE_CHARACTERS[_value]] : _value.split(''));
|
|
377
366
|
|
|
378
367
|
let key = [];
|
|
379
368
|
|
|
@@ -392,8 +381,8 @@ class WebdriverioWebDriverApi {
|
|
|
392
381
|
|
|
393
382
|
const oldEndpoint = () => this.client.requestHandler.create('/session/:sessionId/keys', { value: key });
|
|
394
383
|
const newEndpoint = () => {
|
|
395
|
-
const keyDownActions = key.map((
|
|
396
|
-
const keyUpActions = key.map((
|
|
384
|
+
const keyDownActions = key.map((_value) => ({ type: 'keyDown', value: _value }));
|
|
385
|
+
const keyUpActions = key.map((_value) => ({ type: 'keyUp', value: _value }));
|
|
397
386
|
|
|
398
387
|
return this.actions([{
|
|
399
388
|
type: 'key',
|
|
@@ -415,7 +404,7 @@ class WebdriverioWebDriverApi {
|
|
|
415
404
|
return newEndpoint();
|
|
416
405
|
}
|
|
417
406
|
|
|
418
|
-
|
|
407
|
+
throw err;
|
|
419
408
|
}));
|
|
420
409
|
}
|
|
421
410
|
|
|
@@ -537,7 +526,7 @@ class WebdriverioWebDriverApi {
|
|
|
537
526
|
// we make sure to use its absolute value.
|
|
538
527
|
data = {
|
|
539
528
|
width: Math.abs(size.width),
|
|
540
|
-
height: Math.abs(
|
|
529
|
+
height: Math.abs(size.height),
|
|
541
530
|
};
|
|
542
531
|
}
|
|
543
532
|
|
|
@@ -568,7 +557,7 @@ class WebdriverioWebDriverApi {
|
|
|
568
557
|
return newEndpoint();
|
|
569
558
|
}
|
|
570
559
|
|
|
571
|
-
|
|
560
|
+
throw err;
|
|
572
561
|
});
|
|
573
562
|
});
|
|
574
563
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable prefer-template */
|
|
2
|
-
|
|
3
1
|
'use strict';
|
|
4
2
|
|
|
5
3
|
const Promise = require('bluebird');
|
|
@@ -17,15 +15,6 @@ const logger = require('../../commons/logger').getLogger('base-js-step-action');
|
|
|
17
15
|
const _ = require('lodash');
|
|
18
16
|
const utils = require('../../utils');
|
|
19
17
|
|
|
20
|
-
function constructWithArguments(constructor, args) {
|
|
21
|
-
function F() {
|
|
22
|
-
return constructor.apply(this, args);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
F.prototype = constructor.prototype;
|
|
26
|
-
return new F();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
18
|
class BaseJsStepAction extends StepAction {
|
|
30
19
|
isExceedingMaxResultSize(data, context) {
|
|
31
20
|
try {
|
|
@@ -45,16 +34,16 @@ class BaseJsStepAction extends StepAction {
|
|
|
45
34
|
}
|
|
46
35
|
|
|
47
36
|
executeGetStatus(transactionId) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const sessionItem = 'data-testim-' + transactionId;
|
|
37
|
+
return this.driver.executeJS(_transactionId => {
|
|
38
|
+
/* eslint-disable no-undef */
|
|
39
|
+
const sessionItem = `data-testim-${_transactionId}`;
|
|
52
40
|
try {
|
|
53
41
|
return window.sessionStorage.getItem(sessionItem);
|
|
54
42
|
} catch (err) {
|
|
55
|
-
if (
|
|
56
|
-
err.message.
|
|
57
|
-
err.message.
|
|
43
|
+
if (
|
|
44
|
+
err.message.includes('sessionStorage') || // Chrome + Firefox
|
|
45
|
+
err.message.includes('The operation is insecure') // Safari
|
|
46
|
+
) {
|
|
58
47
|
const storage = document.head.querySelector('#testim-storage-backup');
|
|
59
48
|
if (!storage) {
|
|
60
49
|
return '{}';
|
|
@@ -63,8 +52,8 @@ class BaseJsStepAction extends StepAction {
|
|
|
63
52
|
}
|
|
64
53
|
throw err;
|
|
65
54
|
}
|
|
55
|
+
/* eslint-enable no-undef */
|
|
66
56
|
}, transactionId);
|
|
67
|
-
/* eslint-enable prefer-arrow-callback, no-undef, unicorn/prefer-includes, no-shadow */
|
|
68
57
|
}
|
|
69
58
|
|
|
70
59
|
constructJSFunParams(eventData) {
|
|
@@ -146,7 +135,7 @@ class BaseJsStepAction extends StepAction {
|
|
|
146
135
|
let funcToRunString = 'undefined';
|
|
147
136
|
if (useExperimentalPreCompilation) {
|
|
148
137
|
const paramNames = rawParams.function.params.slice(0, -1);
|
|
149
|
-
funcToRunString =
|
|
138
|
+
funcToRunString = experimentalAsyncCustomCode ? `async function(${paramNames.join(',')}) {
|
|
150
139
|
${eventMessage.code}
|
|
151
140
|
};` : `function(${paramNames.join(',')}) {
|
|
152
141
|
${eventMessage.code}
|
|
@@ -158,16 +147,15 @@ class BaseJsStepAction extends StepAction {
|
|
|
158
147
|
const runCode = `
|
|
159
148
|
${hasLocateParams ? `var getLocatedElement = ${codeSnippets.getLocatedElementCode};` : ';'}
|
|
160
149
|
var runCode = ${runCodeScript.toString()};
|
|
161
|
-
var eventData =
|
|
150
|
+
var eventData = arguments[0];
|
|
162
151
|
var funcToRun = ${funcToRunString};
|
|
163
152
|
return runCode.call(null, eventData, funcToRun);
|
|
164
153
|
`;
|
|
165
|
-
const params = this.driver.isEdge() ? JSON.stringify(rawParams) : rawParams;
|
|
166
154
|
if (!useExperimentalPreCompilation) {
|
|
167
|
-
return this.driver.executeJS(runCode,
|
|
155
|
+
return this.driver.executeJS(runCode, rawParams);
|
|
168
156
|
}
|
|
169
157
|
|
|
170
|
-
return this.driver.executeJS(runCode,
|
|
158
|
+
return this.driver.executeJS(runCode, rawParams).catch(err => this.handleExecutionError(err));
|
|
171
159
|
}
|
|
172
160
|
|
|
173
161
|
codeExecDone(resp) {
|
|
@@ -276,20 +264,9 @@ class BaseJsStepAction extends StepAction {
|
|
|
276
264
|
err.seleniumStack.orgStatusMessage;
|
|
277
265
|
|
|
278
266
|
if (canExtractError) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
throw new Error(reason);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// IE has unhelpful messages
|
|
286
|
-
try {
|
|
287
|
-
constructWithArguments(Function, rawParams.function.params.concat([eventMessage.code]));
|
|
288
|
-
} catch (err) {
|
|
289
|
-
if (err instanceof SyntaxError) {
|
|
290
|
-
throw new Error(err.message);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
267
|
+
const endOfMessage = err.seleniumStack.orgStatusMessage.indexOf('\nBuild info');
|
|
268
|
+
const reason = err.seleniumStack.orgStatusMessage.slice(0, endOfMessage === -1 ? undefined : endOfMessage);
|
|
269
|
+
throw new Error(reason);
|
|
293
270
|
}
|
|
294
271
|
|
|
295
272
|
throw err;
|
|
@@ -52,8 +52,7 @@ function createUtils(driver) {
|
|
|
52
52
|
window.close();
|
|
53
53
|
}, 1000 * 60);
|
|
54
54
|
}
|
|
55
|
-
window.document
|
|
56
|
-
return window.document;
|
|
55
|
+
return Object.assign(window.document, { TESTIM_URL: url });
|
|
57
56
|
},
|
|
58
57
|
|
|
59
58
|
shouldUseNativeVisibilityCheck(locateStep, driver, visibilityUtils, positionUtils) {
|
|
@@ -72,27 +71,11 @@ function createUtils(driver) {
|
|
|
72
71
|
if (driver.isSafari()) {
|
|
73
72
|
return featureFlags.flags.useSafariWebdriverVisibilityChecks.isEnabled();
|
|
74
73
|
}
|
|
75
|
-
if (driver.isIE()) {
|
|
76
|
-
return featureFlags.flags.useIEWebdriverVisibilityChecks.isEnabled();
|
|
77
|
-
}
|
|
78
74
|
return true;
|
|
79
75
|
},
|
|
80
76
|
|
|
81
77
|
/** @type {typeof import('clickim/src/background/stepActions/locateStepAction').LocateStepAction['isVisible']} */
|
|
82
78
|
async isVisible(target, targetElement, rect, locateStep, frameHandler, allOffsets, dom) {
|
|
83
|
-
const skipVisibilityCheck = featureFlags.flags.disableEdgeVisibilityChecks.isEnabled() && driver.isEdge();
|
|
84
|
-
|
|
85
|
-
if (skipVisibilityCheck) {
|
|
86
|
-
logger.info('bypassed visibility check because of feature flag');
|
|
87
|
-
target.visibilityCheckSkipped = skipVisibilityCheck;
|
|
88
|
-
try {
|
|
89
|
-
await driver.isVisible(target.seleniumElement);
|
|
90
|
-
} catch {
|
|
91
|
-
/* ignored */
|
|
92
|
-
}
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
79
|
const useNativeVisibilityCheck = this.shouldUseNativeVisibilityCheck(locateStep, driver, visibilityUtils, positionUtils);
|
|
97
80
|
if (useNativeVisibilityCheck) {
|
|
98
81
|
return driver.isVisible(target.seleniumElement);
|
|
@@ -48,17 +48,14 @@ class MouseStepAction extends StepAction {
|
|
|
48
48
|
var getLocatedElement = ${codeSnippets.getLocatedElementCode};
|
|
49
49
|
var dispatchFocus = ${dispatchFocus.toString()};
|
|
50
50
|
var doClick = ${doClickScript.toString()};
|
|
51
|
-
var eventData =
|
|
51
|
+
var eventData = arguments[0];
|
|
52
52
|
var done = arguments[1];
|
|
53
53
|
return doClick.call(null, eventData, done);
|
|
54
54
|
`;
|
|
55
55
|
|
|
56
|
-
// hack for Edge (17/18) which does not accept properties with negative (throws Unknown Error)
|
|
57
|
-
// values between 0 and -1 -_-.
|
|
58
|
-
const eventParam = this.driver.isEdge() ? JSON.stringify(eventMessage) : eventMessage;
|
|
59
56
|
|
|
60
57
|
try {
|
|
61
|
-
const result = await this.driver.executeCodeAsync(doClickCode, timeout,
|
|
58
|
+
const result = await this.driver.executeCodeAsync(doClickCode, timeout, eventMessage);
|
|
62
59
|
if (result.value?.success) {
|
|
63
60
|
return { success: true };
|
|
64
61
|
}
|
|
@@ -192,7 +189,7 @@ class MouseStepAction extends StepAction {
|
|
|
192
189
|
};
|
|
193
190
|
// will skip left click and double click on Edge.
|
|
194
191
|
const skipFileInputClick =
|
|
195
|
-
|
|
192
|
+
featureFlagService.flags.skipFileInputClicks.isEnabled() &&
|
|
196
193
|
target.tagName === 'INPUT' &&
|
|
197
194
|
(target.elementSymbol.includes('type="file"') ||
|
|
198
195
|
target.elementSymbol.includes('type=\'file\'') ||
|
|
@@ -219,8 +216,7 @@ class MouseStepAction extends StepAction {
|
|
|
219
216
|
if (this.step.toElement) {
|
|
220
217
|
const destTarget = this.context.data.toElement;
|
|
221
218
|
if (this.step.isHTML5Drag) {
|
|
222
|
-
|
|
223
|
-
if (!isIE && featureFlagService.flags.usePortedHtml5DragDrop.isEnabled()) {
|
|
219
|
+
if (featureFlagService.flags.usePortedHtml5DragDrop.isEnabled()) {
|
|
224
220
|
const events = this.generateHTML5DragEventSequence();
|
|
225
221
|
const timeout = this.context.data.timeToPlayStep + 3000;
|
|
226
222
|
const contextTarget = this.context.data[this.step.targetId || 'targetId'];
|
|
@@ -243,32 +239,25 @@ class MouseStepAction extends StepAction {
|
|
|
243
239
|
locatedElement: contextTarget.locatedElement,
|
|
244
240
|
isRoot: contextTarget.isRoot,
|
|
245
241
|
};
|
|
246
|
-
// hack for Edge (17/18) which does not accept properties with negative (throws Unknown Error)
|
|
247
|
-
// values between 0 and -1 -_-.
|
|
248
|
-
const eventParam = this.driver.isEdge() ? JSON.stringify(eventMessage) : eventMessage;
|
|
249
242
|
const html5DNDCode = `
|
|
250
243
|
var getLocatedElement = ${codeSnippets.getLocatedElementCode};
|
|
251
244
|
var dnd = ${html5dndActionV2.toString()};
|
|
252
|
-
var eventData =
|
|
245
|
+
var eventData = arguments[0];
|
|
253
246
|
var done = arguments[1];
|
|
254
247
|
return dnd.call(null, eventData, done);
|
|
255
248
|
`;
|
|
256
|
-
return this.driver.executeCodeAsync(html5DNDCode, timeout,
|
|
249
|
+
return this.driver.executeCodeAsync(html5DNDCode, timeout, eventMessage);
|
|
257
250
|
}
|
|
258
251
|
|
|
259
252
|
const html5DNDCode = `
|
|
260
253
|
var getLocatedElement = ${codeSnippets.getLocatedElementCode};
|
|
261
254
|
var dnd = ${html5dndAction.toString()};
|
|
262
|
-
var eventData =
|
|
255
|
+
var eventData = arguments[0];
|
|
263
256
|
return dnd.call(null, eventData);
|
|
264
257
|
`;
|
|
265
258
|
|
|
266
259
|
const eventMessage = { fromLocatedElement: locatedElement, toLocatedElement: destTarget.locatedElement };
|
|
267
|
-
|
|
268
|
-
// hack for Edge (17/18) which does not accept properties with negative (throws Unknown Error)
|
|
269
|
-
// values between 0 and -1 -_-.
|
|
270
|
-
const eventParam = this.driver.isEdge() ? JSON.stringify(eventMessage) : eventMessage;
|
|
271
|
-
return this.driver.executeJS(html5DNDCode, eventParam);
|
|
260
|
+
return this.driver.executeJS(html5DNDCode, eventMessage);
|
|
272
261
|
}
|
|
273
262
|
|
|
274
263
|
const rectsAndOffsets = this.getDnDRectsAndOffsets(target, destTarget, this.step.element.clickOffset, this.step.toElement.clickOffset);
|
|
@@ -279,7 +268,7 @@ class MouseStepAction extends StepAction {
|
|
|
279
268
|
// This is the old way, which uses selenium action (AKA "native" drag).
|
|
280
269
|
// return this.driver.drag(seleniumElement, rectWithoutFrameOffset, xOffset, yOffset, this.step.events);
|
|
281
270
|
}
|
|
282
|
-
const useRightClickJS =
|
|
271
|
+
const useRightClickJS = this.driver.isSafari() && this.step.button === 2;
|
|
283
272
|
const forceNativeEvent = this.driver.isSafari() && target.tagName === 'SELECT';
|
|
284
273
|
|
|
285
274
|
if (this.driver.isSafari() && forceNativeEvent) {
|
|
@@ -32,9 +32,9 @@ const runCode = function (eventData, preCompiledCode) {
|
|
|
32
32
|
const isQuotaExceededError = err.message.toLowerCase().indexOf('quota') > -1;
|
|
33
33
|
const isNativeFunctionError = err.message === nativeFuncErrMsg;
|
|
34
34
|
|
|
35
|
-
if (
|
|
35
|
+
if (
|
|
36
|
+
err.message.indexOf('sessionStorage') > -1 || // Chrome + Firefox
|
|
36
37
|
err.message.indexOf('The operation is insecure') > -1 || // Safari
|
|
37
|
-
err.message.indexOf('SecurityError') > -1 || // Edge
|
|
38
38
|
isQuotaExceededError ||
|
|
39
39
|
isNativeFunctionError
|
|
40
40
|
) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
/*global WheelEvent */
|
|
3
4
|
var wheel = function (eventData, done) {
|
|
4
5
|
var MAX_WHEEL_EVENT_TIMEOUT = 200;
|
|
@@ -9,30 +10,14 @@ var wheel = function (eventData, done) {
|
|
|
9
10
|
}
|
|
10
11
|
var pointerPosition = userEvent.pointerPosition || {};
|
|
11
12
|
var rect = element.getBoundingClientRect();
|
|
12
|
-
var clientX = pointerPosition.originX && isWithinBounds(rect.left, rect.left + rect.width, pointerPosition.originX) ? pointerPosition.originX : rect.left + (rect.width/2);
|
|
13
|
-
var clientY = pointerPosition.originY && isWithinBounds(rect.top,
|
|
14
|
-
return {x: clientX, y: clientY};
|
|
13
|
+
var clientX = pointerPosition.originX && isWithinBounds(rect.left, rect.left + rect.width, pointerPosition.originX) ? pointerPosition.originX : rect.left + (rect.width / 2);
|
|
14
|
+
var clientY = pointerPosition.originY && isWithinBounds(rect.top, rect.top + rect.height, pointerPosition.originY) ? pointerPosition.originY : rect.top + (rect.height / 2);
|
|
15
|
+
return { x: clientX, y: clientY };
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
function getWheelEvent(userEvent, eventData, element) {
|
|
18
|
-
var isIE = (navigator.appVersion.indexOf('Trident/') > 0) || (navigator.userAgent.indexOf('MSIE') !== -1);
|
|
19
|
-
return isIE ?
|
|
20
|
-
getWheelEventIE(userEvent, eventData, element) :
|
|
21
|
-
getWheelEventNonIE(userEvent, eventData, element);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function getWheelEventIE(userEvent, eventData, element) {
|
|
25
|
-
var pos = getEventPosition(userEvent, element);
|
|
26
|
-
var modifiers = (eventData && eventData.modifiers) || {};
|
|
27
|
-
var modifiersString = Object.keys(modifiers).join(" ");
|
|
28
|
-
var event = document.createEvent('WheelEvent');
|
|
29
|
-
event.initWheelEvent('wheel', true, true, window, 0, 0, 0, pos.x, pos.y, 0, null, modifiersString, userEvent.deltaX, userEvent.deltaY, userEvent.deltaZ, userEvent.deltaMode);
|
|
30
|
-
return event;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function getWheelEventNonIE(userEvent, eventData, element) {
|
|
34
19
|
var pos = getEventPosition(userEvent, element);
|
|
35
|
-
var modifiers =
|
|
20
|
+
var modifiers = eventData?.modifiers || {};
|
|
36
21
|
var dict = {
|
|
37
22
|
deltaX: userEvent.deltaX,
|
|
38
23
|
deltaY: userEvent.deltaY,
|
|
@@ -45,14 +30,14 @@ var wheel = function (eventData, done) {
|
|
|
45
30
|
ctrl: Boolean(modifiers.ctrl),
|
|
46
31
|
alt: Boolean(modifiers.alt),
|
|
47
32
|
shift: Boolean(modifiers.shift),
|
|
48
|
-
meta: Boolean(modifiers.meta)
|
|
33
|
+
meta: Boolean(modifiers.meta),
|
|
49
34
|
};
|
|
50
35
|
return new WheelEvent('wheel', dict);
|
|
51
36
|
}
|
|
52
37
|
|
|
53
38
|
function executeEvents(events, element) {
|
|
54
39
|
if (events.length === 0) {
|
|
55
|
-
return done({state:
|
|
40
|
+
return done({ state: 'success' });
|
|
56
41
|
}
|
|
57
42
|
if (!element) {
|
|
58
43
|
throw new Error('element not found');
|
|
@@ -50,16 +50,12 @@ class TextStepAction extends StepAction {
|
|
|
50
50
|
var getLocatedElement = ${codeSnippets.getLocatedElementCode};
|
|
51
51
|
var dispatchFocus = ${dispatchFocus};
|
|
52
52
|
var setText = ${setTextScript.toString()};
|
|
53
|
-
var eventData =
|
|
53
|
+
var eventData = arguments[0];
|
|
54
54
|
var done = arguments[1];
|
|
55
55
|
return setText.call(null, eventData, done);
|
|
56
56
|
`;
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
// values between 0 and -1 -_-.
|
|
60
|
-
const eventParam = this.driver.isEdge() ? JSON.stringify(eventMessage) : eventMessage;
|
|
61
|
-
|
|
62
|
-
const result = await this.driver.executeCodeAsync(setTextCode, timeout, eventParam);
|
|
58
|
+
const result = await this.driver.executeCodeAsync(setTextCode, timeout, eventMessage);
|
|
63
59
|
return { success: Boolean(result.value?.success) };
|
|
64
60
|
}
|
|
65
61
|
|
|
@@ -28,16 +28,12 @@ class WheelStepAction extends StepAction {
|
|
|
28
28
|
const wheelCode = `
|
|
29
29
|
var getLocatedElement = ${codeSnippets.getLocatedElementCode};
|
|
30
30
|
var wheel = ${wheelScript.toString()};
|
|
31
|
-
var eventData =
|
|
31
|
+
var eventData = arguments[0];
|
|
32
32
|
var done = arguments[1];
|
|
33
33
|
return wheel.call(null, eventData, done);
|
|
34
34
|
`;
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
// values between 0 and -1 -_-.
|
|
38
|
-
const eventParam = this.driver.isEdge() ? JSON.stringify(eventMessage) : eventMessage;
|
|
39
|
-
|
|
40
|
-
const result = await this.driver.executeCodeAsync(wheelCode, timeout, eventParam);
|
|
36
|
+
const result = await this.driver.executeCodeAsync(wheelCode, timeout, eventMessage);
|
|
41
37
|
return { success: result.value?.state === 'success' };
|
|
42
38
|
}
|
|
43
39
|
}
|
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
|
|