使用 Protractor Cucumber 时未显示失败原因或异常

failed reason or exception is not getting displayed when working with Protractor Cucumber

我正在尝试使用 protractor-cucumber 框架,当我执行脚本时..即使脚本很好,脚本仍然失败并且它没有给出失败原因或异常

同样的事情在 Jasmine 上工作得很好,但是当涉及到量角器黄瓜时,它就像这样工作

我的配置文件

exports.config = {

//seleniumAddress: 'http://localhost:4444/wd/hub',
getPageTimeout: 60000,
allScriptsTimeout: 500000,
directConnect:true,

framework: 'custom',
// path relative to the current config file
frameworkPath: require.resolve('C:\...\node_modules\protractor-cucumber-framework'),
capabilities: {
    'browserName': 'chrome'
},
ignoreUncaughtExceptions:true,
// Spec patterns are relative to this directory.
specs: [
    './learnFramework/utility/test.feature'
],

cucumberOpts: {
    require: './learnFramework/TestCases/spec.js',
    tags: false,
    profile: false,
    'no-source': true
},
 onPrepare: function () {
browser.ignoreSynchronization=true;
  }
};

我的规范文件

module.exports=function(){
    this.Given(/^Open the browser$/,async function(){
        browser.ignoreSynchronization=true;

    });

    this.Given(/^Load the URL$/,async function(){
        browser.get("https://google.com");
        console.log(await browser.getTitle());
    })
}

当我执行脚本时,它会打开 chrome 浏览器并加载 url 但不知道为什么会失败,甚至没有给出测试结果

执行结果


    I want to use this template for my feature file

  Scenario: Title of your scenario
  ✓ Given Open the browser
  ✖ And Load the URL

Failures:

[09:15:48] I/launcher - 0 instance(s) of WebDriver still running
[09:15:48] I/launcher - chrome #01 failed 1 test(s)
[09:15:48] I/launcher - overall: 1 failed spec(s)
[09:15:48] E/launcher - Process exited with error code 1

我正在使用 grunt 文件执行..

所以请有人帮我解决这个问题

await browser.get("https://google.com");

您需要等待浏览器转到 google。