@testim/testim-cli 3.273.0 → 3.275.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/npm-shrinkwrap.json +80 -37
- package/package.json +1 -1
- package/player/stepActions/dropFileStepAction.js +1 -2
- package/player/stepActions/scripts/dispatchEvents.js +100 -89
- package/player/stepActions/scripts/doClick.js +82 -84
- package/player/stepActions/scripts/doDragPath.js +84 -85
- package/player/stepActions/scripts/doubleClick.js +38 -36
- package/player/stepActions/scripts/dropEvent.js +27 -24
- package/player/stepActions/scripts/focusElement.js +9 -13
- package/player/stepActions/scripts/html5dragAction.js +15 -15
- package/player/stepActions/scripts/html5dragActionV2.js +44 -45
- package/player/stepActions/scripts/runCode.js +24 -33
- package/player/stepActions/scripts/scroll.js +27 -27
- package/player/stepActions/scripts/selectOption.js +6 -6
- package/player/stepActions/scripts/setText.js +111 -116
- package/player/stepActions/scripts/wheel.js +18 -16
- package/polyfills/index.js +4 -0
- package/testRunStatus.js +1 -25
- package/testimNpmDriver.js +1 -1
- package/player/stepActions/scripts/createDropEventLegacy.js +0 -61
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testim/testim-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.275.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.275.0",
|
|
10
10
|
"license": "Proprietary",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@applitools/eyes-sdk-core": "13.11.21",
|
|
@@ -2344,9 +2344,9 @@
|
|
|
2344
2344
|
}
|
|
2345
2345
|
},
|
|
2346
2346
|
"node_modules/aws4": {
|
|
2347
|
-
"version": "1.
|
|
2348
|
-
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.
|
|
2349
|
-
"integrity": "sha512-
|
|
2347
|
+
"version": "1.12.0",
|
|
2348
|
+
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz",
|
|
2349
|
+
"integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg=="
|
|
2350
2350
|
},
|
|
2351
2351
|
"node_modules/axios": {
|
|
2352
2352
|
"version": "0.21.4",
|
|
@@ -4165,16 +4165,18 @@
|
|
|
4165
4165
|
}
|
|
4166
4166
|
},
|
|
4167
4167
|
"node_modules/deep-equal": {
|
|
4168
|
-
"version": "2.
|
|
4169
|
-
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.
|
|
4170
|
-
"integrity": "sha512-
|
|
4168
|
+
"version": "2.2.0",
|
|
4169
|
+
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.0.tgz",
|
|
4170
|
+
"integrity": "sha512-RdpzE0Hv4lhowpIUKKMJfeH6C1pXdtT1/it80ubgWqwI3qpuxUBpC1S4hnHg+zjnuOoDkzUtUCEEkG+XG5l3Mw==",
|
|
4171
4171
|
"dependencies": {
|
|
4172
4172
|
"call-bind": "^1.0.2",
|
|
4173
4173
|
"es-get-iterator": "^1.1.2",
|
|
4174
4174
|
"get-intrinsic": "^1.1.3",
|
|
4175
4175
|
"is-arguments": "^1.1.1",
|
|
4176
|
+
"is-array-buffer": "^3.0.1",
|
|
4176
4177
|
"is-date-object": "^1.0.5",
|
|
4177
4178
|
"is-regex": "^1.1.4",
|
|
4179
|
+
"is-shared-array-buffer": "^1.0.2",
|
|
4178
4180
|
"isarray": "^2.0.5",
|
|
4179
4181
|
"object-is": "^1.1.5",
|
|
4180
4182
|
"object-keys": "^1.1.1",
|
|
@@ -4183,7 +4185,7 @@
|
|
|
4183
4185
|
"side-channel": "^1.0.4",
|
|
4184
4186
|
"which-boxed-primitive": "^1.0.2",
|
|
4185
4187
|
"which-collection": "^1.0.1",
|
|
4186
|
-
"which-typed-array": "^1.1.
|
|
4188
|
+
"which-typed-array": "^1.1.9"
|
|
4187
4189
|
},
|
|
4188
4190
|
"funding": {
|
|
4189
4191
|
"url": "https://github.com/sponsors/ljharb"
|
|
@@ -4659,9 +4661,9 @@
|
|
|
4659
4661
|
}
|
|
4660
4662
|
},
|
|
4661
4663
|
"node_modules/engine.io-parser": {
|
|
4662
|
-
"version": "5.0.
|
|
4663
|
-
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.
|
|
4664
|
-
"integrity": "sha512
|
|
4664
|
+
"version": "5.0.5",
|
|
4665
|
+
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.5.tgz",
|
|
4666
|
+
"integrity": "sha512-mjEyaa4zhuuRhaSLOdjEb57X0XPP9JEsnXI4E+ivhwT0GgzUogARx4MqoY1jQyB+4Bkz3BUOmzL7t9RMKmlG3g==",
|
|
4665
4667
|
"engines": {
|
|
4666
4668
|
"node": ">=10.0.0"
|
|
4667
4669
|
}
|
|
@@ -6962,6 +6964,19 @@
|
|
|
6962
6964
|
"url": "https://github.com/sponsors/ljharb"
|
|
6963
6965
|
}
|
|
6964
6966
|
},
|
|
6967
|
+
"node_modules/is-array-buffer": {
|
|
6968
|
+
"version": "3.0.1",
|
|
6969
|
+
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz",
|
|
6970
|
+
"integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==",
|
|
6971
|
+
"dependencies": {
|
|
6972
|
+
"call-bind": "^1.0.2",
|
|
6973
|
+
"get-intrinsic": "^1.1.3",
|
|
6974
|
+
"is-typed-array": "^1.1.10"
|
|
6975
|
+
},
|
|
6976
|
+
"funding": {
|
|
6977
|
+
"url": "https://github.com/sponsors/ljharb"
|
|
6978
|
+
}
|
|
6979
|
+
},
|
|
6965
6980
|
"node_modules/is-arrayish": {
|
|
6966
6981
|
"version": "0.3.2",
|
|
6967
6982
|
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
|
|
@@ -7285,6 +7300,17 @@
|
|
|
7285
7300
|
"url": "https://github.com/sponsors/ljharb"
|
|
7286
7301
|
}
|
|
7287
7302
|
},
|
|
7303
|
+
"node_modules/is-shared-array-buffer": {
|
|
7304
|
+
"version": "1.0.2",
|
|
7305
|
+
"resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz",
|
|
7306
|
+
"integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==",
|
|
7307
|
+
"dependencies": {
|
|
7308
|
+
"call-bind": "^1.0.2"
|
|
7309
|
+
},
|
|
7310
|
+
"funding": {
|
|
7311
|
+
"url": "https://github.com/sponsors/ljharb"
|
|
7312
|
+
}
|
|
7313
|
+
},
|
|
7288
7314
|
"node_modules/is-stream": {
|
|
7289
7315
|
"version": "1.1.0",
|
|
7290
7316
|
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
|
@@ -12464,9 +12490,9 @@
|
|
|
12464
12490
|
}
|
|
12465
12491
|
},
|
|
12466
12492
|
"node_modules/punycode": {
|
|
12467
|
-
"version": "2.
|
|
12468
|
-
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.
|
|
12469
|
-
"integrity": "sha512-
|
|
12493
|
+
"version": "2.2.0",
|
|
12494
|
+
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz",
|
|
12495
|
+
"integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==",
|
|
12470
12496
|
"engines": {
|
|
12471
12497
|
"node": ">=6"
|
|
12472
12498
|
}
|
|
@@ -14552,12 +14578,9 @@
|
|
|
14552
14578
|
"integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw=="
|
|
14553
14579
|
},
|
|
14554
14580
|
"node_modules/tinycolor2": {
|
|
14555
|
-
"version": "1.5.
|
|
14556
|
-
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.
|
|
14557
|
-
"integrity": "sha512-
|
|
14558
|
-
"engines": {
|
|
14559
|
-
"node": "*"
|
|
14560
|
-
}
|
|
14581
|
+
"version": "1.5.2",
|
|
14582
|
+
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.2.tgz",
|
|
14583
|
+
"integrity": "sha512-h80m9GPFGbcLzZByXlNSEhp1gf8Dy+VX/2JCGUZsWLo7lV1mnE/XlxGYgRBoMLJh1lIDXP0EMC4RPTjlRaV+Bg=="
|
|
14561
14584
|
},
|
|
14562
14585
|
"node_modules/tmp": {
|
|
14563
14586
|
"version": "0.0.33",
|
|
@@ -17762,9 +17785,9 @@
|
|
|
17762
17785
|
"integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA=="
|
|
17763
17786
|
},
|
|
17764
17787
|
"aws4": {
|
|
17765
|
-
"version": "1.
|
|
17766
|
-
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.
|
|
17767
|
-
"integrity": "sha512-
|
|
17788
|
+
"version": "1.12.0",
|
|
17789
|
+
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz",
|
|
17790
|
+
"integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg=="
|
|
17768
17791
|
},
|
|
17769
17792
|
"axios": {
|
|
17770
17793
|
"version": "0.21.4",
|
|
@@ -19258,16 +19281,18 @@
|
|
|
19258
19281
|
}
|
|
19259
19282
|
},
|
|
19260
19283
|
"deep-equal": {
|
|
19261
|
-
"version": "2.
|
|
19262
|
-
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.
|
|
19263
|
-
"integrity": "sha512-
|
|
19284
|
+
"version": "2.2.0",
|
|
19285
|
+
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.0.tgz",
|
|
19286
|
+
"integrity": "sha512-RdpzE0Hv4lhowpIUKKMJfeH6C1pXdtT1/it80ubgWqwI3qpuxUBpC1S4hnHg+zjnuOoDkzUtUCEEkG+XG5l3Mw==",
|
|
19264
19287
|
"requires": {
|
|
19265
19288
|
"call-bind": "^1.0.2",
|
|
19266
19289
|
"es-get-iterator": "^1.1.2",
|
|
19267
19290
|
"get-intrinsic": "^1.1.3",
|
|
19268
19291
|
"is-arguments": "^1.1.1",
|
|
19292
|
+
"is-array-buffer": "^3.0.1",
|
|
19269
19293
|
"is-date-object": "^1.0.5",
|
|
19270
19294
|
"is-regex": "^1.1.4",
|
|
19295
|
+
"is-shared-array-buffer": "^1.0.2",
|
|
19271
19296
|
"isarray": "^2.0.5",
|
|
19272
19297
|
"object-is": "^1.1.5",
|
|
19273
19298
|
"object-keys": "^1.1.1",
|
|
@@ -19276,7 +19301,7 @@
|
|
|
19276
19301
|
"side-channel": "^1.0.4",
|
|
19277
19302
|
"which-boxed-primitive": "^1.0.2",
|
|
19278
19303
|
"which-collection": "^1.0.1",
|
|
19279
|
-
"which-typed-array": "^1.1.
|
|
19304
|
+
"which-typed-array": "^1.1.9"
|
|
19280
19305
|
}
|
|
19281
19306
|
},
|
|
19282
19307
|
"deep-is": {
|
|
@@ -19644,9 +19669,9 @@
|
|
|
19644
19669
|
}
|
|
19645
19670
|
},
|
|
19646
19671
|
"engine.io-parser": {
|
|
19647
|
-
"version": "5.0.
|
|
19648
|
-
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.
|
|
19649
|
-
"integrity": "sha512
|
|
19672
|
+
"version": "5.0.5",
|
|
19673
|
+
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.5.tgz",
|
|
19674
|
+
"integrity": "sha512-mjEyaa4zhuuRhaSLOdjEb57X0XPP9JEsnXI4E+ivhwT0GgzUogARx4MqoY1jQyB+4Bkz3BUOmzL7t9RMKmlG3g=="
|
|
19650
19675
|
},
|
|
19651
19676
|
"errno": {
|
|
19652
19677
|
"version": "0.1.8",
|
|
@@ -21463,6 +21488,16 @@
|
|
|
21463
21488
|
"has-tostringtag": "^1.0.0"
|
|
21464
21489
|
}
|
|
21465
21490
|
},
|
|
21491
|
+
"is-array-buffer": {
|
|
21492
|
+
"version": "3.0.1",
|
|
21493
|
+
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz",
|
|
21494
|
+
"integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==",
|
|
21495
|
+
"requires": {
|
|
21496
|
+
"call-bind": "^1.0.2",
|
|
21497
|
+
"get-intrinsic": "^1.1.3",
|
|
21498
|
+
"is-typed-array": "^1.1.10"
|
|
21499
|
+
}
|
|
21500
|
+
},
|
|
21466
21501
|
"is-arrayish": {
|
|
21467
21502
|
"version": "0.3.2",
|
|
21468
21503
|
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
|
|
@@ -21687,6 +21722,14 @@
|
|
|
21687
21722
|
"resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz",
|
|
21688
21723
|
"integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g=="
|
|
21689
21724
|
},
|
|
21725
|
+
"is-shared-array-buffer": {
|
|
21726
|
+
"version": "1.0.2",
|
|
21727
|
+
"resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz",
|
|
21728
|
+
"integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==",
|
|
21729
|
+
"requires": {
|
|
21730
|
+
"call-bind": "^1.0.2"
|
|
21731
|
+
}
|
|
21732
|
+
},
|
|
21690
21733
|
"is-stream": {
|
|
21691
21734
|
"version": "1.1.0",
|
|
21692
21735
|
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
|
@@ -25503,9 +25546,9 @@
|
|
|
25503
25546
|
}
|
|
25504
25547
|
},
|
|
25505
25548
|
"punycode": {
|
|
25506
|
-
"version": "2.
|
|
25507
|
-
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.
|
|
25508
|
-
"integrity": "sha512-
|
|
25549
|
+
"version": "2.2.0",
|
|
25550
|
+
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz",
|
|
25551
|
+
"integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw=="
|
|
25509
25552
|
},
|
|
25510
25553
|
"puppeteer-core": {
|
|
25511
25554
|
"version": "13.7.0",
|
|
@@ -27179,9 +27222,9 @@
|
|
|
27179
27222
|
"integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw=="
|
|
27180
27223
|
},
|
|
27181
27224
|
"tinycolor2": {
|
|
27182
|
-
"version": "1.5.
|
|
27183
|
-
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.
|
|
27184
|
-
"integrity": "sha512-
|
|
27225
|
+
"version": "1.5.2",
|
|
27226
|
+
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.2.tgz",
|
|
27227
|
+
"integrity": "sha512-h80m9GPFGbcLzZByXlNSEhp1gf8Dy+VX/2JCGUZsWLo7lV1mnE/XlxGYgRBoMLJh1lIDXP0EMC4RPTjlRaV+Bg=="
|
|
27185
27228
|
},
|
|
27186
27229
|
"tmp": {
|
|
27187
27230
|
"version": "0.0.33",
|
package/package.json
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const StepAction = require('./stepAction');
|
|
4
4
|
const logger = require('../../commons/logger').getLogger('drop-file-step-action');
|
|
5
5
|
const downloadFileAndFireDropEvent = require('./scripts/dropEvent');
|
|
6
|
-
const createDropEventLegacy = require('./scripts/createDropEventLegacy');
|
|
7
6
|
const { codeSnippets, utils } = require('../../commons/getSessionPlayerRequire');
|
|
8
7
|
const featureFlagService = require('../../commons/featureFlags');
|
|
9
8
|
|
|
@@ -21,7 +20,7 @@ class DropFileStepAction extends StepAction {
|
|
|
21
20
|
|
|
22
21
|
const dropFileCode = `
|
|
23
22
|
var getLocatedElement = ${codeSnippets.getLocatedElementCode};
|
|
24
|
-
var createDropEvent = ${
|
|
23
|
+
var createDropEvent = ${codeSnippets.createDropEvent.toString()};
|
|
25
24
|
var downloadFileAndFireDropEvent = ${downloadFileAndFireDropEvent.toString()};
|
|
26
25
|
return downloadFileAndFireDropEvent.apply(null, arguments)
|
|
27
26
|
`;
|
|
@@ -1,56 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const dispatchEvents = function (eventData, done) {
|
|
4
4
|
function getParents(el) {
|
|
5
5
|
return el ? [el].concat(getParents(el.parentNode)) : [];
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
function handleReactSelectFocusQuirk(context, event) {
|
|
9
9
|
function focusReactSelect(element) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return getParents(
|
|
13
|
-
return Array.apply(null, el.classList || []).indexOf("Select-control") !== -1;
|
|
14
|
-
})[0];
|
|
10
|
+
function getReactSelectRoot(_element) {
|
|
11
|
+
// eslint-disable-next-line prefer-spread
|
|
12
|
+
return getParents(_element).find((el) => Array.apply(null, el.classList || []).includes('Select-control'));
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
function getReactSelectInput(
|
|
18
|
-
|
|
19
|
-
return root ? root.querySelector(
|
|
15
|
+
function getReactSelectInput(_element) {
|
|
16
|
+
const root = getReactSelectRoot(_element);
|
|
17
|
+
return root ? root.querySelector('INPUT') : null;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
const reactSelectInput = getReactSelectInput(element);
|
|
23
21
|
if (reactSelectInput) {
|
|
24
22
|
reactSelectInput.focus();
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
if (event.type ===
|
|
26
|
+
const isReactSelectElement = context.quirks?.isReactSelect;
|
|
27
|
+
if (event.type === 'mousedown' && isReactSelectElement) {
|
|
30
28
|
focusReactSelect(context.element);
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
function handleCKEditorQuirk(context, event) {
|
|
35
|
-
|
|
36
|
-
if (event.type ===
|
|
33
|
+
const isCKEditorFrame = context.quirks?.isCKEditorFrame;
|
|
34
|
+
if (event.type === 'click' && isCKEditorFrame) {
|
|
37
35
|
document.body.focus();
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
function dispatchMouseOver() {
|
|
42
|
-
|
|
40
|
+
const event = document.createEvent('Events');
|
|
43
41
|
event.initEvent('mouseover', true, true);
|
|
44
42
|
context.element.dispatchEvent(event);
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
function dispatchMouseMove() {
|
|
48
|
-
|
|
46
|
+
const userEvent = {
|
|
49
47
|
event: 'mousemove',
|
|
50
48
|
modifiers: {},
|
|
51
|
-
button: 0
|
|
49
|
+
button: 0,
|
|
52
50
|
};
|
|
53
|
-
|
|
51
|
+
const event = createMouseEvent(userEvent);
|
|
54
52
|
context.element.dispatchEvent(event);
|
|
55
53
|
}
|
|
56
54
|
|
|
@@ -59,20 +57,20 @@ var dispatchEvents = function (eventData, done) {
|
|
|
59
57
|
return (point > start) && (point < end);
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return {x: clientX, y: clientY};
|
|
60
|
+
const pointerPosition = userEvent.pointerPosition || {};
|
|
61
|
+
const rect = element.getBoundingClientRect();
|
|
62
|
+
const clientX = pointerPosition.originX && isWithinBounds(rect.left, rect.left + rect.width, pointerPosition.originX) ? pointerPosition.originX : rect.left + (rect.width / 2);
|
|
63
|
+
const clientY = pointerPosition.originY && isWithinBounds(rect.top, rect.top + rect.height, pointerPosition.originY) ? pointerPosition.originY : rect.top + (rect.height / 2);
|
|
64
|
+
return { x: clientX, y: clientY };
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
function createMouseEvent(userEvent) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
const position = getEventPosition(userEvent, context.element);
|
|
69
|
+
const modifiers = userEvent.modifiers || context.modifiers || {};
|
|
70
|
+
const button = userEvent.button || context.button || 0;
|
|
71
|
+
const eventType = userEvent.event;
|
|
74
72
|
|
|
75
|
-
|
|
73
|
+
const event = document.createEvent('MouseEvents');
|
|
76
74
|
event.initMouseEvent(
|
|
77
75
|
eventType,
|
|
78
76
|
true, /* bubbles */
|
|
@@ -94,12 +92,12 @@ var dispatchEvents = function (eventData, done) {
|
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
function createPointerEvent(userEvent) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
const position = getEventPosition(userEvent, context.element);
|
|
96
|
+
const modifiers = userEvent.modifiers || context.modifiers || {};
|
|
97
|
+
const eventType = userEvent.event;
|
|
100
98
|
|
|
101
99
|
if (!window.PointerEvent) {
|
|
102
|
-
return;
|
|
100
|
+
return undefined;
|
|
103
101
|
}
|
|
104
102
|
return new window.PointerEvent(eventType, {
|
|
105
103
|
screenX: 0,
|
|
@@ -113,13 +111,13 @@ var dispatchEvents = function (eventData, done) {
|
|
|
113
111
|
bubbles: true,
|
|
114
112
|
cancelable: true,
|
|
115
113
|
composed: true,
|
|
116
|
-
pointerType:
|
|
114
|
+
pointerType: 'mouse',
|
|
117
115
|
isPrimary: true,
|
|
118
116
|
});
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
function createFocusEvent(userEvent) {
|
|
122
|
-
|
|
120
|
+
const event = document.createEvent('FocusEvent');
|
|
123
121
|
// TODO we want to use new Event, but mootools (used by zuora which is used by jfrog)
|
|
124
122
|
// overrides window.Event and throws an error
|
|
125
123
|
event.initEvent(userEvent.event, true, false);
|
|
@@ -127,76 +125,74 @@ var dispatchEvents = function (eventData, done) {
|
|
|
127
125
|
}
|
|
128
126
|
|
|
129
127
|
function createEvent(userEvent) {
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
const eventType = userEvent.event;
|
|
129
|
+
const event = document.createEvent('HTMLEvents');
|
|
132
130
|
event.initEvent(eventType, true, false);
|
|
133
131
|
return event;
|
|
134
132
|
}
|
|
135
133
|
|
|
136
|
-
function dispatchSyncEvent(event) {
|
|
137
|
-
console.log("dispatching: " + event.type);
|
|
138
|
-
console.log(event);
|
|
139
|
-
|
|
140
|
-
context.element.dispatchEvent(event);
|
|
141
|
-
handleReactSelectFocusQuirk(context, event);
|
|
142
|
-
handleCKEditorQuirk(context, event);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
134
|
function dispatchSyncEventSequence() {
|
|
146
135
|
context.events
|
|
147
|
-
.map(
|
|
136
|
+
.map((userEvent) => {
|
|
148
137
|
try {
|
|
149
|
-
if(MOUSE_EVENTS.includes(userEvent.event)) {
|
|
138
|
+
if (MOUSE_EVENTS.includes(userEvent.event)) {
|
|
150
139
|
return createMouseEvent(userEvent);
|
|
151
|
-
}
|
|
140
|
+
} if (POINTER_EVENTS.includes(userEvent.event)) {
|
|
152
141
|
return createPointerEvent(userEvent);
|
|
153
|
-
}
|
|
142
|
+
} if (FOCUS_EVENTS.includes(userEvent.event)) {
|
|
154
143
|
return createFocusEvent(userEvent);
|
|
155
|
-
} else {
|
|
156
|
-
return createEvent(userEvent);
|
|
157
144
|
}
|
|
145
|
+
return createEvent(userEvent);
|
|
158
146
|
} catch (e) {
|
|
159
|
-
// pointer events not supported
|
|
160
|
-
return;
|
|
147
|
+
// pointer events not supported :shrug:
|
|
148
|
+
return undefined;
|
|
161
149
|
}
|
|
162
150
|
})
|
|
163
151
|
.filter(Boolean)
|
|
164
|
-
.forEach(
|
|
165
|
-
|
|
152
|
+
.forEach((event) => {
|
|
153
|
+
// eslint-disable-next-line no-console
|
|
154
|
+
console.log(`dispatching: ${event.type}`);
|
|
155
|
+
// eslint-disable-next-line no-console
|
|
156
|
+
console.log(event);
|
|
157
|
+
|
|
158
|
+
context.element.dispatchEvent(event);
|
|
159
|
+
handleReactSelectFocusQuirk(context, event);
|
|
160
|
+
handleCKEditorQuirk(context, event);
|
|
166
161
|
});
|
|
167
162
|
|
|
168
163
|
if (window.__unloadNavigator) {
|
|
169
|
-
window.removeEventListener(
|
|
164
|
+
window.removeEventListener('unload', window.__unloadNavigator);
|
|
170
165
|
}
|
|
171
166
|
}
|
|
172
167
|
|
|
173
168
|
function findEffectiveActiveElement() {
|
|
174
|
-
|
|
175
|
-
while (activeElement.shadowRoot
|
|
169
|
+
let activeElement = document.activeElement;
|
|
170
|
+
while (activeElement.shadowRoot?.activeElement) {
|
|
176
171
|
activeElement = activeElement.shadowRoot.activeElement;
|
|
177
172
|
}
|
|
178
173
|
return activeElement;
|
|
179
174
|
}
|
|
180
175
|
|
|
181
176
|
function handleFocus() {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
177
|
+
const oldActiveElement = findEffectiveActiveElement();
|
|
178
|
+
const quirks = context.quirks;
|
|
179
|
+
const isReactSelectElement = quirks?.isReactSelect;
|
|
180
|
+
const isCKEditorFrame = quirks?.isCKEditorFrame;
|
|
186
181
|
if (!isReactSelectElement && !isCKEditorFrame) {
|
|
182
|
+
// eslint-disable-next-line no-undef
|
|
187
183
|
dispatchFocus(eventData.elementToFocusLocatedElement, oldActiveElement);
|
|
188
184
|
}
|
|
189
185
|
}
|
|
190
186
|
|
|
191
187
|
function handleSelect() {
|
|
192
|
-
if(context.element.tagName !== OPTION_TAG_NAME) {
|
|
188
|
+
if (context.element.tagName !== OPTION_TAG_NAME) {
|
|
193
189
|
return;
|
|
194
190
|
}
|
|
195
191
|
|
|
196
|
-
|
|
197
|
-
if(context.element.parentElement.tagName === SELECT_TAG_NAME) {
|
|
192
|
+
let selectEl;
|
|
193
|
+
if (context.element.parentElement.tagName === SELECT_TAG_NAME) {
|
|
198
194
|
selectEl = context.element.parentElement;
|
|
199
|
-
} else if(context.element.parentElement.parentElement.tagName === SELECT_TAG_NAME) {
|
|
195
|
+
} else if (context.element.parentElement.parentElement.tagName === SELECT_TAG_NAME) {
|
|
200
196
|
selectEl = context.element.parentElement.parentElement;
|
|
201
197
|
}
|
|
202
198
|
selectEl.blur();
|
|
@@ -206,13 +202,13 @@ var dispatchEvents = function (eventData, done) {
|
|
|
206
202
|
|
|
207
203
|
function fulfill(success, status, result) {
|
|
208
204
|
result = result || {};
|
|
209
|
-
|
|
210
|
-
success
|
|
211
|
-
status
|
|
212
|
-
result
|
|
205
|
+
status = {
|
|
206
|
+
success,
|
|
207
|
+
status,
|
|
208
|
+
result,
|
|
213
209
|
};
|
|
214
210
|
|
|
215
|
-
if(isDoneFnSupplied) {
|
|
211
|
+
if (isDoneFnSupplied) {
|
|
216
212
|
return done(status);
|
|
217
213
|
}
|
|
218
214
|
|
|
@@ -227,35 +223,50 @@ var dispatchEvents = function (eventData, done) {
|
|
|
227
223
|
return fulfill(false, 'failed', result);
|
|
228
224
|
}
|
|
229
225
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
226
|
+
const OPTION_TAG_NAME = 'OPTION';
|
|
227
|
+
const SELECT_TAG_NAME = 'SELECT';
|
|
228
|
+
|
|
229
|
+
const MOUSE_EVENTS = [
|
|
230
|
+
'auxclick',
|
|
231
|
+
'click',
|
|
232
|
+
'contextmenu',
|
|
233
|
+
'dblclick',
|
|
234
|
+
'mousedown',
|
|
235
|
+
'mouseenter',
|
|
236
|
+
'mouseleave',
|
|
237
|
+
'mousemove',
|
|
238
|
+
'mouseover',
|
|
239
|
+
'mouseout',
|
|
240
|
+
'mouseup',
|
|
241
|
+
'pointerlockchange',
|
|
242
|
+
'pointerlockerror',
|
|
243
|
+
'select',
|
|
244
|
+
'wheel',
|
|
245
|
+
];
|
|
246
|
+
const POINTER_EVENTS = ['pointerover', 'pointerenter', 'pointerdown', 'pointermove', 'pointerup', 'pointercancel', 'pointerout', 'pointerleave', 'gotpointercapture', 'lostpointercapture'];
|
|
247
|
+
const FOCUS_EVENTS = ['focus', 'blur', 'focusin', 'focusout'];
|
|
248
|
+
|
|
249
|
+
const isDoneFnSupplied = typeof done !== 'undefined';
|
|
240
250
|
|
|
241
251
|
window.__unloadNavigator = resolve;
|
|
242
|
-
window.addEventListener(
|
|
252
|
+
window.addEventListener('unload', window.__unloadNavigator);
|
|
243
253
|
|
|
244
|
-
|
|
254
|
+
// eslint-disable-next-line no-undef
|
|
255
|
+
const element = eventData.isRoot ? document.documentElement : getLocatedElement(eventData.locatedElement);
|
|
245
256
|
if (!element) {
|
|
246
|
-
return reject(
|
|
257
|
+
return reject('element not found');
|
|
247
258
|
}
|
|
248
259
|
|
|
249
|
-
|
|
250
|
-
element
|
|
260
|
+
const context = {
|
|
261
|
+
element,
|
|
251
262
|
events: eventData.events,
|
|
252
263
|
quirks: eventData.quirks,
|
|
253
264
|
modifiers: eventData.modifiers,
|
|
254
265
|
};
|
|
255
266
|
|
|
256
267
|
try {
|
|
257
|
-
|
|
258
|
-
if(doMousePreparation) {
|
|
268
|
+
const doMousePreparation = eventData.withMousePreparation ? eventData.withMousePreparation : true;
|
|
269
|
+
if (doMousePreparation) {
|
|
259
270
|
dispatchMouseOver();
|
|
260
271
|
dispatchMouseMove();
|
|
261
272
|
}
|