@percy/webdriver-utils 1.27.4-beta.0 → 1.27.5-alpha.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/dist/driver.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import utils from '@percy/sdk-utils';
2
2
  import Cache from './util/cache.js';
3
+ import httpsAgent from './util/utils.js';
3
4
  const {
4
5
  request
5
6
  } = utils;
@@ -13,8 +14,11 @@ export default class Driver {
13
14
  async getCapabilites() {
14
15
  return await Cache.withCache(Cache.caps, this.sessionId, async () => {
15
16
  try {
17
+ const options = {
18
+ agent: httpsAgent()
19
+ };
16
20
  const baseUrl = `${this.executorUrl}/session/${this.sessionId}`;
17
- const caps = JSON.parse((await request(baseUrl)).body);
21
+ const caps = JSON.parse((await request(baseUrl, options)).body);
18
22
  return caps.value;
19
23
  } catch (err) {
20
24
  log.warn(`Falling back to legacy protocol, Error: ${err.message}`);
@@ -23,8 +27,11 @@ export default class Driver {
23
27
  });
24
28
  }
25
29
  async getWindowSize() {
30
+ const options = {
31
+ agent: httpsAgent()
32
+ };
26
33
  const baseUrl = `${this.executorUrl}/session/${this.sessionId}/window/current/size`;
27
- const windowSize = JSON.parse((await request(baseUrl)).body);
34
+ const windowSize = JSON.parse((await request(baseUrl, options)).body);
28
35
  return windowSize;
29
36
  }
30
37
 
@@ -43,6 +50,7 @@ export default class Driver {
43
50
  headers: {
44
51
  'Content-Type': 'application/json;charset=utf-8'
45
52
  },
53
+ agent: httpsAgent(),
46
54
  body: JSON.stringify(command)
47
55
  };
48
56
  const baseUrl = `${this.executorUrl}/session/${this.sessionId}/execute/sync`;
@@ -50,13 +58,19 @@ export default class Driver {
50
58
  return response;
51
59
  }
52
60
  async takeScreenshot() {
61
+ const options = {
62
+ agent: httpsAgent()
63
+ };
53
64
  const baseUrl = `${this.executorUrl}/session/${this.sessionId}/screenshot`;
54
- const screenShot = JSON.parse((await request(baseUrl)).body);
65
+ const screenShot = JSON.parse((await request(baseUrl, options)).body);
55
66
  return screenShot.value;
56
67
  }
57
68
  async rect(elementId) {
69
+ const options = {
70
+ agent: httpsAgent()
71
+ };
58
72
  const baseUrl = `${this.executorUrl}/session/${this.sessionId}/element/${elementId}/rect`;
59
- const response = JSON.parse((await request(baseUrl)).body);
73
+ const response = JSON.parse((await request(baseUrl, options)).body);
60
74
  return response.value;
61
75
  }
62
76
  async findElement(using, value) {
@@ -65,6 +79,7 @@ export default class Driver {
65
79
  headers: {
66
80
  'Content-Type': 'application/json;charset=utf-8'
67
81
  },
82
+ agent: httpsAgent(),
68
83
  body: JSON.stringify({
69
84
  using,
70
85
  value
@@ -3,6 +3,7 @@ import MetaDataResolver from '../metadata/metaDataResolver.js';
3
3
  import Tile from '../util/tile.js';
4
4
  import Driver from '../driver.js';
5
5
  import Cache from '../util/cache.js';
6
+ import httpsAgent from '../util/utils.js';
6
7
  const {
7
8
  request
8
9
  } = utils;
@@ -241,7 +242,7 @@ export default class GenericProvider {
241
242
  async getHeaderFooter(deviceName, osVersion, browserName) {
242
243
  // passing 0 as key, since across different pages and tests, this config will remain same
243
244
  const devicesConfig = await Cache.withCache(Cache.devicesConfig, 0, async () => {
244
- return (await request(DEVICES_CONFIG_URL)).body;
245
+ return (await request(DEVICES_CONFIG_URL, httpsAgent())).body;
245
246
  });
246
247
  let deviceKey = `${deviceName}-${osVersion}`;
247
248
  return devicesConfig[deviceKey] ? devicesConfig[deviceKey][browserName] ? [devicesConfig[deviceKey][browserName].header, devicesConfig[deviceKey][browserName].footer] : [0, 0] : [0, 0];
@@ -0,0 +1,8 @@
1
+ import https from 'https';
2
+ export function httpsAgent() {
3
+ return new https.Agent({
4
+ minVersion: 'TLSv1.2',
5
+ maxVersion: 'TLSv1.2'
6
+ });
7
+ }
8
+ export default httpsAgent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/webdriver-utils",
3
- "version": "1.27.4-beta.0",
3
+ "version": "1.27.5-alpha.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "beta"
12
+ "tag": "alpha"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -29,8 +29,8 @@
29
29
  "test:coverage": "yarn test --coverage"
30
30
  },
31
31
  "dependencies": {
32
- "@percy/config": "1.27.4-beta.0",
33
- "@percy/sdk-utils": "1.27.4-beta.0"
32
+ "@percy/config": "1.27.5-alpha.0",
33
+ "@percy/sdk-utils": "1.27.5-alpha.0"
34
34
  },
35
- "gitHead": "d83228ad59736923285426854572f9e1f80ad48f"
35
+ "gitHead": "8ecc32db25f708a01192b8454d0fdf9c051f48a0"
36
36
  }