1 | const { serenity } = require('@serenity-js/core');
|
2 | const { Path } = require('@serenity-js/core/lib/io');
|
3 | const {
|
4 | ProtractorFrameworkAdapter,
|
5 | TestRunnerDetector,
|
6 | TestRunnerLoader
|
7 | } = require('@serenity-js/protractor/lib/adapter');
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | exports.run = function (runner, specs) {
|
17 | return new ProtractorFrameworkAdapter(
|
18 | serenity,
|
19 | runner,
|
20 | new TestRunnerDetector(new TestRunnerLoader(
|
21 | testModeOrDefaultCwd(runner.getConfig().configDir),
|
22 | process.pid
|
23 | ))
|
24 | ).run(specs);
|
25 | }
|
26 |
|
27 | function testModeOrDefaultCwd(defaulValue) {
|
28 | if (! process.env.MULTIDEP_CUCUMBER_CONF) {
|
29 | return Path.from(defaulValue);
|
30 | }
|
31 |
|
32 |
|
33 | const cucumberConf = JSON.parse(process.env.MULTIDEP_CUCUMBER_CONF);
|
34 | return Path.from(
|
35 | __dirname,
|
36 | `test/multidep_modules/${ cucumberConf.module }-${ cucumberConf.version }`
|
37 | );
|
38 | }
|