2017-05-17 10 views
0

キュウリステップ定義分度器 - アサーションが失敗した場合のテストの実行が突然停止し

Then(/^Submit Button is disabled$/, function (done) { 
    element(by.buttonText('Search')).isEnabled().then(function (result) { 

     expect(result).to.equal(false); 
     done(); 
    }); 
}) 

コンソールエラー:

[12:17:13] E/launcher - expected false to equal true [12:17:13] E/launcher - AssertionError: expected false to equal true at D:\Mercurial\PromotionFinder\PromotionFinder\PromotionFinder.Web\features\steps\cucumber.js:178:31 at elementArrayFinder_.then (C:\Users\abhishes\AppData\Roaming\npm\node_modules\protractor\lib\element.ts:840:22) at ManagedPromise.invokeCallback_ (C:\Users\abhishes\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1366:14) at TaskQueue.execute_ (C:\Users\abhishes\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2970:14) at TaskQueue.executeNext_ (C:\Users\abhishes\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2953:27) at asyncRun (C:\Users\abhishes\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2813:27) at C:\Users\abhishes\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:676:7 at process._tickCallback (internal/process/next_tick.js:103:7) [12:17:13] E/launcher - Process exited with error code 199

分度器構成

exports.config = { 
    // seleniumAddress: 'http://127.0.0.1:9001/', 
    resultJsonOutputFile: "./e2e_report/report.json", 
    getPageTimeout: 60000, 
    allScriptsTimeout: 500000, 
    framework: 'custom', 
    // path relative to the current config file 
    frameworkPath: require.resolve('protractor-cucumber-framework'), 
    capabilities: { 
    'browserName': 'chrome', 
    chromeOptions: { 
     args: [ 
     '--start-maximized' 
     ] 
    } 
    }, 
    // Spec patterns are relative to this directory. 
    specs: [ 
    './features/*.feature' 
    ], 
    baseURL: 'https://angularjs.org/', 
    cucumberOpts: { 
    require: ["./features/globals.js", './features/steps/*.js'], 
    tags: [], 
    format: 'pretty', 
    profile: false, 
    'no-source': true, 
    "compiler": [] //, 
    //format:"json:./e2e_report/report.json" 
    } 
}; 

アサーションに失敗すると、テスト実行が突然停止し、テストレポートが生成されません。

私は 分度器のバージョンを使用しています - 5、アサーション

のバージョン2.0.0とチャイ約束したチャイ-として-&をcucumberjs私は以下のような情報が欲しい:

1のシナリオ(1失敗を) 5ステップ(1回失敗、3回スキップ、1回合格)

とresult.jsonを作成して、チームシップで結果を確認できます。

答えて

1

私はCucumberJS 2.0.0とはまだRC版であり、インターネット上でいくつかの問題を抱えています。 2.1.0は安定版なので、おそらく問題を解決することができます。

私はあなたのコードを見ると、これはトリックを行うべきだと思います。

// With callbacks 
 
Then(/^Submit Button is disabled$/, function(done) { 
 
    var searchButton = element(by.buttonText('Search')); 
 
    return expect(searchButton.isEnabled()).to.eventually.equal(false).and.notify(done); 
 
}); 
 

 
// With Promises 
 
Then(/^Submit Button is disabled$/, function() { 
 
    var searchButton = element(by.buttonText('Search')); 
 
    return expect(searchButton.isEnabled()).to.eventually.equal(false); 
 
});

それは

を役に立てば幸い
関連する問題