@wdio/browserstack-service 7.19.7 → 7.20.2

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/README.md CHANGED
@@ -50,7 +50,7 @@ exports.config
50
50
  In order to authorize to the BrowserStack service your config needs to contain a [`user`](https://webdriver.io/docs/options#user) and [`key`](https://webdriver.io/docs/options#key) option.
51
51
 
52
52
  ### browserstackLocal
53
- Set this to true to enable routing connections from Browserstack cloud through your computer. You will also need to set `browserstack.local` to true in browser capabilities.
53
+ Set this to true to enable routing connections from Browserstack cloud through your computer.
54
54
 
55
55
  Type: `Boolean`<br />
56
56
  Default: `false`
@@ -68,14 +68,126 @@ Type: `Boolean`<br />
68
68
  Default: `false`
69
69
 
70
70
  ### opts
71
- Specified optional will be passed down to BrowserstackLocal. See [this list](https://www.browserstack.com/local-testing#modifiers) for details.
71
+ Specified optional will be passed down to BrowserstackLocal.
72
72
 
73
73
  Type: `Object`<br />
74
74
  Default: `{}`
75
75
 
76
- ## Known Issues
76
+ List of available local testing modifiers to be passed as opts:
77
77
 
78
- - At the moment, it is challenging, if not impossible, to transfer localIdentifier to child-processes reliably because of how webdriverio designed their multi-process model. We recommend using this service without an identifier, which will create an account-wide local tunnel.
78
+ #### Local Identifier
79
+
80
+ If doing simultaneous multiple local testing connections, set this uniquely for different processes -
81
+
82
+ ```js
83
+ opts = { localIdentifier: "randomstring" };
84
+ ```
85
+
86
+ #### Verbose Logging
87
+
88
+ To enable verbose logging -
89
+
90
+ ```js
91
+ opts = { verbose: "true" };
92
+ ```
93
+
94
+ Note - Possible values for 'verbose' modifier are '1', '2', '3' and 'true'
95
+
96
+ #### Force Local
97
+
98
+ To route all traffic via local(your) machine -
99
+
100
+ ```js
101
+ opts = { forceLocal: "true" };
102
+ ```
103
+
104
+ #### Folder Testing
105
+
106
+ To test local folder rather internal server, provide path to folder as value of this option -
107
+
108
+ ```js
109
+ opts = { f: "/my/awesome/folder" };
110
+ ```
111
+
112
+ #### Force Start
113
+
114
+ To kill other running Browserstack Local instances -
115
+
116
+ ```js
117
+ opts = { force: "true" };
118
+ ```
119
+
120
+ #### Only Automate
121
+
122
+ To disable local testing for Live and Screenshots, and enable only Automate -
123
+
124
+ ```js
125
+ opts = { onlyAutomate: "true" };
126
+ ```
127
+
128
+ #### Proxy
129
+
130
+ To use a proxy for local testing -
131
+
132
+ - proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
133
+ - proxyPort: Port for the proxy, defaults to 3128 when -proxyHost is used
134
+ - proxyUser: Username for connecting to proxy (Basic Auth Only)
135
+ - proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified
136
+
137
+ ```js
138
+ opts = {
139
+ proxyHost: "127.0.0.1",
140
+ proxyPort: "8000",
141
+ proxyUser: "user",
142
+ proxyPass: "password",
143
+ };
144
+ ```
145
+
146
+ #### Local Proxy
147
+
148
+ To use local proxy in local testing -
149
+
150
+ - localProxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
151
+ - localProxyPort: Port for the proxy, defaults to 8081 when -localProxyHost is used
152
+ - localProxyUser: Username for connecting to proxy (Basic Auth Only)
153
+ - localProxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified
154
+
155
+ ```js
156
+ opts = {
157
+ localProxyHost: "127.0.0.1",
158
+ localProxyPort: "8000",
159
+ localProxyUser: "user",
160
+ localProxyPass: "password",
161
+ };
162
+ ```
163
+
164
+ #### PAC (Proxy Auto-Configuration)
165
+
166
+ To use PAC (Proxy Auto-Configuration) in local testing -
167
+
168
+ - pac-file: PAC (Proxy Auto-Configuration) file’s absolute path
169
+
170
+ ```js
171
+ opts = { "pac-file": "<pac_file_abs_path>" };
172
+ ```
173
+
174
+ #### Binary Path
175
+
176
+ By default, BrowserStack local wrappers try downloading and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument.
177
+ Path to specify local Binary path -
178
+
179
+ ```js
180
+ opts = { binarypath: "/path/to/binary" };
181
+ ```
182
+
183
+ #### Logfile
184
+
185
+ To save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory.
186
+ To specify the path to file where the logs will be saved -
187
+
188
+ ```js
189
+ opts = { verbose: "true", logFile: "./local.log" };
190
+ ```
79
191
 
80
192
  ----
81
193
 
@@ -9,7 +9,7 @@ export default class BrowserstackLauncherService implements Services.ServiceInst
9
9
  private _options;
10
10
  private _config;
11
11
  browserstackLocal?: BrowserstackLocal;
12
- constructor(_options: BrowserstackConfig, capabilities: Capabilities.RemoteCapability, _config: Options.Testrunner);
12
+ constructor(_options: BrowserstackConfig & Options.Testrunner, capabilities: Capabilities.RemoteCapability, _config: Options.Testrunner);
13
13
  onPrepare(config?: Options.Testrunner, capabilities?: Capabilities.RemoteCapabilities): void | Promise<unknown>;
14
14
  onComplete(): true | Promise<unknown> | undefined;
15
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAI5C,aAAK,iBAAiB,GAAG,yBAAyB,CAAC,KAAK,GAAG;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;CAC7C,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,YAAW,QAAQ,CAAC,eAAe;IAI5E,OAAO,CAAC,QAAQ;IAEhB,OAAO,CAAC,OAAO;IALnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;gBAGzB,QAAQ,EAAE,kBAAkB,EACpC,YAAY,EAAE,YAAY,CAAC,gBAAgB,EACnC,OAAO,EAAE,OAAO,CAAC,UAAU;IAGvC,SAAS,CAAE,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,YAAY,CAAC,kBAAkB;IA+DtF,UAAU;CAkCb"}
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAI5C,aAAK,iBAAiB,GAAG,yBAAyB,CAAC,KAAK,GAAG;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;CAC7C,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,YAAW,QAAQ,CAAC,eAAe;IAI5E,OAAO,CAAC,QAAQ;IAEhB,OAAO,CAAC,OAAO;IALnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;gBAGzB,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EACzD,YAAY,EAAE,YAAY,CAAC,gBAAgB,EACnC,OAAO,EAAE,OAAO,CAAC,UAAU;IAqBvC,SAAS,CAAE,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,YAAY,CAAC,kBAAkB;IA6DtF,UAAU;CAkCb"}
package/build/launcher.js CHANGED
@@ -30,11 +30,31 @@ const util_1 = require("util");
30
30
  const perf_hooks_1 = require("perf_hooks");
31
31
  const BrowserstackLocalLauncher = __importStar(require("browserstack-local"));
32
32
  const logger_1 = __importDefault(require("@wdio/logger"));
33
+ // @ts-ignore
34
+ const package_json_1 = require("../package.json");
33
35
  const log = (0, logger_1.default)('@wdio/browserstack-service');
34
36
  class BrowserstackLauncherService {
35
37
  constructor(_options, capabilities, _config) {
36
38
  this._options = _options;
37
39
  this._config = _config;
40
+ // added to maintain backward compatibility with webdriverIO v5
41
+ this._config || (this._config = _options);
42
+ if (Array.isArray(capabilities)) {
43
+ capabilities.forEach((capability) => {
44
+ if (!capability['bstack:options']) {
45
+ capability['bstack:options'] = {};
46
+ }
47
+ capability['bstack:options'].wdioService = package_json_1.version;
48
+ });
49
+ }
50
+ else if (typeof capabilities === 'object') {
51
+ Object.entries(capabilities).forEach(([, caps]) => {
52
+ if (!caps.capabilities['bstack:options']) {
53
+ caps.capabilities['bstack:options'] = {};
54
+ }
55
+ caps.capabilities['bstack:options'].wdioService = package_json_1.version;
56
+ });
57
+ }
38
58
  }
39
59
  onPrepare(config, capabilities) {
40
60
  if (!this._options.browserstackLocal) {
@@ -42,8 +62,6 @@ class BrowserstackLauncherService {
42
62
  }
43
63
  const opts = {
44
64
  key: this._config.key,
45
- forcelocal: true,
46
- onlyAutomate: true,
47
65
  ...this._options.opts
48
66
  };
49
67
  this.browserstackLocal = new BrowserstackLocalLauncher.Local();
@@ -11,7 +11,7 @@ export default class BrowserstackService implements Services.ServiceInstance {
11
11
  private _failureStatuses;
12
12
  private _browser?;
13
13
  private _fullTitle?;
14
- constructor(_options: BrowserstackConfig, _caps: Capabilities.RemoteCapability, _config: Options.Testrunner);
14
+ constructor(_options: BrowserstackConfig & Options.Testrunner, _caps: Capabilities.RemoteCapability, _config: Options.Testrunner);
15
15
  _updateCaps(fn: (caps: Capabilities.Capabilities | Capabilities.DesiredCapabilities) => void): void;
16
16
  /**
17
17
  * if no user and key is specified even though a browserstack service was
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AA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,CAAC,IAAI,EAAE,YAAY,CAAC,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC;IAepH,WAAW,CAAE,KAAK,EAAE,UAAU,CAAC,KAAK;IAIpC,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IAKrD,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU;IAqB/E,KAAK,CAAE,MAAM,EAAE,MAAM;IAgBrB;;OAEG;IACH,aAAa,CAAE,KAAK,EAAE,UAAU,CAAC,KAAK;IAmBhC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IA2BzD,cAAc,IAAI,OAAO;IAOzB,UAAU,CAAE,WAAW,EAAE,GAAG;IAU5B,kBAAkB,CAAE,MAAM,EAAE,iBAAiB;IAqB7C,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG;IAUrC,gBAAgB;CAsBzB"}
package/build/service.js CHANGED
@@ -16,6 +16,8 @@ class BrowserstackService {
16
16
  this._failReasons = [];
17
17
  this._scenariosThatRan = [];
18
18
  this._failureStatuses = ['failed', 'ambiguous', 'undefined', 'unknown'];
19
+ // added to maintain backward compatibility with webdriverIO v5
20
+ this._config || (this._config = _options);
19
21
  // Cucumber specific
20
22
  const strict = Boolean(this._config.cucumberOpts && this._config.cucumberOpts.strict);
21
23
  // See https://github.com/cucumber/cucumber-js/blob/master/src/runtime/index.ts#L136
@@ -46,7 +48,8 @@ class BrowserstackService {
46
48
  this._config.key = config.key;
47
49
  }
48
50
  before(caps, specs, browser) {
49
- this._browser = browser;
51
+ // added to maintain backward compatibility with webdriverIO v5
52
+ this._browser = browser ? browser : global.browser;
50
53
  // Ensure capabilities are not null in case of multiremote
51
54
  if (this._isAppAutomate()) {
52
55
  this._sessionBaseUrl = 'https://api-cloud.browserstack.com/app-automate/sessions';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browserstack-service",
3
- "version": "7.19.7",
3
+ "version": "7.20.2",
4
4
  "description": "WebdriverIO service for better Browserstack integration",
5
5
  "author": "Adam Bjerstedt <abjerstedt@gmail.com>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browserstack-service",
@@ -25,10 +25,10 @@
25
25
  "dependencies": {
26
26
  "@types/node": "^17.0.4",
27
27
  "@wdio/logger": "7.19.0",
28
- "@wdio/types": "7.19.5",
28
+ "@wdio/types": "7.20.0",
29
29
  "browserstack-local": "^1.4.5",
30
30
  "got": "^11.0.2",
31
- "webdriverio": "7.19.7"
31
+ "webdriverio": "7.20.2"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@wdio/cli": "^7.0.0"
@@ -37,5 +37,5 @@
37
37
  "access": "public"
38
38
  },
39
39
  "types": "./build/index.d.ts",
40
- "gitHead": "ed5b7278190953d5e77d11083b59db2209ac99b5"
40
+ "gitHead": "51b8a952ec1c8e8265472823759e4cb200c272bc"
41
41
  }