@cloudscape-design/browser-test-tools 3.0.35 → 3.0.36
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
|
|
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
|
|
41
|
-
const response = await
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
}
|
package/internal/manifest.json
CHANGED
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",
|
|
@@ -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.
|
|
67
|
+
"version": "3.0.36",
|
|
68
68
|
"license": "Apache-2.0"
|
|
69
69
|
}
|