webdriverio 5.18.4 → 5.18.5

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.
@@ -7,14 +7,16 @@ exports.default = addValue;
7
7
 
8
8
  var _utils = require("../../utils");
9
9
 
10
- function addValue(value) {
10
+ function addValue(value, {
11
+ translateToUnicode = true
12
+ } = {}) {
11
13
  if (!this.isW3C) {
12
- return this.elementSendKeys(this.elementId, (0, _utils.transformToCharString)(value));
14
+ return this.elementSendKeys(this.elementId, (0, _utils.transformToCharString)(value, translateToUnicode));
13
15
  }
14
16
 
15
17
  if (this.isMobile) {
16
- return this.elementSendKeys(this.elementId, (0, _utils.transformToCharString)(value).join(''), (0, _utils.transformToCharString)(value));
18
+ return this.elementSendKeys(this.elementId, (0, _utils.transformToCharString)(value, translateToUnicode).join(''), (0, _utils.transformToCharString)(value, translateToUnicode));
17
19
  }
18
20
 
19
- return this.elementSendKeys(this.elementId, (0, _utils.transformToCharString)(value).join(''));
21
+ return this.elementSendKeys(this.elementId, (0, _utils.transformToCharString)(value, translateToUnicode).join(''));
20
22
  }
@@ -5,7 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = setValue;
7
7
 
8
- async function setValue(value) {
8
+ async function setValue(value, {
9
+ translateToUnicode = true
10
+ } = {}) {
9
11
  await this.clearValue();
10
- return this.addValue(value);
12
+ return this.addValue(value, {
13
+ translateToUnicode: translateToUnicode
14
+ });
11
15
  }
package/build/utils.js CHANGED
@@ -93,7 +93,7 @@ function getBrowserObject(elem) {
93
93
  return elem.parent ? getBrowserObject(elem.parent) : elem;
94
94
  }
95
95
 
96
- function transformToCharString(value) {
96
+ function transformToCharString(value, translateToUnicode = true) {
97
97
  const ret = [];
98
98
 
99
99
  if (!Array.isArray(value)) {
@@ -102,7 +102,7 @@ function transformToCharString(value) {
102
102
 
103
103
  for (const val of value) {
104
104
  if (typeof val === 'string') {
105
- ret.push(...checkUnicode(val));
105
+ translateToUnicode ? ret.push(...checkUnicode(val)) : ret.push(...`${val}`.split(''));
106
106
  } else if (typeof val === 'number') {
107
107
  const entry = `${val}`.split('');
108
108
  ret.push(...entry);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "webdriverio",
3
3
  "description": "Next-gen WebDriver test automation framework for Node.js",
4
- "version": "5.18.4",
4
+ "version": "5.18.5",
5
5
  "homepage": "https://webdriver.io",
6
6
  "author": "Christian Bromann <christian@saucelabs.com>",
7
7
  "license": "MIT",
@@ -72,5 +72,5 @@
72
72
  "serialize-error": "^5.0.0",
73
73
  "webdriver": "5.18.4"
74
74
  },
75
- "gitHead": "5ef407080fe47eb9337b183d07cc3c59cd9e7f9b"
75
+ "gitHead": "aedc9e87b21f4333b8390b6598748591a669bb03"
76
76
  }
@@ -242,10 +242,12 @@ declare namespace WebdriverIO {
242
242
  * characters like Left arrow or Back space. WebdriverIO will take care of
243
243
  * translating them into unicode characters. You’ll find all supported characters
244
244
  * [here](https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions).
245
- * To do that, the value has to correspond to a key from the table.
245
+ * To do that, the value has to correspond to a key from the table. It can be disabled
246
+ * by setting `translateToUnicode` optional parameter to false.
246
247
  */
247
248
  addValue(
248
- value: string | number | boolean | object | any[]
249
+ value: string | number | boolean | object | any[],
250
+ options?: AddValueOptions
249
251
  ): void;
250
252
 
251
253
  /**
@@ -487,10 +489,12 @@ declare namespace WebdriverIO {
487
489
  * unicode characters like Left arrow or Back space. WebdriverIO will take care of
488
490
  * translating them into unicode characters. You’ll find all supported characters
489
491
  * [here](https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions).
490
- * To do that, the value has to correspond to a key from the table.
492
+ * To do that, the value has to correspond to a key from the table. It can be disabled
493
+ * by setting `translateToUnicode` optional parameter to false.
491
494
  */
492
495
  setValue(
493
- value: string | number | boolean | object | any[]
496
+ value: string | number | boolean | object | any[],
497
+ options?: AddValueOptions
494
498
  ): void;
495
499
 
496
500
  /**
@@ -790,4 +794,8 @@ declare namespace WebdriverIO {
790
794
  }
791
795
 
792
796
  interface Config extends Options, Omit<WebDriver.Options, "capabilities">, Hooks {}
797
+
798
+ interface AddValueOptions {
799
+ translateToUnicode: boolean
800
+ }
793
801
  }
@@ -242,10 +242,12 @@ declare namespace WebdriverIO {
242
242
  * characters like Left arrow or Back space. WebdriverIO will take care of
243
243
  * translating them into unicode characters. You’ll find all supported characters
244
244
  * [here](https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions).
245
- * To do that, the value has to correspond to a key from the table.
245
+ * To do that, the value has to correspond to a key from the table. It can be disabled
246
+ * by setting `translateToUnicode` optional parameter to false.
246
247
  */
247
248
  addValue(
248
- value: string | number | boolean | object | any[]
249
+ value: string | number | boolean | object | any[],
250
+ options?: AddValueOptions
249
251
  ): Promise<void>;
250
252
 
251
253
  /**
@@ -487,10 +489,12 @@ declare namespace WebdriverIO {
487
489
  * unicode characters like Left arrow or Back space. WebdriverIO will take care of
488
490
  * translating them into unicode characters. You’ll find all supported characters
489
491
  * [here](https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions).
490
- * To do that, the value has to correspond to a key from the table.
492
+ * To do that, the value has to correspond to a key from the table. It can be disabled
493
+ * by setting `translateToUnicode` optional parameter to false.
491
494
  */
492
495
  setValue(
493
- value: string | number | boolean | object | any[]
496
+ value: string | number | boolean | object | any[],
497
+ options?: AddValueOptions
494
498
  ): Promise<void>;
495
499
 
496
500
  /**
@@ -790,4 +794,8 @@ declare namespace WebdriverIO {
790
794
  }
791
795
 
792
796
  interface Config extends Options, Omit<WebDriver.Options, "capabilities">, Hooks {}
797
+
798
+ interface AddValueOptions {
799
+ translateToUnicode: boolean
800
+ }
793
801
  }