2017-07-26 55 views
0

我在使用multiCapabilities和兩個瀏覽器(Firefox和Chrome)時出現錯誤。 這是我的配置的摘錄:MultiCapabilities配置錯誤

exports.config = { 
    allScriptsTimeout: 11000, 

    seleniumAddress: 'http://localhost:4444/wd/hub', 

    baseUrl: 'http://localhost:4200', 

    specs: [ 
    './e2e/features/*.ts' 
    ], 

    multiCapabilities: [ 
    {'browserName': 'chrome'}, 
    {'browserName': 'firefox'} 
    ], 

    directConnect: false, 

    framework: 'custom', 

    frameworkPath: require.resolve('serenity-js'), 

    cucumberOpts: { 
    compiler: "ts:ts-node/register", 
    tags: [],      // <string[]> (expression) only execute the features or scenarios with tags matching the expression 
    strict: true,     // <boolean> fail if there are any undefined or pending steps 
    dryRun: false,     // <boolean> invoke formatters without executing steps 
    compiler: [], 
    require: ['./e2e/steps/*.ts'], // require step definition files before executing features 
    format: ["pretty"] // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable) 
    }, 

    beforeLaunch: function() { 
    require('ts-node').register({ 
     project: 'e2e/tsconfig.e2e.json' 
    }); 
    }, 

    onPrepare: function() { 
    browser.ignoreSynchronization = true; 
    browser.driver.manage().window().setSize(1800, 1500); 
    } 

我一步文件的開頭:

import { browser, element, by } from 'protractor'; 
import { binding, given, when, then } from "cucumber-tsflow"; 
import { CallbackStepDefinition } from 'cucumber'; 

誤差得到的,在同一時間運行兩個瀏覽器只當是這個:

[15:12:32] I/launcher - Running 2 instances of WebDriver 
[15:12:36] I/testLogger - 
------------------------------------ 

[15:12:36] I/testLogger - [chrome #11] PID: 12332 
[chrome #11] Specs: C:\Users\JeanB\work_projects\dealflo-cwf-ux\e2e\features\footer-component.feature.ts 
[chrome #11] 
[chrome #11] (node:12332) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead. 
[chrome #11] [15:12:33] I/hosted - Using the selenium server at http://localhost:4444/wd/hub 
[chrome #11] [15:12:36] I/runnerCli - Unexpected token import 

[15:12:36] I/testLogger - 

[15:12:36] E/launcher - Runner process exited unexpectedly with error code: 1 
[15:12:36] I/launcher - 1 instance(s) of WebDriver still running 
[15:12:37] I/testLogger - 
------------------------------------ 

[15:12:37] I/testLogger - [firefox #01] PID: 14720 
[firefox #01] Specs: C:\Users\JeanB\work_projects\dealflo-cwf-ux\e2e\features\footer-component.feature.ts 
[firefox #01] 
[firefox #01] (node:14720) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead. 
[firefox #01] [15:12:33] I/hosted - Using the selenium server at http://localhost:4444/wd/hub 
[firefox #01] [15:12:37] I/runnerCli - Unexpected token import 

[15:12:37] I/testLogger - 

[15:12:37] E/launcher - Runner process exited unexpectedly with error code: 1 
[15:12:37] I/launcher - 0 instance(s) of WebDriver still running 
[15:12:37] I/launcher - chrome #11 failed with exit code: 1 
[15:12:37] I/launcher - firefox #01 failed with exit code: 1 
[15:12:37] I/launcher - overall: 2 process(es) failed to complete 
[15:12:37] E/launcher - Process exited with error code 100 

我正在使用量角器5.1.2和cucumber-js 1.3 這是一個錯誤還是我的配置有問題?

回答

1

我終於在angular-cli github中找到了一個線程。 Link to angular-cli issue 基本上,beforeLaunch運行一次,所以,如果使用multiCapabilities與角度cli。

require('ts-node').register({ 
    project: 'e2e/tsconfig.e2e.json' 
}); 

需要移動到OnPrepare

如果你點擊鏈接,你可以找到更多關於它的信息。