@wdio/sauce-service 7.16.7 → 7.16.11
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/build/service.d.ts +8 -10
- package/build/service.d.ts.map +1 -1
- package/build/service.js +66 -39
- package/build/utils.d.ts +3 -3
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +14 -15
- package/package.json +5 -5
package/build/service.d.ts
CHANGED
|
@@ -12,9 +12,8 @@ export default class SauceService implements Services.ServiceInstance {
|
|
|
12
12
|
private _isJobNameSet;
|
|
13
13
|
private _options;
|
|
14
14
|
private _api;
|
|
15
|
-
private _isLegacyRDC;
|
|
16
15
|
private _browser?;
|
|
17
|
-
private
|
|
16
|
+
private _isRDC?;
|
|
18
17
|
private _suiteTitle?;
|
|
19
18
|
private _cid;
|
|
20
19
|
constructor(options: SauceServiceConfig, _capabilities: Capabilities.RemoteCapability, _config: Options.Testrunner);
|
|
@@ -23,8 +22,8 @@ export default class SauceService implements Services.ServiceInstance {
|
|
|
23
22
|
*/
|
|
24
23
|
beforeSession(_: never, __: never, ___: never, cid: string): void;
|
|
25
24
|
before(caps: unknown, specs: string[], browser: Browser<'async'> | MultiRemoteBrowser<'async'>): void;
|
|
26
|
-
beforeSuite(suite: Frameworks.Suite): void
|
|
27
|
-
beforeTest(test: Frameworks.Test):
|
|
25
|
+
beforeSuite(suite: Frameworks.Suite): Promise<void>;
|
|
26
|
+
beforeTest(test: Frameworks.Test): Promise<unknown>;
|
|
28
27
|
afterSuite(suite: Frameworks.Suite): void;
|
|
29
28
|
private _reportErrorLog;
|
|
30
29
|
afterTest(test: Frameworks.Test, context: unknown, results: Frameworks.TestResult): void;
|
|
@@ -34,8 +33,9 @@ export default class SauceService implements Services.ServiceInstance {
|
|
|
34
33
|
*/
|
|
35
34
|
beforeFeature(uri: unknown, feature: {
|
|
36
35
|
name: string;
|
|
37
|
-
}):
|
|
38
|
-
beforeScenario(world: Frameworks.World):
|
|
36
|
+
}): Promise<unknown>;
|
|
37
|
+
beforeScenario(world: Frameworks.World): Promise<unknown> | undefined;
|
|
38
|
+
beforeStep(step: Frameworks.PickleStep): Promise<unknown>;
|
|
39
39
|
/**
|
|
40
40
|
*
|
|
41
41
|
* Runs before a Cucumber Scenario.
|
|
@@ -63,10 +63,8 @@ export default class SauceService implements Services.ServiceInstance {
|
|
|
63
63
|
*/
|
|
64
64
|
getBody(failures: number, calledOnReload?: boolean, browserName?: string): Partial<Job>;
|
|
65
65
|
/**
|
|
66
|
-
* Update the
|
|
67
|
-
* @param {number} failures
|
|
68
|
-
* @returns {*}
|
|
66
|
+
* Update the running Sauce Labs Job with an annotation
|
|
69
67
|
*/
|
|
70
|
-
|
|
68
|
+
setAnnotation(annotation: string): Promise<unknown>;
|
|
71
69
|
}
|
|
72
70
|
//# sourceMappingURL=service.d.ts.map
|
package/build/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAGA,OAAkB,EAAoB,GAAG,EAAE,MAAM,WAAW,CAAA;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAG9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAO5C,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,QAAQ,CAAC,eAAe;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAGA,OAAkB,EAAoB,GAAG,EAAE,MAAM,WAAW,CAAA;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAG9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAO5C,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,QAAQ,CAAC,eAAe;IAgB7D,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO;IAhBnB,OAAO,CAAC,QAAQ,CAAI;IACpB,OAAO,CAAC,oBAAoB,CAAI;IAChC,OAAO,CAAC,SAAS,CAAI;IACrB,OAAO,CAAC,iBAAiB,CAAO;IAChC,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,IAAI,CAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,CAAgD;IACjE,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,WAAW,CAAC,CAAQ;IAC5B,OAAO,CAAC,IAAI,CAAK;gBAGb,OAAO,EAAE,kBAAkB,EACnB,aAAa,EAAE,YAAY,CAAC,gBAAgB,EAC5C,OAAO,EAAE,OAAO,CAAC,UAAU;IAOvC;;OAEG;IACH,aAAa,CAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM;IAkB3D,MAAM,CAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC;IAazF,WAAW,CAAE,KAAK,EAAE,UAAU,CAAC,KAAK;IAepC,UAAU,CAAE,IAAI,EAAE,UAAU,CAAC,IAAI;IAqDvC,UAAU,CAAE,KAAK,EAAE,UAAU,CAAC,KAAK;IAMnC,OAAO,CAAC,eAAe;IAKvB,SAAS,CAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU;IAyClF,SAAS,CAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU;IAetE;;OAEG;IACG,aAAa,CAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IAuB5D,cAAc,CAAE,KAAK,EAAE,UAAU,CAAC,KAAK;IAajC,UAAU,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU;IAK7C;;;;;;;;OAQG;IACH,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,YAAY;IAOtE;;OAEG;IACG,KAAK,CAAE,MAAM,EAAE,MAAM;IAsC3B;;;;OAIG;YACW,WAAW;IAezB,QAAQ,CAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAmB9C,SAAS,CAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,UAAQ,EAAE,WAAW,CAAC,EAAE,MAAM;IAMlG;;OAEG;IACH,OAAO,CAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,UAAQ,EAAE,WAAW,CAAC,EAAE,MAAM;IAgDvE;;OAEG;IACG,aAAa,CAAE,UAAU,EAAE,MAAM;CAkB1C"}
|
package/build/service.js
CHANGED
|
@@ -23,7 +23,6 @@ class SauceService {
|
|
|
23
23
|
this._cid = '';
|
|
24
24
|
this._options = { ...constants_1.DEFAULT_OPTIONS, ...options };
|
|
25
25
|
this._api = new saucelabs_1.default(this._config);
|
|
26
|
-
this._isLegacyRDC = 'testobject_api_key' in this._capabilities;
|
|
27
26
|
this._maxErrorStackLength = this._options.maxErrorStackLength || this._maxErrorStackLength;
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
@@ -34,13 +33,13 @@ class SauceService {
|
|
|
34
33
|
/**
|
|
35
34
|
* if no user and key is specified even though a sauce service was
|
|
36
35
|
* provided set user and key with values so that the session request
|
|
37
|
-
* will fail
|
|
36
|
+
* will fail
|
|
38
37
|
*/
|
|
39
|
-
if (!this.
|
|
38
|
+
if (!this._config.user) {
|
|
40
39
|
this._isServiceEnabled = false;
|
|
41
40
|
this._config.user = 'unknown_user';
|
|
42
41
|
}
|
|
43
|
-
if (!this.
|
|
42
|
+
if (!this._config.key) {
|
|
44
43
|
this._isServiceEnabled = false;
|
|
45
44
|
this._config.key = 'unknown_key';
|
|
46
45
|
}
|
|
@@ -54,13 +53,23 @@ class SauceService {
|
|
|
54
53
|
// `this._browser.capabilities` returns the process data from Sauce which is without
|
|
55
54
|
// the postfix
|
|
56
55
|
const capabilities = this._browser.requestedCapabilities || {};
|
|
57
|
-
this.
|
|
56
|
+
this._isRDC = (0, utils_1.isRDC)(capabilities);
|
|
58
57
|
}
|
|
59
|
-
beforeSuite(suite) {
|
|
58
|
+
async beforeSuite(suite) {
|
|
60
59
|
this._suiteTitle = suite.title;
|
|
60
|
+
/**
|
|
61
|
+
* Make sure we account for the cases where there is a long running `before` function for a
|
|
62
|
+
* suite or one that can fail so we set the default job name at the suite level
|
|
63
|
+
* Don't do this for Jasmine because the `suiteTitle` is `Jasmine__TopLevel__Suite` and the
|
|
64
|
+
* `fullName` is `null`, so no alternative
|
|
65
|
+
**/
|
|
66
|
+
if (this._browser && !this._isRDC && !this._isJobNameSet && this._suiteTitle !== 'Jasmine__TopLevel__Suite') {
|
|
67
|
+
await this.setAnnotation('sauce:job-name=' + this._suiteTitle);
|
|
68
|
+
this._isJobNameSet = true;
|
|
69
|
+
}
|
|
61
70
|
}
|
|
62
|
-
beforeTest(test) {
|
|
63
|
-
if (!this._isServiceEnabled ||
|
|
71
|
+
async beforeTest(test) {
|
|
72
|
+
if (!this._isServiceEnabled || !this._browser) {
|
|
64
73
|
return;
|
|
65
74
|
}
|
|
66
75
|
/**
|
|
@@ -76,15 +85,19 @@ class SauceService {
|
|
|
76
85
|
let jobName = this._suiteTitle;
|
|
77
86
|
if (this._options.setJobName) {
|
|
78
87
|
jobName = this._options.setJobName(this._config, this._capabilities, this._suiteTitle);
|
|
88
|
+
await this.setAnnotation(`sauce:job-name=${jobName}`);
|
|
89
|
+
this._isJobNameSet = true;
|
|
90
|
+
}
|
|
91
|
+
if (!this._isJobNameSet) {
|
|
92
|
+
await this.setAnnotation(`sauce:job-name=${jobName}`);
|
|
93
|
+
this._isJobNameSet = true;
|
|
79
94
|
}
|
|
80
|
-
this._browser.execute(`sauce:job-name=${jobName}`);
|
|
81
|
-
this._isJobNameSet = true;
|
|
82
95
|
}
|
|
83
96
|
/**
|
|
84
97
|
* Date: 20200714
|
|
85
98
|
* Remark: Sauce Unified Platform doesn't support updating the context yet.
|
|
86
99
|
*/
|
|
87
|
-
if (this.
|
|
100
|
+
if (this._isRDC) {
|
|
88
101
|
return;
|
|
89
102
|
}
|
|
90
103
|
const fullTitle = (
|
|
@@ -96,7 +109,7 @@ class SauceService {
|
|
|
96
109
|
* Mocha
|
|
97
110
|
*/
|
|
98
111
|
`${test.parent} - ${test.title}`);
|
|
99
|
-
this.
|
|
112
|
+
return this.setAnnotation(`sauce:context=${fullTitle}`);
|
|
100
113
|
}
|
|
101
114
|
afterSuite(suite) {
|
|
102
115
|
if (Object.prototype.hasOwnProperty.call(suite, 'error')) {
|
|
@@ -105,7 +118,7 @@ class SauceService {
|
|
|
105
118
|
}
|
|
106
119
|
_reportErrorLog(error) {
|
|
107
120
|
const lines = (error.stack || '').split(/\r?\n/).slice(0, this._maxErrorStackLength);
|
|
108
|
-
lines.forEach((line) => this.
|
|
121
|
+
lines.forEach((line) => this.setAnnotation(`sauce:context=${line.replace((0, utils_1.ansiRegex)(), '')}`));
|
|
109
122
|
}
|
|
110
123
|
afterTest(test, context, results) {
|
|
111
124
|
/**
|
|
@@ -113,7 +126,7 @@ class SauceService {
|
|
|
113
126
|
* This should not be done for UP because it's not supported yet and
|
|
114
127
|
* should be removed when UP supports `sauce:context`
|
|
115
128
|
*/
|
|
116
|
-
if (results.error && results.error.stack && !this.
|
|
129
|
+
if (results.error && results.error.stack && !this._isRDC) {
|
|
117
130
|
this._reportErrorLog(results.error);
|
|
118
131
|
}
|
|
119
132
|
/**
|
|
@@ -146,7 +159,7 @@ class SauceService {
|
|
|
146
159
|
* This should not be done for UP because it's not supported yet and
|
|
147
160
|
* should be removed when UP supports `sauce:context`
|
|
148
161
|
*/
|
|
149
|
-
if (results.error && !this.
|
|
162
|
+
if (results.error && !this._isRDC) {
|
|
150
163
|
this._reportErrorLog(results.error);
|
|
151
164
|
}
|
|
152
165
|
if (!results.passed) {
|
|
@@ -156,34 +169,38 @@ class SauceService {
|
|
|
156
169
|
/**
|
|
157
170
|
* For CucumberJS
|
|
158
171
|
*/
|
|
159
|
-
beforeFeature(uri, feature) {
|
|
160
|
-
if (!this._isServiceEnabled ||
|
|
172
|
+
async beforeFeature(uri, feature) {
|
|
173
|
+
if (!this._isServiceEnabled || !this._browser) {
|
|
161
174
|
return;
|
|
162
175
|
}
|
|
163
176
|
this._suiteTitle = feature.name;
|
|
164
177
|
if (this._browser && !this._isJobNameSet) {
|
|
165
|
-
this.
|
|
178
|
+
await this.setAnnotation(`sauce:job-name=${this._suiteTitle}`);
|
|
166
179
|
this._isJobNameSet = true;
|
|
167
180
|
}
|
|
168
181
|
/**
|
|
169
182
|
* Date: 20200714
|
|
170
183
|
* Remark: Sauce Unified Platform doesn't support updating the context yet.
|
|
171
184
|
*/
|
|
172
|
-
if (this.
|
|
185
|
+
if (this._isRDC) {
|
|
173
186
|
return;
|
|
174
187
|
}
|
|
175
|
-
this.
|
|
188
|
+
return this.setAnnotation(`sauce:context=Feature: ${this._suiteTitle}`);
|
|
176
189
|
}
|
|
177
190
|
beforeScenario(world) {
|
|
178
191
|
/**
|
|
179
192
|
* Date: 20200714
|
|
180
193
|
* Remark: Sauce Unified Platform doesn't support updating the context yet.
|
|
181
194
|
*/
|
|
182
|
-
if (!this._isServiceEnabled || this.
|
|
195
|
+
if (!this._isServiceEnabled || this._isRDC || !this._browser) {
|
|
183
196
|
return;
|
|
184
197
|
}
|
|
185
198
|
const scenarioName = world.pickle.name || 'unknown scenario';
|
|
186
|
-
this.
|
|
199
|
+
return this.setAnnotation(`sauce:context=-Scenario: ${scenarioName}`);
|
|
200
|
+
}
|
|
201
|
+
async beforeStep(step) {
|
|
202
|
+
const { keyword, text } = step;
|
|
203
|
+
return this.setAnnotation(`sauce:context=--Step: ${keyword}${text}`);
|
|
187
204
|
}
|
|
188
205
|
/**
|
|
189
206
|
*
|
|
@@ -204,7 +221,7 @@ class SauceService {
|
|
|
204
221
|
* update Sauce Labs job
|
|
205
222
|
*/
|
|
206
223
|
async after(result) {
|
|
207
|
-
if (!this._browser ||
|
|
224
|
+
if (!this._browser || !this._isServiceEnabled) {
|
|
208
225
|
return;
|
|
209
226
|
}
|
|
210
227
|
let failures = this._failures;
|
|
@@ -219,13 +236,21 @@ class SauceService {
|
|
|
219
236
|
if (!this._browser.isMultiremote) {
|
|
220
237
|
await this._uploadLogs(this._browser.sessionId);
|
|
221
238
|
log.info(`Update job with sessionId ${this._browser.sessionId}, ${status}`);
|
|
222
|
-
return this.
|
|
239
|
+
return this._isRDC ?
|
|
240
|
+
this.setAnnotation(`sauce:job-result=${failures === 0}`) :
|
|
241
|
+
this.updateJob(this._browser.sessionId, failures);
|
|
223
242
|
}
|
|
224
|
-
const
|
|
243
|
+
const multiRemoteBrowser = this._browser;
|
|
225
244
|
return Promise.all(Object.keys(this._capabilities).map(async (browserName) => {
|
|
226
|
-
|
|
227
|
-
log.info(`Update
|
|
228
|
-
|
|
245
|
+
const isMultiRemoteRDC = (0, utils_1.isRDC)(multiRemoteBrowser[browserName].capabilities);
|
|
246
|
+
log.info(`Update multiRemote job for browser "${browserName}" and sessionId ${multiRemoteBrowser[browserName].sessionId}, ${status}`);
|
|
247
|
+
// Sauce Unified Platform (RDC) can not be updated with an API.
|
|
248
|
+
// The logs can also not be uploaded
|
|
249
|
+
if (isMultiRemoteRDC) {
|
|
250
|
+
return this.setAnnotation(`sauce:job-result=${failures === 0}`);
|
|
251
|
+
}
|
|
252
|
+
await this._uploadLogs(multiRemoteBrowser[browserName].sessionId);
|
|
253
|
+
return this.updateJob(multiRemoteBrowser[browserName].sessionId, failures, false, browserName);
|
|
229
254
|
}));
|
|
230
255
|
}
|
|
231
256
|
/**
|
|
@@ -243,7 +268,7 @@ class SauceService {
|
|
|
243
268
|
return this._api.uploadJobAssets(jobId, { files: files.map((file) => path_1.default.join(this._config.outputDir, file)) }).catch((err) => log.error(`Couldn't upload log files to Sauce Labs: ${err.message}`));
|
|
244
269
|
}
|
|
245
270
|
onReload(oldSessionId, newSessionId) {
|
|
246
|
-
if (!this._browser ||
|
|
271
|
+
if (!this._browser || !this._isServiceEnabled) {
|
|
247
272
|
return;
|
|
248
273
|
}
|
|
249
274
|
const status = 'status: ' + (this._failures > 0 ? 'failing' : 'passing');
|
|
@@ -257,11 +282,6 @@ class SauceService {
|
|
|
257
282
|
return this.updateJob(oldSessionId, this._failures, true, browserName);
|
|
258
283
|
}
|
|
259
284
|
async updateJob(sessionId, failures, calledOnReload = false, browserName) {
|
|
260
|
-
if (this._isLegacyRDC) {
|
|
261
|
-
await this._api.updateTest(sessionId, { passed: failures === 0 });
|
|
262
|
-
this._failures = 0;
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
285
|
const body = this.getBody(failures, calledOnReload, browserName);
|
|
266
286
|
await this._api.updateJob(this._config.user, sessionId, body);
|
|
267
287
|
this._failures = 0;
|
|
@@ -303,15 +323,22 @@ class SauceService {
|
|
|
303
323
|
return body;
|
|
304
324
|
}
|
|
305
325
|
/**
|
|
306
|
-
* Update the
|
|
307
|
-
* @param {number} failures
|
|
308
|
-
* @returns {*}
|
|
326
|
+
* Update the running Sauce Labs Job with an annotation
|
|
309
327
|
*/
|
|
310
|
-
|
|
328
|
+
async setAnnotation(annotation) {
|
|
311
329
|
if (!this._browser) {
|
|
312
330
|
return;
|
|
313
331
|
}
|
|
314
|
-
|
|
332
|
+
if (this._browser.isMultiremote) {
|
|
333
|
+
const multiRemoteBrowser = this._browser;
|
|
334
|
+
return Promise.all(Object.keys(this._capabilities).map(async (browserName) => {
|
|
335
|
+
const isMultiRemoteRDC = (0, utils_1.isRDC)(multiRemoteBrowser[browserName].capabilities);
|
|
336
|
+
if ((isMultiRemoteRDC && !annotation.includes('sauce:context')) || !isMultiRemoteRDC) {
|
|
337
|
+
return this._browser.execute(annotation);
|
|
338
|
+
}
|
|
339
|
+
}));
|
|
340
|
+
}
|
|
341
|
+
return this._browser.execute(annotation);
|
|
315
342
|
}
|
|
316
343
|
}
|
|
317
344
|
exports.default = SauceService;
|
package/build/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Capabilities } from '@wdio/types';
|
|
2
2
|
/**
|
|
3
|
-
* Determine if the current instance is a
|
|
3
|
+
* Determine if the current instance is a RDC instance. RDC tests are Real Device tests
|
|
4
4
|
* that can be started with different sets of capabilities. A deviceName is not mandatory, the only mandatory cap for
|
|
5
|
-
*
|
|
5
|
+
* RDC is the platformName. Downside of the platformName is that is can also be EMUSIM. EMUSIM can be distinguished by
|
|
6
6
|
* the `Emulator|Simulator` postfix
|
|
7
7
|
*
|
|
8
8
|
* @param {object} caps
|
|
@@ -41,7 +41,7 @@ import type { Capabilities } from '@wdio/types';
|
|
|
41
41
|
* deviceContextId: ''
|
|
42
42
|
* }
|
|
43
43
|
*/
|
|
44
|
-
export declare function
|
|
44
|
+
export declare function isRDC(caps: Capabilities.DesiredCapabilities): boolean;
|
|
45
45
|
/**
|
|
46
46
|
* Determine if this is an EMUSIM session
|
|
47
47
|
* @param {object} caps
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,KAAK,CAAE,IAAI,EAAE,YAAY,CAAC,mBAAmB,WAM5D;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAE,IAAI,EAAE,YAAY,CAAC,mBAAmB,WAM/D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,gBACpD,aAAa,mBAAmB,UA2BvD;AAED,wBAAgB,SAAS,WAOxB"}
|
package/build/utils.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ansiRegex = exports.makeCapabilityFactory = exports.isEmuSim = exports.
|
|
4
|
-
const utils_1 = require("@wdio/utils");
|
|
3
|
+
exports.ansiRegex = exports.makeCapabilityFactory = exports.isEmuSim = exports.isRDC = void 0;
|
|
5
4
|
/**
|
|
6
|
-
* Determine if the current instance is a
|
|
5
|
+
* Determine if the current instance is a RDC instance. RDC tests are Real Device tests
|
|
7
6
|
* that can be started with different sets of capabilities. A deviceName is not mandatory, the only mandatory cap for
|
|
8
|
-
*
|
|
7
|
+
* RDC is the platformName. Downside of the platformName is that is can also be EMUSIM. EMUSIM can be distinguished by
|
|
9
8
|
* the `Emulator|Simulator` postfix
|
|
10
9
|
*
|
|
11
10
|
* @param {object} caps
|
|
@@ -44,13 +43,13 @@ const utils_1 = require("@wdio/utils");
|
|
|
44
43
|
* deviceContextId: ''
|
|
45
44
|
* }
|
|
46
45
|
*/
|
|
47
|
-
function
|
|
46
|
+
function isRDC(caps) {
|
|
48
47
|
const { 'appium:deviceName': appiumDeviceName = '', deviceName = '', platformName = '' } = caps;
|
|
49
48
|
const name = appiumDeviceName || deviceName;
|
|
50
49
|
// If the string contains `simulator` or `emulator` it's an EMU/SIM session
|
|
51
50
|
return !name.match(/(simulator)|(emulator)/gi) && !!platformName.match(/(ios)|(android)/gi);
|
|
52
51
|
}
|
|
53
|
-
exports.
|
|
52
|
+
exports.isRDC = isRDC;
|
|
54
53
|
/**
|
|
55
54
|
* Determine if this is an EMUSIM session
|
|
56
55
|
* @param {object} caps
|
|
@@ -70,21 +69,21 @@ exports.isEmuSim = isEmuSim;
|
|
|
70
69
|
*/
|
|
71
70
|
function makeCapabilityFactory(tunnelIdentifier, options) {
|
|
72
71
|
return (capability) => {
|
|
73
|
-
//
|
|
74
|
-
// we
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
//
|
|
79
|
-
if (!capability['sauce:options'] &&
|
|
72
|
+
// Check if this is a 'valid' W3C request, this is done with a simple check
|
|
73
|
+
// where we assume that if only one cap has `:` it's W3C, even if the request
|
|
74
|
+
// is a mix of JWP and W3C. This is hard to check
|
|
75
|
+
const isW3CRequest = Boolean(Object.keys(capability).find((cap) => cap.includes(':')));
|
|
76
|
+
// If the `sauce:options` are not provided and it is a W3C session
|
|
77
|
+
// then add it
|
|
78
|
+
if (!capability['sauce:options'] && isW3CRequest) {
|
|
80
79
|
capability['sauce:options'] = {};
|
|
81
80
|
}
|
|
82
81
|
Object.assign(capability, options);
|
|
83
|
-
const sauceOptions = (
|
|
82
|
+
const sauceOptions = (isW3CRequest ? capability['sauce:options'] : capability);
|
|
84
83
|
sauceOptions.tunnelIdentifier = (capability.tunnelIdentifier ||
|
|
85
84
|
sauceOptions.tunnelIdentifier ||
|
|
86
85
|
tunnelIdentifier);
|
|
87
|
-
if (
|
|
86
|
+
if (isW3CRequest) {
|
|
88
87
|
delete capability.tunnelIdentifier;
|
|
89
88
|
}
|
|
90
89
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/sauce-service",
|
|
3
|
-
"version": "7.16.
|
|
3
|
+
"version": "7.16.11",
|
|
4
4
|
"description": "WebdriverIO service that provides a better integration into Sauce Labs",
|
|
5
5
|
"author": "Christian Bromann <christian@saucelabs.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-sauce-service",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@types/node": "^16.11.1",
|
|
27
27
|
"@wdio/logger": "7.16.0",
|
|
28
|
-
"@wdio/types": "7.16.
|
|
29
|
-
"@wdio/utils": "7.16.
|
|
28
|
+
"@wdio/types": "7.16.11",
|
|
29
|
+
"@wdio/utils": "7.16.11",
|
|
30
30
|
"saucelabs": "^7.0.0",
|
|
31
|
-
"webdriverio": "7.16.
|
|
31
|
+
"webdriverio": "7.16.11"
|
|
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": "
|
|
40
|
+
"gitHead": "7aa1d82a1590b47db444734dc86fae7bca1c777c"
|
|
41
41
|
}
|