@wdio/browser-runner 8.0.0-alpha.598 → 8.0.0-alpha.607
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/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -0
- package/build/types.d.ts +5 -0
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +4 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +36 -0
- package/package.json +12 -12
package/build/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Options } from '@wdio/types';
|
|
|
3
3
|
import type { BrowserRunnerOptions as BrowserRunnerOptionsImport } from './types';
|
|
4
4
|
export default class BrowserRunner extends LocalRunner {
|
|
5
5
|
#private;
|
|
6
|
+
private options;
|
|
6
7
|
constructor(options: BrowserRunnerOptionsImport, config: Options.Testrunner);
|
|
7
8
|
/**
|
|
8
9
|
* nothing to initialise when running locally
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAIzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAIzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAK1C,OAAO,KAAK,EAAE,oBAAoB,IAAI,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAIjF,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;;IAItC,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU;IAWnF;;OAEG;IACG,UAAU;IAWhB,GAAG,CAAE,OAAO,EAAE,OAAO;IAoCrB;;;;OAIG;IACG,QAAQ;CAIjB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,oBAAqB,SAAQ,0BAA0B;SAAG;KACvE;CACJ"}
|
package/build/index.js
CHANGED
|
@@ -3,12 +3,15 @@ import LocalRunner from '@wdio/local-runner';
|
|
|
3
3
|
import { attach } from 'webdriverio';
|
|
4
4
|
import { ViteServer } from './vite/server.js';
|
|
5
5
|
import { FRAMEWORK_SUPPORT_ERROR, SESSIONS, BROWSER_POOL } from './constants.js';
|
|
6
|
+
import { makeHeadless } from './utils.js';
|
|
6
7
|
const log = logger('@wdio/browser-runner');
|
|
7
8
|
export default class BrowserRunner extends LocalRunner {
|
|
9
|
+
options;
|
|
8
10
|
#config;
|
|
9
11
|
#server;
|
|
10
12
|
constructor(options, config) {
|
|
11
13
|
super(options, config);
|
|
14
|
+
this.options = options;
|
|
12
15
|
if (config.framework !== 'mocha') {
|
|
13
16
|
throw new Error(FRAMEWORK_SUPPORT_ERROR);
|
|
14
17
|
}
|
|
@@ -29,6 +32,7 @@ export default class BrowserRunner extends LocalRunner {
|
|
|
29
32
|
await super.initialise();
|
|
30
33
|
}
|
|
31
34
|
run(runArgs) {
|
|
35
|
+
runArgs.caps = makeHeadless(this.options, runArgs.caps);
|
|
32
36
|
if (runArgs.command === 'run') {
|
|
33
37
|
runArgs.args.baseUrl = `http://localhost:${this.#server.config.server?.port}`;
|
|
34
38
|
}
|
package/build/types.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export interface BrowserRunnerOptions {
|
|
|
22
22
|
* Vite configuration to overwrite the preset
|
|
23
23
|
*/
|
|
24
24
|
viteConfig?: InlineConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Run tests in headless mode
|
|
27
|
+
* @default false // true in CI environment
|
|
28
|
+
*/
|
|
29
|
+
headless?: boolean;
|
|
25
30
|
}
|
|
26
31
|
export interface RunArgs extends Workers.WorkerRunPayload {
|
|
27
32
|
command: string;
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,WAAW,EAAE,WAAW,CAAA;QACxB,iBAAiB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;KAC9C;CACJ;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;AAErF,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,WAAW,EAAE,WAAW,CAAA;QACxB,iBAAiB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;KAC9C;CACJ;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;AAErF,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,OAAQ,SAAQ,OAAO,CAAC,gBAAgB;IACrD,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,GAAG,CAAA;IACT,GAAG,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,EAAE,OAAO,CAAC,UAAU,CAAA;IAC1B,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAA;IAC3C,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,OAAO,CAAA;CACzB"}
|
package/build/utils.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Capabilities } from '@wdio/types';
|
|
2
|
+
import type { BrowserRunnerOptions } from './types';
|
|
3
|
+
export declare function makeHeadless(options: BrowserRunnerOptions, caps: Capabilities.RemoteCapability): Capabilities.RemoteCapability;
|
|
4
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAInD,wBAAgB,YAAY,CAAE,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,YAAY,CAAC,gBAAgB,GAAG,YAAY,CAAC,gBAAgB,CAmC/H"}
|
package/build/utils.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { deepmerge } from 'deepmerge-ts';
|
|
2
|
+
import logger from '@wdio/logger';
|
|
3
|
+
const log = logger('@wdio/browser-runner');
|
|
4
|
+
export function makeHeadless(options, caps) {
|
|
5
|
+
const capability = caps.alwaysMatch || caps;
|
|
6
|
+
if (!capability.browserName) {
|
|
7
|
+
throw new Error('No "browserName" defined in capability object. It seems you are trying to run tests ' +
|
|
8
|
+
'in a non web environment, however WebdriverIOs browser runner only supports web environments');
|
|
9
|
+
}
|
|
10
|
+
if ((typeof options.headless === 'boolean' && !options.headless) || !process.env.CI) {
|
|
11
|
+
return caps;
|
|
12
|
+
}
|
|
13
|
+
if (capability.browserName === 'chrome') {
|
|
14
|
+
return deepmerge(capability, {
|
|
15
|
+
'goog:chromeOptions': {
|
|
16
|
+
args: ['headless', 'disable-gpu']
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
else if (capability.browserName === 'firefox') {
|
|
21
|
+
return deepmerge(capability, {
|
|
22
|
+
'moz:firefoxOptions': {
|
|
23
|
+
args: ['-headless']
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else if (capability.browserName === 'msedge') {
|
|
28
|
+
return deepmerge(capability, {
|
|
29
|
+
'ms:edgeOptions': {
|
|
30
|
+
args: ['--headless']
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
log.error(`Headless mode not supported for browser "${capability.browserName}"`);
|
|
35
|
+
return caps;
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/browser-runner",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.607+dac623702",
|
|
4
4
|
"description": "A WebdriverIO runner to run unit tests tests in the browser.",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browser-runner",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
|
|
32
32
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
33
33
|
"@types/mocha": "^10.0.0",
|
|
34
|
-
"@wdio/globals": "8.0.0-alpha.
|
|
35
|
-
"@wdio/local-runner": "8.0.0-alpha.
|
|
36
|
-
"@wdio/logger": "8.0.0-alpha.
|
|
37
|
-
"@wdio/mocha-framework": "8.0.0-alpha.
|
|
38
|
-
"@wdio/protocols": "8.0.0-alpha.
|
|
39
|
-
"@wdio/runner": "8.0.0-alpha.
|
|
40
|
-
"@wdio/types": "8.0.0-alpha.
|
|
41
|
-
"@wdio/utils": "8.0.0-alpha.
|
|
34
|
+
"@wdio/globals": "8.0.0-alpha.607+dac623702",
|
|
35
|
+
"@wdio/local-runner": "8.0.0-alpha.607+dac623702",
|
|
36
|
+
"@wdio/logger": "8.0.0-alpha.607+dac623702",
|
|
37
|
+
"@wdio/mocha-framework": "8.0.0-alpha.607+dac623702",
|
|
38
|
+
"@wdio/protocols": "8.0.0-alpha.607+dac623702",
|
|
39
|
+
"@wdio/runner": "8.0.0-alpha.607+dac623702",
|
|
40
|
+
"@wdio/types": "8.0.0-alpha.607+dac623702",
|
|
41
|
+
"@wdio/utils": "8.0.0-alpha.607+dac623702",
|
|
42
42
|
"deepmerge-ts": "^4.2.2",
|
|
43
43
|
"expect-webdriverio": "^4.0.0-alpha.6",
|
|
44
44
|
"fast-safe-stringify": "^2.1.1",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"serialize-error": "^11.0.0",
|
|
48
48
|
"vite": "^3.1.7",
|
|
49
49
|
"vite-plugin-top-level-await": "^1.2.1",
|
|
50
|
-
"webdriver": "8.0.0-alpha.
|
|
51
|
-
"webdriverio": "8.0.0-alpha.
|
|
50
|
+
"webdriver": "8.0.0-alpha.607+dac623702",
|
|
51
|
+
"webdriverio": "8.0.0-alpha.607+dac623702",
|
|
52
52
|
"ws": "^8.10.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/ws": "^8.5.3"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "dac62370266d145eeeafbfbea7e470d65a7ab663"
|
|
64
64
|
}
|