testcafe 2.3.1-rc.2 → 2.4.0-rc.1

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/LICENSE +1 -1
  3. package/README.md +40 -46
  4. package/lib/api/test-controller/execution-context.js +4 -2
  5. package/lib/browser/connection/gateway.js +43 -1
  6. package/lib/browser/connection/index.js +24 -10
  7. package/lib/browser/connection/service-routes.js +3 -1
  8. package/lib/browser/provider/built-in/dedicated/chrome/index.js +19 -5
  9. package/lib/browser/provider/index.js +4 -1
  10. package/lib/client/automation/deps/hammerhead.js +24 -0
  11. package/lib/client/automation/deps/testcafe-core.js +24 -0
  12. package/lib/client/automation/index.js +251 -54
  13. package/lib/client/automation/index.min.js +1 -1
  14. package/lib/client/automation/playback/press/get-key-info.js +44 -0
  15. package/lib/client/automation/playback/press/utils.js +142 -0
  16. package/lib/client/automation/utils/get-key-code.js +15 -0
  17. package/lib/client/automation/utils/get-key-identifier.js +14 -0
  18. package/lib/client/automation/utils/is-letter.js +7 -0
  19. package/lib/client/automation/utils/key-identifier-maps.js +93 -0
  20. package/lib/client/browser/idle-page/index.js +7 -2
  21. package/lib/client/core/index.js +46 -3
  22. package/lib/client/core/index.min.js +1 -1
  23. package/lib/client/driver/index.js +45 -17
  24. package/lib/client/driver/index.min.js +1 -1
  25. package/lib/client/test-run/index.js.mustache +34 -30
  26. package/lib/client/ui/index.js +3230 -48
  27. package/lib/client/ui/index.min.js +1 -1
  28. package/lib/client/ui/sprite.svg +15 -0
  29. package/lib/client/ui/styles.css +183 -41
  30. package/lib/live/test-runner.js +4 -2
  31. package/lib/proxyless/api-base.js +3 -2
  32. package/lib/proxyless/client/event-descriptor.js +67 -0
  33. package/lib/proxyless/client/input.js +36 -0
  34. package/lib/proxyless/client/key-press/utils.js +31 -0
  35. package/lib/proxyless/client/types.js +1 -1
  36. package/lib/proxyless/client/utils.js +32 -2
  37. package/lib/proxyless/cookie-provider.js +31 -3
  38. package/lib/proxyless/errors.js +20 -0
  39. package/lib/proxyless/index.js +2 -10
  40. package/lib/proxyless/request-pipeline/index.js +32 -3
  41. package/lib/proxyless/resource-injector.js +5 -4
  42. package/lib/proxyless/types.js +3 -2
  43. package/lib/proxyless/utils/cdp.js +4 -3
  44. package/lib/reporter/index.js +2 -1
  45. package/lib/runner/bootstrapper.js +8 -1
  46. package/lib/runner/index.js +57 -44
  47. package/lib/shared/utils/is-file-protocol.js +2 -2
  48. package/lib/test-run/commands/actions.js +2 -2
  49. package/lib/test-run/cookies/base.js +4 -1
  50. package/lib/test-run/cookies/provider.js +9 -2
  51. package/lib/test-run/execute-js-expression/index.js +4 -2
  52. package/lib/test-run/index.js +17 -12
  53. package/lib/test-run/request/create-request-options.js +23 -12
  54. package/lib/test-run/request/send.js +2 -3
  55. package/lib/utils/check-is-vm.js +58 -0
  56. package/package.json +9 -6
  57. package/lib/proxyless/client/event-simulator.js +0 -40
@@ -271,7 +271,8 @@ window['%hammerhead%'].utils.removeInjectedScript();
271
271
  var reverse = createNativeMethodWrapper('reverse');
272
272
  var reduce = createNativeMethodWrapper('reduce');
273
273
  var concat = createNativeMethodWrapper('concat');
274
- var join = createNativeMethodWrapper('join');
274
+ var join = createNativeMethodWrapper('join');
275
+ var every = createNativeMethodWrapper('every');
275
276
 
276
277
  var browserUtils = hammerhead__default.utils.browser;
277
278
  var nativeMethods$1 = hammerhead__default.nativeMethods;
@@ -3053,8 +3054,9 @@ window['%hammerhead%'].utils.removeInjectedScript();
3053
3054
  var EventType;
3054
3055
  (function (EventType) {
3055
3056
  EventType[EventType["Mouse"] = 0] = "Mouse";
3056
- EventType[EventType["Key"] = 1] = "Key";
3057
+ EventType[EventType["Keyboard"] = 1] = "Keyboard";
3057
3058
  EventType[EventType["Touch"] = 2] = "Touch";
3059
+ EventType[EventType["Delay"] = 3] = "Delay";
3058
3060
  })(EventType || (EventType = {}));
3059
3061
 
3060
3062
  var KeyModifierValues;
@@ -3065,8 +3067,16 @@ window['%hammerhead%'].utils.removeInjectedScript();
3065
3067
  KeyModifierValues[KeyModifierValues["shift"] = 8] = "shift";
3066
3068
  })(KeyModifierValues || (KeyModifierValues = {}));
3067
3069
 
3070
+ var EMPTY_MODIFIERS = {
3071
+ ctrl: false,
3072
+ alt: false,
3073
+ shift: false,
3074
+ meta: false,
3075
+ };
3068
3076
  function calculateKeyModifiersValue(modifiers) {
3069
3077
  var result = 0;
3078
+ if (!modifiers)
3079
+ return result;
3070
3080
  if (modifiers.ctrl)
3071
3081
  result |= KeyModifierValues.ctrl;
3072
3082
  if (modifiers.alt)
@@ -3077,6 +3087,24 @@ window['%hammerhead%'].utils.removeInjectedScript();
3077
3087
  result |= KeyModifierValues.meta;
3078
3088
  return result;
3079
3089
  }
3090
+ function getModifiersState(modifiersBit) {
3091
+ var modifiers = hammerhead.utils.extend({}, EMPTY_MODIFIERS);
3092
+ if (!modifiersBit)
3093
+ return modifiers;
3094
+ if (modifiersBit & KeyModifierValues.ctrl)
3095
+ modifiers.ctrl = true;
3096
+ if (modifiersBit & KeyModifierValues.alt)
3097
+ modifiers.alt = true;
3098
+ if (modifiersBit & KeyModifierValues.shift)
3099
+ modifiers.shift = true;
3100
+ if (modifiersBit & KeyModifierValues.meta)
3101
+ modifiers.meta = true;
3102
+ return modifiers;
3103
+ }
3104
+ function getModifiersBit(key) {
3105
+ // @ts-ignore
3106
+ return KeyModifierValues[key] || 0;
3107
+ }
3080
3108
  function calculateMouseButtonValue(options) {
3081
3109
  if (!options.button)
3082
3110
  return 'left';
@@ -3087,29 +3115,89 @@ window['%hammerhead%'].utils.removeInjectedScript();
3087
3115
  clickCount: 1,
3088
3116
  button: 'left',
3089
3117
  };
3090
- var ProxylessEventSimulator = /** @class */ (function () {
3091
- function ProxylessEventSimulator(dispatchEventFn, leftTopPoint) {
3092
- this._dispatchEventFn = dispatchEventFn;
3093
- this._leftTopPoint = leftTopPoint || new AxisValues(0, 0);
3094
- }
3095
- ProxylessEventSimulator.prototype._createMouseEventOptions = function (type, options) {
3118
+ var CDPEventDescriptor = /** @class */ (function () {
3119
+ function CDPEventDescriptor() {
3120
+ }
3121
+ CDPEventDescriptor._getKeyDownEventText = function (options) {
3122
+ if (options.isNewLine)
3123
+ return '\r';
3124
+ if (options.keyProperty.length === 1)
3125
+ return options.keyProperty;
3126
+ return '';
3127
+ };
3128
+ CDPEventDescriptor.createKeyDownOptions = function (options) {
3129
+ var text = CDPEventDescriptor._getKeyDownEventText(options);
3130
+ return {
3131
+ type: text ? 'keyDown' : 'rawKeyDown',
3132
+ modifiers: options.modifiers || 0,
3133
+ windowsVirtualKeyCode: options.keyCode,
3134
+ key: options.keyProperty,
3135
+ text: text,
3136
+ };
3137
+ };
3138
+ CDPEventDescriptor.createKeyUpOptions = function (options) {
3139
+ return {
3140
+ type: 'keyUp',
3141
+ modifiers: options.modifiers || 0,
3142
+ key: options.keyProperty,
3143
+ windowsVirtualKeyCode: options.keyCode,
3144
+ };
3145
+ };
3146
+ CDPEventDescriptor.createMouseEventOptions = function (type, options, leftTopPoint) {
3096
3147
  return hammerhead.utils.extend({
3097
- x: options.options.clientX + this._leftTopPoint.x,
3098
- y: options.options.clientY + this._leftTopPoint.y,
3148
+ x: options.options.clientX + leftTopPoint.x,
3149
+ y: options.options.clientY + leftTopPoint.y,
3099
3150
  modifiers: calculateKeyModifiersValue(options.options),
3100
3151
  button: calculateMouseButtonValue(options.options),
3101
3152
  type: type,
3102
3153
  }, MOUSE_EVENT_OPTIONS);
3103
3154
  };
3104
- ProxylessEventSimulator.prototype.mouseDown = function (options) {
3105
- var eventOptions = this._createMouseEventOptions('mousePressed', options);
3106
- return this._dispatchEventFn(EventType.Mouse, eventOptions);
3155
+ CDPEventDescriptor.delay = function (delay) {
3156
+ return {
3157
+ type: EventType.Delay,
3158
+ options: { delay: delay },
3159
+ };
3160
+ };
3161
+ CDPEventDescriptor.keyDown = function (keyInfo) {
3162
+ return {
3163
+ type: EventType.Keyboard,
3164
+ options: CDPEventDescriptor.createKeyDownOptions(keyInfo),
3165
+ };
3166
+ };
3167
+ CDPEventDescriptor.keyUp = function (keyInfo) {
3168
+ return {
3169
+ type: EventType.Keyboard,
3170
+ options: CDPEventDescriptor.createKeyUpOptions(keyInfo),
3171
+ };
3172
+ };
3173
+ return CDPEventDescriptor;
3174
+ }());
3175
+
3176
+ var ProxylessInput = /** @class */ (function () {
3177
+ function ProxylessInput(dispatchEventFn, leftTopPoint) {
3178
+ this._dispatchEventFn = dispatchEventFn;
3179
+ this._leftTopPoint = leftTopPoint || new AxisValues(0, 0);
3180
+ }
3181
+ ProxylessInput.prototype.mouseDown = function (options) {
3182
+ var eventOptions = CDPEventDescriptor.createMouseEventOptions('mousePressed', options, this._leftTopPoint);
3183
+ return this._dispatchEventFn.single(EventType.Mouse, eventOptions);
3184
+ };
3185
+ ProxylessInput.prototype.mouseUp = function (options) {
3186
+ var eventOptions = CDPEventDescriptor.createMouseEventOptions('mouseReleased', options, this._leftTopPoint);
3187
+ return this._dispatchEventFn.single(EventType.Mouse, eventOptions);
3188
+ };
3189
+ ProxylessInput.prototype.keyDown = function (options) {
3190
+ var eventOptions = CDPEventDescriptor.createKeyDownOptions(options);
3191
+ return this._dispatchEventFn.single(EventType.Keyboard, eventOptions);
3107
3192
  };
3108
- ProxylessEventSimulator.prototype.mouseUp = function (options) {
3109
- var eventOptions = this._createMouseEventOptions('mouseReleased', options);
3110
- return this._dispatchEventFn(EventType.Mouse, eventOptions);
3193
+ ProxylessInput.prototype.keyUp = function (options) {
3194
+ var eventOptions = CDPEventDescriptor.createKeyUpOptions(options);
3195
+ return this._dispatchEventFn.single(EventType.Keyboard, eventOptions);
3111
3196
  };
3112
- return ProxylessEventSimulator;
3197
+ ProxylessInput.prototype.executeEventSequence = function (eventSequence) {
3198
+ return this._dispatchEventFn.sequence(eventSequence);
3199
+ };
3200
+ return ProxylessInput;
3113
3201
  }());
3114
3202
 
3115
3203
  var AVAILABLE_OFFSET_DEEP = 2;
@@ -3156,7 +3244,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
3156
3244
  _this.automationSettings = new AutomationSettings(offsetOptions.speed || 1);
3157
3245
  _this.window = win;
3158
3246
  _this.cursor = cursor;
3159
- _this.proxylessEventSimulator = dispatchProxylessEventFn ? new ProxylessEventSimulator(dispatchProxylessEventFn, topLeftPoint) : null;
3247
+ _this.proxylessInput = dispatchProxylessEventFn ? new ProxylessInput(dispatchProxylessEventFn, topLeftPoint) : null;
3160
3248
  // NOTE: only for legacy API
3161
3249
  _this._ensureWindowAndCursorForLegacyTests(_this);
3162
3250
  return _this;
@@ -3166,7 +3254,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
3166
3254
  automation.cursor = cursor;
3167
3255
  };
3168
3256
  VisibleElementAutomation.prototype.canUseProxylessEventSimulator = function (element) {
3169
- return !!this.proxylessEventSimulator
3257
+ return !!this.proxylessInput
3170
3258
  && !!element
3171
3259
  && getTagName(element) !== 'select';
3172
3260
  };
@@ -3913,12 +4001,20 @@ window['%hammerhead%'].utils.removeInjectedScript();
3913
4001
  }
3914
4002
  ClickAutomation.prototype._mousedown = function (eventArgs) {
3915
4003
  if (this.canUseProxylessEventSimulator(eventArgs.element))
3916
- return this.proxylessEventSimulator.mouseDown(eventArgs);
4004
+ return this.proxylessInput.mouseDown(eventArgs);
3917
4005
  return this.strategy.mousedown(eventArgs);
3918
4006
  };
3919
4007
  ClickAutomation.prototype._mouseup = function (element, eventArgs) {
3920
- if (this.canUseProxylessEventSimulator(eventArgs.element))
3921
- return this.proxylessEventSimulator.mouseUp(eventArgs);
4008
+ var _this = this;
4009
+ if (this.canUseProxylessEventSimulator(eventArgs.element)) {
4010
+ return this.proxylessInput.mouseUp(eventArgs)
4011
+ .then(function (result) {
4012
+ var caretPos = _this.options.caretPos;
4013
+ if (typeof caretPos === 'number')
4014
+ setCaretPosition(element, caretPos);
4015
+ return result;
4016
+ });
4017
+ }
3922
4018
  return this.strategy.mouseup(element, eventArgs);
3923
4019
  };
3924
4020
  ClickAutomation.prototype.run = function (useStrictElementCheck) {
@@ -5023,11 +5119,13 @@ window['%hammerhead%'].utils.removeInjectedScript();
5023
5119
  return correctFocusableElement(allFocusable, allFocusable[currentIndex + offset], skipRadioGroups);
5024
5120
  }
5025
5121
 
5026
- function getKeyCode (char) {
5027
- if (isLetterKey(char))
5028
- return char.toUpperCase().charCodeAt(0);
5029
- var res = testCafeCore.KEY_MAPS.shiftMap[char] ? testCafeCore.KEY_MAPS.shiftMap[char].charCodeAt(0) : char.charCodeAt(0);
5030
- return testCafeCore.KEY_MAPS.symbolCharCodeToKeyCode[res] || res;
5122
+ function getKeyProperties(isKeyPressEvent, key, keyIdentifier) {
5123
+ var properties = {};
5124
+ if ('keyIdentifier' in KeyboardEvent.prototype)
5125
+ properties.keyIdentifier = isKeyPressEvent ? '' : keyIdentifier;
5126
+ if ('key' in KeyboardEvent.prototype)
5127
+ properties.key = key;
5128
+ return properties;
5031
5129
  }
5032
5130
 
5033
5131
  var KEY_IDENTIFIER_MAPS = {
@@ -5127,13 +5225,44 @@ window['%hammerhead%'].utils.removeInjectedScript();
5127
5225
  return KEY_IDENTIFIER_MAPS.SYMBOLS[char] || KEY_IDENTIFIER_MAPS.SPECIAL_KEYS[char] || char;
5128
5226
  }
5129
5227
 
5130
- function getKeyProperties(isKeyPressEvent, key, keyIdentifier) {
5131
- var properties = {};
5132
- if ('keyIdentifier' in KeyboardEvent.prototype)
5133
- properties.keyIdentifier = isKeyPressEvent ? '' : keyIdentifier;
5134
- if ('key' in KeyboardEvent.prototype)
5135
- properties.key = key;
5136
- return properties;
5228
+ function getKeyCode (char) {
5229
+ if (isLetterKey(char))
5230
+ return char.toUpperCase().charCodeAt(0);
5231
+ var res = testCafeCore.KEY_MAPS.shiftMap[char] ? testCafeCore.KEY_MAPS.shiftMap[char].charCodeAt(0) : char.charCodeAt(0);
5232
+ return testCafeCore.KEY_MAPS.symbolCharCodeToKeyCode[res] || res;
5233
+ }
5234
+
5235
+ function isNewLineKey(key) {
5236
+ return testCafeCore.KEY_MAPS.newLineKeys.indexOf(key) > -1;
5237
+ }
5238
+ function getKeyInfo (key, eventKeyProperty) {
5239
+ var sanitizedKey = testCafeCore.getSanitizedKey(key);
5240
+ var isChar = key.length === 1 || key === 'space';
5241
+ var isNewLine = isNewLineKey(key);
5242
+ var modifierKeyCode = testCafeCore.KEY_MAPS.modifiers[sanitizedKey];
5243
+ var specialKeyCode = testCafeCore.KEY_MAPS.specialKeys[sanitizedKey];
5244
+ eventKeyProperty = eventKeyProperty || key;
5245
+ return {
5246
+ sanitizedKey: sanitizedKey,
5247
+ isChar: isChar,
5248
+ modifierKeyCode: modifierKeyCode,
5249
+ specialKeyCode: specialKeyCode,
5250
+ isNewLine: isNewLine,
5251
+ isLetter: isLetterKey(key),
5252
+ keyIdentifierProperty: getKeyIdentifier(eventKeyProperty),
5253
+ keyProperty: testCafeCore.KEY_MAPS.keyProperty[eventKeyProperty] || eventKeyProperty,
5254
+ keyCode: getResultKeyCode(key, isChar, sanitizedKey, modifierKeyCode, specialKeyCode),
5255
+ };
5256
+ }
5257
+ function getResultKeyCode(key, isChar, sanitizedKey, modifierKeyCode, specialKeyCode) {
5258
+ var keyCode = null;
5259
+ if (isChar && key !== 'space')
5260
+ keyCode = getKeyCode(sanitizedKey);
5261
+ else if (modifierKeyCode)
5262
+ keyCode = modifierKeyCode;
5263
+ else if (specialKeyCode)
5264
+ keyCode = specialKeyCode;
5265
+ return keyCode;
5137
5266
  }
5138
5267
 
5139
5268
  var browserUtils$a = hammerhead__default.utils.browser;
@@ -5141,21 +5270,9 @@ window['%hammerhead%'].utils.removeInjectedScript();
5141
5270
  var eventSimulator$a = hammerhead__default.eventSandbox.eventSimulator;
5142
5271
  var KeyPressSimulator = /** @class */ (function () {
5143
5272
  function KeyPressSimulator(key, eventKeyProperty) {
5144
- this.isLetter = isLetterKey(key);
5145
- this.isChar = key.length === 1 || key === 'space';
5146
- this.sanitizedKey = testCafeCore.getSanitizedKey(key);
5147
- this.modifierKeyCode = testCafeCore.KEY_MAPS.modifiers[this.sanitizedKey];
5148
- this.specialKeyCode = testCafeCore.KEY_MAPS.specialKeys[this.sanitizedKey];
5149
- this.keyCode = null;
5150
- this.keyIdentifierProperty = getKeyIdentifier(eventKeyProperty);
5273
+ var keyInfo = getKeyInfo(key, eventKeyProperty);
5274
+ extend$2(this, keyInfo);
5151
5275
  this.topSameDomainDocument = testCafeCore.domUtils.getTopSameDomainWindow(window).document;
5152
- this.keyProperty = testCafeCore.KEY_MAPS.keyProperty[eventKeyProperty] || eventKeyProperty;
5153
- if (this.isChar && key !== 'space')
5154
- this.keyCode = getKeyCode(this.sanitizedKey);
5155
- else if (this.modifierKeyCode)
5156
- this.keyCode = this.modifierKeyCode;
5157
- else if (this.specialKeyCode)
5158
- this.keyCode = this.specialKeyCode;
5159
5276
  this.storedActiveElement = null;
5160
5277
  }
5161
5278
  KeyPressSimulator._isKeyActivatedInputElement = function (el) {
@@ -5719,6 +5836,21 @@ window['%hammerhead%'].utils.removeInjectedScript();
5719
5836
  _a[SHORTCUT_TYPE.esc] = esc,
5720
5837
  _a);
5721
5838
 
5839
+ function getSimulatedKeyInfo(keyCombination) {
5840
+ var keysArray = testCafeCore.getKeyArray(keyCombination);
5841
+ var _a = getActualKeysAndEventKeyProperties(keysArray), actualKeys = _a.actualKeys, eventKeyProperties = _a.eventKeyProperties;
5842
+ return testCafeCore.arrayUtils.map(actualKeys, function (key, index) {
5843
+ return hammerhead.utils.extend({ key: key }, getKeyInfo(key, eventKeyProperties[index]));
5844
+ });
5845
+ }
5846
+ function changeLetterCaseIfNecessary(keyInfo) {
5847
+ var modifiersState = getModifiersState(keyInfo.modifiers);
5848
+ if (modifiersState.shift && keyInfo.isLetter) {
5849
+ keyInfo.keyProperty = changeLetterCase(keyInfo.keyProperty);
5850
+ keyInfo.keyCode = getKeyCode(keyInfo.keyProperty);
5851
+ }
5852
+ }
5853
+
5722
5854
  var Promise$a = hammerhead__default.Promise;
5723
5855
  var browserUtils$c = hammerhead__default.utils.browser;
5724
5856
  var messageSandbox$3 = hammerhead__default.eventSandbox.message;
@@ -5736,7 +5868,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
5736
5868
  }
5737
5869
  });
5738
5870
  var PressAutomation = /** @class */ (function () {
5739
- function PressAutomation(keyCombinations, options) {
5871
+ function PressAutomation(keyCombinations, options, dispatchProxylessEventFn) {
5740
5872
  this.keyCombinations = keyCombinations;
5741
5873
  this.isSelectElement = false;
5742
5874
  this.pressedKeyString = '';
@@ -5745,6 +5877,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
5745
5877
  this.topSameDomainDocument = testCafeCore.domUtils.getTopSameDomainWindow(window).document;
5746
5878
  this.automationSettings = new AutomationSettings(options.speed);
5747
5879
  this.options = options;
5880
+ this.proxylessInput = dispatchProxylessEventFn ? new ProxylessInput(dispatchProxylessEventFn) : null;
5748
5881
  }
5749
5882
  PressAutomation._getKeyPressSimulators = function (keyCombination) {
5750
5883
  var keysArray = testCafeCore.getKeyArray(keyCombination);
@@ -5834,6 +5967,28 @@ window['%hammerhead%'].utils.removeInjectedScript();
5834
5967
  return testCafeCore.promiseUtils.each(keyPressSimulators, function (keySimulator) { return _this._up(keySimulator); });
5835
5968
  });
5836
5969
  };
5970
+ PressAutomation.prototype._calculateCDPEventSequence = function () {
5971
+ var eventSequence = [];
5972
+ for (var _i = 0, _a = this.keyCombinations; _i < _a.length; _i++) {
5973
+ var keyCombination = _a[_i];
5974
+ var simulatedKeyInfos = getSimulatedKeyInfo(keyCombination);
5975
+ var modifiersBit = 0;
5976
+ for (var _b = 0, simulatedKeyInfos_1 = simulatedKeyInfos; _b < simulatedKeyInfos_1.length; _b++) {
5977
+ var keyInfo = simulatedKeyInfos_1[_b];
5978
+ modifiersBit |= getModifiersBit(keyInfo.key);
5979
+ keyInfo.modifiers = modifiersBit;
5980
+ changeLetterCaseIfNecessary(keyInfo);
5981
+ eventSequence.push(CDPEventDescriptor.keyDown(keyInfo), CDPEventDescriptor.delay(this.automationSettings.keyActionStepDelay));
5982
+ }
5983
+ for (var i = simulatedKeyInfos.length - 1; i >= 0; i--) {
5984
+ var keyInfo = simulatedKeyInfos[i];
5985
+ modifiersBit &= ~getModifiersBit(keyInfo.key);
5986
+ keyInfo.modifiers = modifiersBit;
5987
+ eventSequence.push(CDPEventDescriptor.keyUp(keyInfo));
5988
+ }
5989
+ }
5990
+ return eventSequence;
5991
+ };
5837
5992
  PressAutomation.prototype.run = function () {
5838
5993
  var _this = this;
5839
5994
  var activeElement = testCafeCore.domUtils.getActiveElement();
@@ -5846,6 +6001,10 @@ window['%hammerhead%'].utils.removeInjectedScript();
5846
6001
  };
5847
6002
  return testCafeCore.sendRequestToFrame(msg, PRESS_RESPONSE_CMD, nativeMethods$d.contentWindowGetter.call(activeElement));
5848
6003
  }
6004
+ if (this.proxylessInput) {
6005
+ var eventSequence = this._calculateCDPEventSequence();
6006
+ return this.proxylessInput.executeEventSequence(eventSequence);
6007
+ }
5849
6008
  return testCafeCore.promiseUtils.each(this.keyCombinations, function (combination) {
5850
6009
  return _this
5851
6010
  ._runCombination(combination)
@@ -6415,7 +6574,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
6415
6574
  var delay$5 = testCafeCore__default.delay;
6416
6575
  var SPECIAL_KEYS = testCafeCore__default.KEY_MAPS.specialKeys;
6417
6576
  var TypeAutomation = /** @class */ (function () {
6418
- function TypeAutomation(element, text, typeOptions) {
6577
+ function TypeAutomation(element, text, typeOptions, dispatchProxylessEventFn) {
6419
6578
  this.element = TypeAutomation.findTextEditableChild(element) || element;
6420
6579
  this.typingText = text.toString();
6421
6580
  this.modifiers = typeOptions.modifiers;
@@ -6442,6 +6601,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
6442
6601
  simulateKeypress: true,
6443
6602
  simulateTypeChar: true,
6444
6603
  };
6604
+ this.proxylessInput = dispatchProxylessEventFn ? new ProxylessInput(dispatchProxylessEventFn) : null;
6445
6605
  }
6446
6606
  TypeAutomation.findTextEditableChild = function (element) {
6447
6607
  var innerElement = null;
@@ -6500,6 +6660,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
6500
6660
  caretPos: this.caretPos,
6501
6661
  modifiers: this.modifiers,
6502
6662
  });
6663
+ cursor.shouldRender = !this.proxylessInput;
6503
6664
  var clickAutomation = new ClickAutomation(this.element, clickOptions, window, cursor);
6504
6665
  return clickAutomation
6505
6666
  .run(useStrictElementCheck)
@@ -6526,21 +6687,57 @@ window['%hammerhead%'].utils.removeInjectedScript();
6526
6687
  else if (isContentEditable)
6527
6688
  textSelection$5.deleteSelectionContents(this.element, true);
6528
6689
  }
6690
+ if (this._canUseProxylessInput()) {
6691
+ var eventSequence = this._calculateCDPEventSequence();
6692
+ return this.proxylessInput.executeEventSequence(eventSequence);
6693
+ }
6529
6694
  return promiseUtils.whilst(function () { return !_this._isTypingFinished(); }, function () { return _this._typingStep(); });
6530
6695
  };
6531
6696
  TypeAutomation.prototype._isTypingFinished = function () {
6532
6697
  return this.currentPos === this.typingText.length;
6533
6698
  };
6699
+ TypeAutomation.prototype._getCurrentKey = function (keyCode, char) {
6700
+ return keyCode === SPECIAL_KEYS['enter'] ? 'Enter' : char;
6701
+ };
6702
+ TypeAutomation.prototype._calculateCDPEventSequence = function () {
6703
+ var eventSequence = [];
6704
+ for (var _i = 0, _a = this.typingText; _i < _a.length; _i++) {
6705
+ var char = _a[_i];
6706
+ var currentKeyCode = getKeyCode(char);
6707
+ var currentKey = this._getCurrentKey(currentKeyCode, char);
6708
+ var keyInfo = getKeyInfo(currentKey);
6709
+ var simulatedKeyInfo = extend$4({ key: currentKey }, keyInfo);
6710
+ eventSequence.push(CDPEventDescriptor.keyDown(simulatedKeyInfo), CDPEventDescriptor.keyUp(simulatedKeyInfo), CDPEventDescriptor.delay(this.automationSettings.keyActionStepDelay));
6711
+ }
6712
+ return eventSequence;
6713
+ };
6714
+ TypeAutomation.prototype._canUseProxylessInput = function () {
6715
+ if (!this.proxylessInput)
6716
+ return false;
6717
+ // NOTE: 'paste' is a synthetic option that don't have equivalent for native user action.
6718
+ if (this.paste)
6719
+ return false;
6720
+ // NOTE: Type to non text-editable and content-editable elements are not supported in the proxyless mode.
6721
+ // In this case, TestCafe just set element value with raising events.
6722
+ if (!domUtils$d.isTextEditableElement(this.element)
6723
+ && domUtils$d.isInputElement(this.element)
6724
+ || domUtils$d.isContentEditableElement(this.element))
6725
+ return false;
6726
+ return true;
6727
+ };
6728
+ TypeAutomation.prototype._performTypingStep = function () {
6729
+ this._keydown();
6730
+ this._keypress();
6731
+ return this._keyup();
6732
+ };
6534
6733
  TypeAutomation.prototype._typingStep = function () {
6535
6734
  var char = this.typingText.charAt(this.currentPos);
6536
6735
  this.currentKeyCode = getKeyCode(char);
6537
6736
  this.currentCharCode = this.typingText.charCodeAt(this.currentPos);
6538
- this.currentKey = this.currentKeyCode === SPECIAL_KEYS['enter'] ? 'Enter' : char;
6737
+ this.currentKey = this._getCurrentKey(this.currentKeyCode, char);
6539
6738
  this.currentKeyIdentifier = getKeyIdentifier(this.currentKey);
6540
6739
  this.ignoreChangeEvent = domUtils$d.getElementValue(this.element) === elementEditingWatcher$1.getElementSavedValue(this.element);
6541
- this._keydown();
6542
- this._keypress();
6543
- return this._keyup();
6740
+ return this._performTypingStep();
6544
6741
  };
6545
6742
  TypeAutomation.prototype._keydown = function () {
6546
6743
  this.eventArgs = this._calculateEventArguments();