使用量角器黄瓜时未显示失败的原因或异常

问题描述 投票:0回答:1

我正在尝试使用量角器-黄瓜框架,并且在执行脚本时..即使脚本很好,脚本仍然失败,并且没有给出失败的原因或异常

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文件执行。。

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

protractor gruntjs cucumber cucumberjs grunt-contrib-jshint
1个回答
0
投票
await browser.get("https://google.com");
[您需要等待浏览器访问Google。
© www.soinside.com 2019 - 2024. All rights reserved.