@cloudscape-design/browser-test-tools 3.0.30 → 3.0.32
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/browsers/browser-creator.d.ts +2 -1
- package/dist/browsers/browser-creator.js +1 -2
- package/dist/browsers/browserstack.d.ts +2 -2
- package/dist/browsers/browserstack.js +1 -1
- package/dist/browsers/capabilities.d.ts +5 -3
- package/dist/browsers/capabilities.js +14 -1
- package/dist/browsers/devicefarm-mobile.d.ts +2 -2
- package/dist/browsers/devicefarm.d.ts +2 -2
- package/dist/browsers/devicefarm.js +1 -8
- package/dist/browsers/local.d.ts +2 -2
- package/dist/browsers/local.js +7 -20
- package/internal/manifest.json +1 -1
- package/package.json +11 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="webdriverio/async" />
|
|
2
2
|
import { RemoteOptions } from 'webdriverio';
|
|
3
|
+
import { Capabilities } from './capabilities';
|
|
3
4
|
export interface WebDriverOptions {
|
|
4
5
|
width: number;
|
|
5
6
|
height: number;
|
|
@@ -17,5 +18,5 @@ export default abstract class BrowserCreator {
|
|
|
17
18
|
protected setupBrowser(overrides: Partial<WebDriverOptions>): Promise<WebdriverIO.Browser>;
|
|
18
19
|
getBrowser(options: Partial<WebDriverOptions>): Promise<WebdriverIO.Browser>;
|
|
19
20
|
protected abstract __getBrowserUrl(): Promise<URL>;
|
|
20
|
-
protected abstract __getCapabilities():
|
|
21
|
+
protected abstract __getCapabilities(): Capabilities;
|
|
21
22
|
}
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
7
|
// SPDX-License-Identifier: Apache-2.0
|
|
8
8
|
const webdriverio_1 = require("webdriverio");
|
|
9
|
-
const exceptions_1 = require("../exceptions");
|
|
10
9
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
10
|
+
const exceptions_1 = require("../exceptions");
|
|
11
11
|
const defaultOptions = {
|
|
12
12
|
width: 1200,
|
|
13
13
|
height: 604,
|
|
@@ -17,7 +17,6 @@ const defaultOptions = {
|
|
|
17
17
|
logLevel: 'error',
|
|
18
18
|
};
|
|
19
19
|
class BrowserCreator {
|
|
20
|
-
// eslint-disable-next-line no-unused-vars
|
|
21
20
|
constructor(browserName, options) {
|
|
22
21
|
this.browserName = browserName;
|
|
23
22
|
this.options = options;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { URL } from 'url';
|
|
4
4
|
import BrowserCreator, { WebDriverOptions } from './browser-creator';
|
|
5
|
-
import
|
|
5
|
+
import { Capabilities } from './capabilities';
|
|
6
6
|
type BrowserstackCredentials = {
|
|
7
7
|
user: string;
|
|
8
8
|
key: string;
|
|
@@ -16,6 +16,6 @@ export type BrowserstackOptions = {
|
|
|
16
16
|
export default class BrowserStackBrowserCreator extends BrowserCreator {
|
|
17
17
|
getBrowser(options: Partial<WebDriverOptions>): Promise<WebdriverIO.Browser>;
|
|
18
18
|
__getBrowserUrl(): Promise<URL>;
|
|
19
|
-
__getCapabilities(): Capabilities
|
|
19
|
+
protected __getCapabilities(): Capabilities;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -126,7 +126,7 @@ class BrowserStackBrowserCreator extends browser_creator_1.default {
|
|
|
126
126
|
return {
|
|
127
127
|
...capabilities,
|
|
128
128
|
'bstack:options': {
|
|
129
|
-
...capabilities['bstack:options'],
|
|
129
|
+
...('bstack:options' in capabilities ? capabilities['bstack:options'] : {}),
|
|
130
130
|
projectName: browserstackOptions.projectName,
|
|
131
131
|
buildName: browserstackOptions.buildName,
|
|
132
132
|
userName: browserstackOptions.credentials.user,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { RemoteOptions } from 'webdriverio';
|
|
2
|
+
export type Capabilities = RemoteOptions['capabilities'];
|
|
3
|
+
declare const defaultCapabilities: Record<string, Capabilities>;
|
|
4
|
+
export declare function getCapability(browserName: string, capabilities: Record<string, Capabilities>): Capabilities;
|
|
5
|
+
export declare function mergeCapabilities<T>(src: T, overrides: Partial<T>): T;
|
|
4
6
|
export default defaultCapabilities;
|
|
@@ -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
|
-
exports.getCapability = void 0;
|
|
6
|
+
exports.mergeCapabilities = exports.getCapability = void 0;
|
|
4
7
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
6
10
|
const exceptions_1 = require("../exceptions");
|
|
7
11
|
const defaultCapabilities = {
|
|
8
12
|
Chrome: {
|
|
@@ -81,4 +85,13 @@ function getCapability(browserName, capabilities) {
|
|
|
81
85
|
return capabilities[browserName];
|
|
82
86
|
}
|
|
83
87
|
exports.getCapability = getCapability;
|
|
88
|
+
function mergeArrays(dest, src) {
|
|
89
|
+
if (Array.isArray(dest) && Array.isArray(src)) {
|
|
90
|
+
return dest.concat(src);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function mergeCapabilities(src, overrides) {
|
|
94
|
+
return lodash_1.default.mergeWith({}, src, overrides, mergeArrays);
|
|
95
|
+
}
|
|
96
|
+
exports.mergeCapabilities = mergeCapabilities;
|
|
84
97
|
exports.default = defaultCapabilities;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { URL } from 'url';
|
|
3
3
|
import BrowserCreator from './browser-creator';
|
|
4
|
-
import
|
|
4
|
+
import { Capabilities } from './capabilities';
|
|
5
5
|
export default class MobileBrowserCreator extends BrowserCreator {
|
|
6
6
|
__getBrowserUrl(): Promise<URL>;
|
|
7
|
-
__getCapabilities(): Capabilities
|
|
7
|
+
__getCapabilities(): Capabilities;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { URL } from 'url';
|
|
3
3
|
import { CredentialsOptions } from 'aws-sdk/lib/credentials';
|
|
4
4
|
import BrowserCreator from './browser-creator';
|
|
5
|
-
import
|
|
5
|
+
import { Capabilities } from './capabilities';
|
|
6
6
|
export interface DevicefarmOptions {
|
|
7
7
|
retryCount?: number;
|
|
8
8
|
projectArn: string;
|
|
@@ -11,5 +11,5 @@ export interface DevicefarmOptions {
|
|
|
11
11
|
}
|
|
12
12
|
export default class DevicefarmBrowserCreator extends BrowserCreator {
|
|
13
13
|
protected __getBrowserUrl(): Promise<URL>;
|
|
14
|
-
protected __getCapabilities(): Capabilities
|
|
14
|
+
protected __getCapabilities(): Capabilities;
|
|
15
15
|
}
|
|
@@ -34,13 +34,6 @@ const devicefarm_1 = __importDefault(require("aws-sdk/clients/devicefarm"));
|
|
|
34
34
|
const browser_creator_1 = __importDefault(require("./browser-creator"));
|
|
35
35
|
const capabilities_1 = __importStar(require("./capabilities"));
|
|
36
36
|
const exceptions_1 = require("../exceptions");
|
|
37
|
-
// This uses undocumented options which prevents proper typing
|
|
38
|
-
const capabilities = {
|
|
39
|
-
...capabilities_1.default,
|
|
40
|
-
IE11: {
|
|
41
|
-
browserName: 'internet explorer',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
37
|
class DevicefarmBrowserCreator extends browser_creator_1.default {
|
|
45
38
|
async __getBrowserUrl() {
|
|
46
39
|
const options = this.options;
|
|
@@ -69,7 +62,7 @@ class DevicefarmBrowserCreator extends browser_creator_1.default {
|
|
|
69
62
|
return new url_1.URL(response.url);
|
|
70
63
|
}
|
|
71
64
|
__getCapabilities() {
|
|
72
|
-
return (0, capabilities_1.getCapability)(this.browserName,
|
|
65
|
+
return (0, capabilities_1.getCapability)(this.browserName, capabilities_1.default);
|
|
73
66
|
}
|
|
74
67
|
}
|
|
75
68
|
exports.default = DevicefarmBrowserCreator;
|
package/dist/browsers/local.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { URL } from 'url';
|
|
3
3
|
import BrowserCreator from './browser-creator';
|
|
4
|
-
import
|
|
4
|
+
import { Capabilities } from './capabilities';
|
|
5
5
|
export default class LocalBrowserCreator extends BrowserCreator {
|
|
6
6
|
__getBrowserUrl(): Promise<URL>;
|
|
7
|
-
__getCapabilities(): Capabilities
|
|
7
|
+
__getCapabilities(): Capabilities;
|
|
8
8
|
}
|
package/dist/browsers/local.js
CHANGED
|
@@ -25,7 +25,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
|
-
var _a, _b;
|
|
29
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
29
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
31
30
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -33,14 +32,8 @@ const url_1 = require("url");
|
|
|
33
32
|
const browser_creator_1 = __importDefault(require("./browser-creator"));
|
|
34
33
|
const capabilities_1 = __importStar(require("./capabilities"));
|
|
35
34
|
const localBrowsers = {
|
|
36
|
-
|
|
37
|
-
Chrome: {
|
|
38
|
-
...capabilities_1.default.Chrome,
|
|
39
|
-
},
|
|
40
|
-
ChromeHeadless: {
|
|
41
|
-
...capabilities_1.default.ChromeHeadless,
|
|
35
|
+
ChromeHeadless: (0, capabilities_1.mergeCapabilities)(capabilities_1.default.ChromeHeadless, {
|
|
42
36
|
'goog:chromeOptions': {
|
|
43
|
-
...capabilities_1.default.ChromeHeadless['goog:chromeOptions'],
|
|
44
37
|
// do not use retina screen when testing locally
|
|
45
38
|
mobileEmulation: {
|
|
46
39
|
deviceMetrics: {
|
|
@@ -48,22 +41,16 @@ const localBrowsers = {
|
|
|
48
41
|
},
|
|
49
42
|
},
|
|
50
43
|
},
|
|
51
|
-
},
|
|
52
|
-
ChromeHeadlessIntegration: {
|
|
53
|
-
...capabilities_1.default.ChromeHeadless,
|
|
44
|
+
}),
|
|
45
|
+
ChromeHeadlessIntegration: (0, capabilities_1.mergeCapabilities)(capabilities_1.default.ChromeHeadless, {
|
|
54
46
|
'goog:chromeOptions': {
|
|
55
|
-
|
|
56
|
-
args: [
|
|
57
|
-
'--force-prefers-reduced-motion',
|
|
58
|
-
...((_b = (_a = capabilities_1.default.ChromeHeadless['goog:chromeOptions']) === null || _a === void 0 ? void 0 : _a.args) !== null && _b !== void 0 ? _b : []),
|
|
59
|
-
],
|
|
47
|
+
args: ['--force-prefers-reduced-motion'],
|
|
60
48
|
},
|
|
61
|
-
},
|
|
62
|
-
Firefox: {
|
|
63
|
-
...capabilities_1.default.Firefox,
|
|
49
|
+
}),
|
|
50
|
+
Firefox: (0, capabilities_1.mergeCapabilities)(capabilities_1.default.Firefox, {
|
|
64
51
|
// https://firefox-source-docs.mozilla.org/testing/geckodriver/Capabilities.html
|
|
65
52
|
'moz:debuggerAddress': true,
|
|
66
|
-
},
|
|
53
|
+
}),
|
|
67
54
|
};
|
|
68
55
|
class LocalBrowserCreator extends browser_creator_1.default {
|
|
69
56
|
async __getBrowserUrl() {
|
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
],
|
|
31
31
|
"homepage": "https://cloudscape.design",
|
|
32
32
|
"jest": {
|
|
33
|
-
"preset": "ts-jest",
|
|
34
33
|
"testEnvironment": "node",
|
|
35
34
|
"collectCoverage": true,
|
|
36
35
|
"collectCoverageFrom": [
|
|
@@ -44,11 +43,16 @@
|
|
|
44
43
|
"lcov",
|
|
45
44
|
"cobertura"
|
|
46
45
|
],
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
"globalSetup": "<rootDir>/test/utils/start-chromedriver.ts",
|
|
47
|
+
"globalTeardown": "<rootDir>/test/utils/stop-chromedriver.ts",
|
|
48
|
+
"transform": {
|
|
49
|
+
"^.+\\.ts$": [
|
|
50
|
+
"ts-jest",
|
|
51
|
+
{
|
|
52
|
+
"tsconfig": "tsconfig.test.json"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
52
56
|
},
|
|
53
57
|
"lint-staged": {
|
|
54
58
|
"*.{js,ts}": [
|
|
@@ -60,6 +64,6 @@
|
|
|
60
64
|
"type": "git",
|
|
61
65
|
"url": "git+https://github.com/cloudscape-design/browser-test-tools.git"
|
|
62
66
|
},
|
|
63
|
-
"version": "3.0.
|
|
67
|
+
"version": "3.0.32",
|
|
64
68
|
"license": "Apache-2.0"
|
|
65
69
|
}
|