@cloudscape-design/browser-test-tools 3.0.35 → 3.0.37

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.
@@ -1,13 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { URL } from 'url';
3
- import { CredentialsOptions } from 'aws-sdk/lib/credentials';
4
3
  import BrowserCreator from './browser-creator';
5
4
  import { Capabilities } from './capabilities';
6
5
  export interface DevicefarmOptions {
7
6
  retryCount?: number;
8
7
  projectArn: string;
9
8
  expiresInSeconds?: number;
10
- credentials: CredentialsOptions;
11
9
  }
12
10
  export default class DevicefarmBrowserCreator extends BrowserCreator {
13
11
  protected __getBrowserUrl(): Promise<URL>;
@@ -29,33 +29,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
30
30
  // SPDX-License-Identifier: Apache-2.0
31
31
  const url_1 = require("url");
32
- const p_retry_1 = __importStar(require("p-retry"));
33
- const devicefarm_1 = __importDefault(require("aws-sdk/clients/devicefarm"));
32
+ const client_device_farm_1 = require("@aws-sdk/client-device-farm");
34
33
  const browser_creator_1 = __importDefault(require("./browser-creator"));
35
34
  const capabilities_1 = __importStar(require("./capabilities"));
36
35
  const exceptions_1 = require("../exceptions");
37
36
  class DevicefarmBrowserCreator extends browser_creator_1.default {
38
37
  async __getBrowserUrl() {
39
38
  const options = this.options;
40
- const client = new devicefarm_1.default({ credentials: options.credentials, region: 'us-west-2' });
41
- const response = await (0, p_retry_1.default)(async () => {
42
- try {
43
- const response = await client
44
- .createTestGridUrl({
45
- projectArn: options.projectArn,
46
- expiresInSeconds: options.expiresInSeconds || 300,
47
- })
48
- .promise();
49
- return response;
50
- }
51
- catch (error) {
52
- if (isAWSError(error) && error.code === 'ThrottlingException') {
53
- // Retries with backoff when throttled
54
- throw error;
55
- }
56
- throw new p_retry_1.AbortError(error); // Abort on any other error
57
- }
58
- }, { retries: options.retryCount || 10 });
39
+ const client = new client_device_farm_1.DeviceFarm({ region: 'us-west-2' });
40
+ const response = await client.createTestGridUrl({
41
+ projectArn: options.projectArn,
42
+ expiresInSeconds: options.expiresInSeconds || 300,
43
+ });
59
44
  if (!response.url) {
60
45
  throw new exceptions_1.FatalError('Invalid response from devicefarm: ' + JSON.stringify(response));
61
46
  }
@@ -66,6 +51,3 @@ class DevicefarmBrowserCreator extends browser_creator_1.default {
66
51
  }
67
52
  }
68
53
  exports.default = DevicefarmBrowserCreator;
69
- function isAWSError(obj) {
70
- return obj instanceof Error && typeof obj['code'] === 'string';
71
- }
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getPuppeteer = exports.calculateIosTopOffset = exports.getElementCenter = void 0;
4
7
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
8
  // SPDX-License-Identifier: Apache-2.0
9
+ const dns_1 = __importDefault(require("dns"));
6
10
  const exceptions_1 = require("../exceptions");
7
11
  function getElementCenter(rect) {
8
12
  return {
@@ -55,6 +59,8 @@ function calculateIosTopOffset(dimensions) {
55
59
  }
56
60
  exports.calculateIosTopOffset = calculateIosTopOffset;
57
61
  async function getPuppeteer(browser) {
62
+ // Make sure to favor IPv4 name resolution over IPv6 so that the localhost debugger can be found.
63
+ dns_1.default.setDefaultResultOrder('ipv4first');
58
64
  try {
59
65
  const puppeteer = await browser.getPuppeteer();
60
66
  return puppeteer;
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "699d79b2435311df20a20a86a1c1f510ae921927"
2
+ "commit": "1304a2d200899bcfcbd14dc98dceba68253fa79e"
3
3
  }
package/package.json CHANGED
@@ -4,8 +4,8 @@
4
4
  },
5
5
  "bundleDependencies": false,
6
6
  "dependencies": {
7
+ "@aws-sdk/client-device-farm": "^3.398.0",
7
8
  "@types/pngjs": "^6.0.1",
8
- "aws-sdk": "^2.1354.0",
9
9
  "get-stream": "^6.0.1",
10
10
  "lodash": "^4.17.21",
11
11
  "p-retry": "^4.6.2",
@@ -14,7 +14,7 @@
14
14
  "webdriverio": "^7.25.2"
15
15
  },
16
16
  "deprecated": false,
17
- "description": "## ⚠️ This is a generated artifact package and should be treated as **READ-ONLY**. Do not commit directly to this package!",
17
+ "description": "## ⚠️ This is a generated artifact package and should be treated as **READ-ONLY**.",
18
18
  "exports": {
19
19
  "./chrome-launcher": "./chrome-launcher.js",
20
20
  "./image-utils": "./image-utils.js",
@@ -64,6 +64,6 @@
64
64
  "type": "git",
65
65
  "url": "git+https://github.com/cloudscape-design/browser-test-tools.git"
66
66
  },
67
- "version": "3.0.35",
67
+ "version": "3.0.37",
68
68
  "license": "Apache-2.0"
69
69
  }