@wdio/testingbot-service 7.16.14 → 7.17.0
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/package.json +3 -3
- package/build/index.d.ts +0 -13
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -22
- package/build/launcher.d.ts +0 -15
- package/build/launcher.d.ts.map +0 -1
- package/build/launcher.js +0 -59
- package/build/service.d.ts +0 -78
- package/build/service.d.ts.map +0 -1
- package/build/service.js +0 -209
- package/build/types.d.ts +0 -30
- package/build/types.d.ts.map +0 -1
- package/build/types.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/testingbot-service",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.17.0",
|
|
4
4
|
"description": "A WebdriverIO service that provides a better integration into TestingBot",
|
|
5
5
|
"author": "Jochen Delabie <info@testingbot.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-testingbot-service",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@wdio/types": "7.16.14",
|
|
29
29
|
"got": "^11.0.2",
|
|
30
30
|
"testingbot-tunnel-launcher": "^1.1.7",
|
|
31
|
-
"webdriverio": "7.
|
|
31
|
+
"webdriverio": "7.17.0"
|
|
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": "e18d2cde6ff979758830bdff4c3bc82ca9818b24"
|
|
41
41
|
}
|
package/build/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import TestingBotLauncher from './launcher';
|
|
2
|
-
import TestingBotService from './service';
|
|
3
|
-
import { TestingbotOptions } from './types';
|
|
4
|
-
export default TestingBotService;
|
|
5
|
-
export declare const launcher: typeof TestingBotLauncher;
|
|
6
|
-
export * from './types';
|
|
7
|
-
declare global {
|
|
8
|
-
namespace WebdriverIO {
|
|
9
|
-
interface ServiceOption extends TestingbotOptions {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,MAAM,YAAY,CAAA;AAC3C,OAAO,iBAAiB,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,eAAe,iBAAiB,CAAA;AAChC,eAAO,MAAM,QAAQ,2BAAqB,CAAA;AAC1C,cAAc,SAAS,CAAA;AAEvB,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,aAAc,SAAQ,iBAAiB;SAAG;KACvD;CACJ"}
|
package/build/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
6
|
-
}) : (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
o[k2] = m[k];
|
|
9
|
-
}));
|
|
10
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
11
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.launcher = void 0;
|
|
18
|
-
const launcher_1 = __importDefault(require("./launcher"));
|
|
19
|
-
const service_1 = __importDefault(require("./service"));
|
|
20
|
-
exports.default = service_1.default;
|
|
21
|
-
exports.launcher = launcher_1.default;
|
|
22
|
-
__exportStar(require("./types"), exports);
|
package/build/launcher.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Capabilities, Options, Services } from '@wdio/types';
|
|
2
|
-
import { TestingbotOptions, TestingbotTunnel, TunnelLauncherOptions } from './types';
|
|
3
|
-
export default class TestingBotLauncher implements Services.ServiceInstance {
|
|
4
|
-
options: TestingbotOptions;
|
|
5
|
-
tbTunnelOpts: TunnelLauncherOptions;
|
|
6
|
-
tunnel?: TestingbotTunnel;
|
|
7
|
-
constructor(options: TestingbotOptions);
|
|
8
|
-
onPrepare(config: Options.Testrunner, capabilities: Capabilities.RemoteCapabilities): Promise<void>;
|
|
9
|
-
/**
|
|
10
|
-
* Shut down the tunnel
|
|
11
|
-
* @returns {Promise} Resolved promise when tunnel is closed
|
|
12
|
-
*/
|
|
13
|
-
onComplete(): Promise<unknown> | undefined;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=launcher.d.ts.map
|
package/build/launcher.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE7D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIpF,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,QAAQ,CAAC,eAAe;IACvE,OAAO,EAAE,iBAAiB,CAAA;IAC1B,YAAY,EAAG,qBAAqB,CAAA;IACpC,MAAM,CAAC,EAAE,gBAAgB,CAAA;gBACZ,OAAO,EAAE,iBAAiB;IAIjC,SAAS,CAAE,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC,kBAAkB;IAwC1F;;;OAGG;IACH,UAAU;CAOb"}
|
package/build/launcher.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const perf_hooks_1 = require("perf_hooks");
|
|
7
|
-
const util_1 = require("util");
|
|
8
|
-
const testingbot_tunnel_launcher_1 = __importDefault(require("testingbot-tunnel-launcher"));
|
|
9
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
10
|
-
const log = (0, logger_1.default)('@wdio/testingbot-service');
|
|
11
|
-
class TestingBotLauncher {
|
|
12
|
-
constructor(options) {
|
|
13
|
-
this.options = options;
|
|
14
|
-
}
|
|
15
|
-
async onPrepare(config, capabilities) {
|
|
16
|
-
var _a;
|
|
17
|
-
if (!this.options.tbTunnel || !config.user || !config.key) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const tbTunnelIdentifier = ((_a = this.options.tbTunnelOpts) === null || _a === void 0 ? void 0 : _a.tunnelIdentifier) || `TB-tunnel-${Math.random().toString().slice(2)}`;
|
|
21
|
-
this.tbTunnelOpts = Object.assign({
|
|
22
|
-
apiKey: config.user,
|
|
23
|
-
apiSecret: config.key,
|
|
24
|
-
'tunnel-identifier': tbTunnelIdentifier,
|
|
25
|
-
}, this.options.tbTunnelOpts);
|
|
26
|
-
const capabilitiesEntries = Array.isArray(capabilities) ? capabilities : Object.values(capabilities);
|
|
27
|
-
for (const capability of capabilitiesEntries) {
|
|
28
|
-
const caps = capability.capabilities || capability;
|
|
29
|
-
const c = caps.alwaysMatch || caps;
|
|
30
|
-
if (!c['tb:options']) {
|
|
31
|
-
c['tb:options'] = {};
|
|
32
|
-
}
|
|
33
|
-
c['tb:options']['tunnel-identifier'] = tbTunnelIdentifier;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* measure TestingBot tunnel boot time
|
|
37
|
-
*/
|
|
38
|
-
const obs = new perf_hooks_1.PerformanceObserver((list) => {
|
|
39
|
-
const entry = list.getEntries()[0];
|
|
40
|
-
log.info(`TestingBot tunnel successfully started after ${entry.duration}ms`);
|
|
41
|
-
});
|
|
42
|
-
obs.observe({ entryTypes: ['measure'] });
|
|
43
|
-
perf_hooks_1.performance.mark('tbTunnelStart');
|
|
44
|
-
this.tunnel = await (0, util_1.promisify)(testingbot_tunnel_launcher_1.default)(this.tbTunnelOpts);
|
|
45
|
-
perf_hooks_1.performance.mark('tbTunnelEnd');
|
|
46
|
-
perf_hooks_1.performance.measure('bootTime', 'tbTunnelStart', 'tbTunnelEnd');
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Shut down the tunnel
|
|
50
|
-
* @returns {Promise} Resolved promise when tunnel is closed
|
|
51
|
-
*/
|
|
52
|
-
onComplete() {
|
|
53
|
-
if (!this.tunnel) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
return new Promise(resolve => this.tunnel.close(resolve));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.default = TestingBotLauncher;
|
package/build/service.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Capabilities, Options, Services, Frameworks } from '@wdio/types';
|
|
2
|
-
import type { Browser, MultiRemoteBrowser } from 'webdriverio';
|
|
3
|
-
import { TestingbotOptions } from './types';
|
|
4
|
-
export default class TestingBotService implements Services.ServiceInstance {
|
|
5
|
-
private _options;
|
|
6
|
-
private _capabilities;
|
|
7
|
-
private _config;
|
|
8
|
-
private _browser?;
|
|
9
|
-
private _isServiceEnabled?;
|
|
10
|
-
private _suiteTitle?;
|
|
11
|
-
private _tbSecret?;
|
|
12
|
-
private _tbUser?;
|
|
13
|
-
private _failures;
|
|
14
|
-
private _testCnt;
|
|
15
|
-
constructor(_options: TestingbotOptions, _capabilities: Capabilities.RemoteCapability, _config: Omit<Options.Testrunner, 'capabilities'>);
|
|
16
|
-
before(caps: unknown, specs: unknown, browser: Browser<'async'> | MultiRemoteBrowser<'async'>): void;
|
|
17
|
-
/**
|
|
18
|
-
* Before suite
|
|
19
|
-
* @param {Object} suite Suite
|
|
20
|
-
*/
|
|
21
|
-
beforeSuite(suite: Frameworks.Suite): void;
|
|
22
|
-
/**
|
|
23
|
-
* Before test
|
|
24
|
-
* @param {Object} test Test
|
|
25
|
-
*/
|
|
26
|
-
beforeTest(test: Frameworks.Test): void;
|
|
27
|
-
afterSuite(suite: Frameworks.Suite): void;
|
|
28
|
-
/**
|
|
29
|
-
* After test
|
|
30
|
-
* @param {Object} test Test
|
|
31
|
-
*/
|
|
32
|
-
afterTest(test: Frameworks.Test, context: any, results: Frameworks.TestResult): void;
|
|
33
|
-
/**
|
|
34
|
-
* For CucumberJS
|
|
35
|
-
*/
|
|
36
|
-
/**
|
|
37
|
-
* Before feature
|
|
38
|
-
* @param {string} uri
|
|
39
|
-
* @param {Object} feature
|
|
40
|
-
*/
|
|
41
|
-
beforeFeature(uri: unknown, feature: {
|
|
42
|
-
name: string;
|
|
43
|
-
}): void;
|
|
44
|
-
/**
|
|
45
|
-
* Before scenario
|
|
46
|
-
* @param {string} uri
|
|
47
|
-
* @param {Object} feature
|
|
48
|
-
* @param {Object} scenario
|
|
49
|
-
*/
|
|
50
|
-
beforeScenario(world: Frameworks.World): void;
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* Runs before a Cucumber Scenario.
|
|
54
|
-
* @param world world object containing information on pickle and test step
|
|
55
|
-
* @param result result object containing
|
|
56
|
-
* @param result.passed true if scenario has passed
|
|
57
|
-
* @param result.error error stack if scenario failed
|
|
58
|
-
* @param result.duration duration of scenario in milliseconds
|
|
59
|
-
*/
|
|
60
|
-
afterScenario(world: Frameworks.World, result: Frameworks.PickleResult): void;
|
|
61
|
-
/**
|
|
62
|
-
* Update TestingBot info
|
|
63
|
-
* @return {Promise} Promise with result of updateJob method call
|
|
64
|
-
*/
|
|
65
|
-
after(result?: number): Promise<unknown> | undefined;
|
|
66
|
-
onReload(oldSessionId: string, newSessionId: string): Promise<unknown> | undefined;
|
|
67
|
-
updateJob(sessionId: string, failures: number, calledOnReload?: boolean, browserName?: string): Promise<unknown>;
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
70
|
-
* @param {String} sessionId Session id
|
|
71
|
-
* @returns {String} TestingBot API URL
|
|
72
|
-
*/
|
|
73
|
-
getRestUrl(sessionId: string): string;
|
|
74
|
-
getBody(failures: number, calledOnReload?: boolean, browserName?: string): {
|
|
75
|
-
test: any;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=service.d.ts.map
|
package/build/service.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAK3C,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,QAAQ,CAAC,eAAe;IAUlE,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO;IAXnB,OAAO,CAAC,QAAQ,CAAC,CAAgD;IACjE,OAAO,CAAC,iBAAiB,CAAC,CAAS;IACnC,OAAO,CAAC,WAAW,CAAC,CAAQ;IAC5B,OAAO,CAAC,SAAS,CAAC,CAAQ;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,OAAO,CAAC,SAAS,CAAI;IACrB,OAAO,CAAC,QAAQ,CAAI;gBAGR,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,YAAY,CAAC,gBAAgB,EAC5C,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC;IAQ7D,MAAM,CACF,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC;IAK3D;;;MAGE;IACF,WAAW,CAAE,KAAK,EAAE,UAAU,CAAC,KAAK;IAIpC;;;MAGE;IACF,UAAU,CAAE,IAAI,EAAE,UAAU,CAAC,IAAI;IA6BjC,UAAU,CAAE,KAAK,EAAE,UAAU,CAAC,KAAK;IAMnC;;;OAGG;IACH,SAAS,CAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU;IAM9E;;OAEG;IAEH;;;;OAIG;IACH,aAAa,CAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IAStD;;;;;OAKG;IACH,cAAc,CAAE,KAAK,EAAE,UAAU,CAAC,KAAK;IAQvC;;;;;;;;OAQG;IACH,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,YAAY;IAOtE;;;OAGG;IACH,KAAK,CAAE,MAAM,CAAC,EAAE,MAAM;IA6BtB,QAAQ,CAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAkB9C,SAAS,CAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,UAAQ,EAAE,WAAW,CAAC,EAAE,MAAM;IAiBlG;;;;OAIG;IACH,UAAU,CAAE,SAAS,EAAE,MAAM;IAI7B,OAAO,CAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,UAAQ,EAAE,WAAW,CAAC,EAAE,MAAM;;;CAmC1E"}
|
package/build/service.js
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const got_1 = __importDefault(require("got"));
|
|
7
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
8
|
-
const log = (0, logger_1.default)('@wdio/testingbot-service');
|
|
9
|
-
const jobDataProperties = ['name', 'tags', 'public', 'build', 'extra'];
|
|
10
|
-
class TestingBotService {
|
|
11
|
-
constructor(_options, _capabilities, _config) {
|
|
12
|
-
this._options = _options;
|
|
13
|
-
this._capabilities = _capabilities;
|
|
14
|
-
this._config = _config;
|
|
15
|
-
this._failures = 0;
|
|
16
|
-
this._testCnt = 0;
|
|
17
|
-
this._tbUser = this._config.user;
|
|
18
|
-
this._tbSecret = this._config.key;
|
|
19
|
-
this._isServiceEnabled = Boolean(this._tbUser && this._tbSecret);
|
|
20
|
-
}
|
|
21
|
-
before(caps, specs, browser) {
|
|
22
|
-
this._browser = browser;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Before suite
|
|
26
|
-
* @param {Object} suite Suite
|
|
27
|
-
*/
|
|
28
|
-
beforeSuite(suite) {
|
|
29
|
-
this._suiteTitle = suite.title;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Before test
|
|
33
|
-
* @param {Object} test Test
|
|
34
|
-
*/
|
|
35
|
-
beforeTest(test) {
|
|
36
|
-
if (!this._isServiceEnabled || !this._browser) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* in jasmine we get Jasmine__TopLevel__Suite as title since service using test
|
|
41
|
-
* framework hooks in order to execute async functions.
|
|
42
|
-
* This tweak allows us to set the real suite name for jasmine jobs.
|
|
43
|
-
*/
|
|
44
|
-
/* istanbul ignore if */
|
|
45
|
-
if (this._suiteTitle === 'Jasmine__TopLevel__Suite') {
|
|
46
|
-
this._suiteTitle = test.fullName.slice(0, test.fullName.indexOf(test.title) - 1);
|
|
47
|
-
}
|
|
48
|
-
const context = (
|
|
49
|
-
/**
|
|
50
|
-
* Jasmine
|
|
51
|
-
*/
|
|
52
|
-
test.fullName ||
|
|
53
|
-
/**
|
|
54
|
-
* Mocha
|
|
55
|
-
*/
|
|
56
|
-
`${test.parent} - ${test.title}`);
|
|
57
|
-
this._browser.execute('tb:test-context=' + context);
|
|
58
|
-
}
|
|
59
|
-
afterSuite(suite) {
|
|
60
|
-
if (Object.prototype.hasOwnProperty.call(suite, 'error')) {
|
|
61
|
-
++this._failures;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* After test
|
|
66
|
-
* @param {Object} test Test
|
|
67
|
-
*/
|
|
68
|
-
afterTest(test, context, results) {
|
|
69
|
-
if (!results.passed) {
|
|
70
|
-
++this._failures;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* For CucumberJS
|
|
75
|
-
*/
|
|
76
|
-
/**
|
|
77
|
-
* Before feature
|
|
78
|
-
* @param {string} uri
|
|
79
|
-
* @param {Object} feature
|
|
80
|
-
*/
|
|
81
|
-
beforeFeature(uri, feature) {
|
|
82
|
-
if (!this._isServiceEnabled || !this._browser) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
this._suiteTitle = feature.name;
|
|
86
|
-
this._browser.execute('tb:test-context=Feature: ' + this._suiteTitle);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Before scenario
|
|
90
|
-
* @param {string} uri
|
|
91
|
-
* @param {Object} feature
|
|
92
|
-
* @param {Object} scenario
|
|
93
|
-
*/
|
|
94
|
-
beforeScenario(world) {
|
|
95
|
-
if (!this._isServiceEnabled || !this._browser) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const scenarioName = world.pickle.name;
|
|
99
|
-
this._browser.execute('tb:test-context=Scenario: ' + scenarioName);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
*
|
|
103
|
-
* Runs before a Cucumber Scenario.
|
|
104
|
-
* @param world world object containing information on pickle and test step
|
|
105
|
-
* @param result result object containing
|
|
106
|
-
* @param result.passed true if scenario has passed
|
|
107
|
-
* @param result.error error stack if scenario failed
|
|
108
|
-
* @param result.duration duration of scenario in milliseconds
|
|
109
|
-
*/
|
|
110
|
-
afterScenario(world, result) {
|
|
111
|
-
// check if scenario has failed
|
|
112
|
-
if (!result.passed) {
|
|
113
|
-
++this._failures;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Update TestingBot info
|
|
118
|
-
* @return {Promise} Promise with result of updateJob method call
|
|
119
|
-
*/
|
|
120
|
-
after(result) {
|
|
121
|
-
var _a;
|
|
122
|
-
if (!this._isServiceEnabled || !this._browser) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
let failures = this._failures;
|
|
126
|
-
/**
|
|
127
|
-
* set failures if user has bail option set in which case afterTest and
|
|
128
|
-
* afterSuite aren't executed before after hook
|
|
129
|
-
*/
|
|
130
|
-
if (((_a = this._config.mochaOpts) === null || _a === void 0 ? void 0 : _a.bail) && Boolean(result)) {
|
|
131
|
-
failures = 1;
|
|
132
|
-
}
|
|
133
|
-
const status = 'status: ' + (failures > 0 ? 'failing' : 'passing');
|
|
134
|
-
if (!this._browser.isMultiremote) {
|
|
135
|
-
log.info(`Update job with sessionId ${this._browser.sessionId}, ${status}`);
|
|
136
|
-
return this.updateJob(this._browser.sessionId, failures);
|
|
137
|
-
}
|
|
138
|
-
const browser = this._browser;
|
|
139
|
-
return Promise.all(Object.keys(this._capabilities).map((browserName) => {
|
|
140
|
-
log.info(`Update multiremote job for browser "${browserName}" and sessionId ${browser[browserName].sessionId}, ${status}`);
|
|
141
|
-
return this.updateJob(browser[browserName].sessionId, failures, false, browserName);
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
onReload(oldSessionId, newSessionId) {
|
|
145
|
-
if (!this._isServiceEnabled || !this._browser) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const status = 'status: ' + (this._failures > 0 ? 'failing' : 'passing');
|
|
149
|
-
if (!this._browser.isMultiremote) {
|
|
150
|
-
log.info(`Update (reloaded) job with sessionId ${oldSessionId}, ${status}`);
|
|
151
|
-
return this.updateJob(oldSessionId, this._failures, true);
|
|
152
|
-
}
|
|
153
|
-
const browser = this._browser;
|
|
154
|
-
const browserName = browser.instances.filter((browserName) => browser[browserName].sessionId === newSessionId)[0];
|
|
155
|
-
log.info(`Update (reloaded) multiremote job for browser "${browserName}" and sessionId ${oldSessionId}, ${status}`);
|
|
156
|
-
return this.updateJob(oldSessionId, this._failures, true, browserName);
|
|
157
|
-
}
|
|
158
|
-
async updateJob(sessionId, failures, calledOnReload = false, browserName) {
|
|
159
|
-
if (!this._browser) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const json = this.getBody(failures, calledOnReload, browserName);
|
|
163
|
-
this._failures = 0;
|
|
164
|
-
const response = await got_1.default.put(this.getRestUrl(sessionId), {
|
|
165
|
-
json,
|
|
166
|
-
responseType: 'json',
|
|
167
|
-
username: this._tbUser,
|
|
168
|
-
password: this._tbSecret
|
|
169
|
-
});
|
|
170
|
-
return response.body;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
*
|
|
174
|
-
* @param {String} sessionId Session id
|
|
175
|
-
* @returns {String} TestingBot API URL
|
|
176
|
-
*/
|
|
177
|
-
getRestUrl(sessionId) {
|
|
178
|
-
return `https://api.testingbot.com/v1/tests/${sessionId}`;
|
|
179
|
-
}
|
|
180
|
-
getBody(failures, calledOnReload = false, browserName) {
|
|
181
|
-
let body = { test: {} };
|
|
182
|
-
/**
|
|
183
|
-
* set default values
|
|
184
|
-
*/
|
|
185
|
-
body.test['name'] = this._suiteTitle;
|
|
186
|
-
/**
|
|
187
|
-
* add reload count to title if reload is used
|
|
188
|
-
*/
|
|
189
|
-
if ((calledOnReload || this._testCnt) && this._browser) {
|
|
190
|
-
let testCnt = ++this._testCnt;
|
|
191
|
-
if (this._browser.isMultiremote) {
|
|
192
|
-
testCnt = Math.ceil(testCnt / this._browser.instances.length);
|
|
193
|
-
}
|
|
194
|
-
body.test['name'] += ` (${testCnt})`;
|
|
195
|
-
}
|
|
196
|
-
for (let prop of jobDataProperties) {
|
|
197
|
-
if (!this._capabilities[prop]) {
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
body.test[prop] = this._capabilities[prop];
|
|
201
|
-
}
|
|
202
|
-
if (browserName) {
|
|
203
|
-
body.test['name'] = `${browserName}: ${body.test['name']}`;
|
|
204
|
-
}
|
|
205
|
-
body.test['success'] = failures === 0 ? '1' : '0';
|
|
206
|
-
return body;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
exports.default = TestingBotService;
|
package/build/types.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface TunnelLauncherOptions {
|
|
2
|
-
apiKey: string;
|
|
3
|
-
apiSecret: string;
|
|
4
|
-
verbose?: boolean;
|
|
5
|
-
'se-port'?: number;
|
|
6
|
-
proxy?: string;
|
|
7
|
-
'fast-fail-regexps'?: string;
|
|
8
|
-
logfile?: string;
|
|
9
|
-
tunnelVersion?: string;
|
|
10
|
-
tunnelIdentifier?: string;
|
|
11
|
-
readyFile?: string;
|
|
12
|
-
dns?: string;
|
|
13
|
-
noproxy?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface TestingbotOptions {
|
|
16
|
-
/**
|
|
17
|
-
* If true it runs the TestingBot Tunnel and opens a secure connection between a TestingBot
|
|
18
|
-
* Virtual Machine running your browser tests.
|
|
19
|
-
*/
|
|
20
|
-
tbTunnel?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Apply TestingBot Tunnel options (e.g. to change port number or logFile settings). See
|
|
23
|
-
* [this list](https://github.com/testingbot/testingbot-tunnel-launcher) for more information.
|
|
24
|
-
*/
|
|
25
|
-
tbTunnelOpts?: TunnelLauncherOptions;
|
|
26
|
-
}
|
|
27
|
-
export interface TestingbotTunnel {
|
|
28
|
-
close: (cb: unknown) => void;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=types.d.ts.map
|
package/build/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IAElC,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC;IAIlB,SAAS,CAAC,EAAE,MAAM,CAAC;IAInB,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAG7B,OAAO,CAAC,EAAE,MAAM,CAAC;IAIjB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,GAAG,CAAC,EAAE,MAAM,CAAC;IAGb,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACxC;AAED,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,CAAC;CAChC"}
|
package/build/types.js
DELETED