久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='wbwxP'><tr id='wbwxP'><dt id='wbwxP'><q id='wbwxP'><span id='wbwxP'><b id='wbwxP'><form id='wbwxP'><ins id='wbwxP'></ins><ul id='wbwxP'></ul><sub id='wbwxP'></sub></form><legend id='wbwxP'></legend><bdo id='wbwxP'><pre id='wbwxP'><center id='wbwxP'></center></pre></bdo></b><th id='wbwxP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wbwxP'><tfoot id='wbwxP'></tfoot><dl id='wbwxP'><fieldset id='wbwxP'></fieldset></dl></div>
    <tfoot id='wbwxP'></tfoot>

    • <bdo id='wbwxP'></bdo><ul id='wbwxP'></ul>

    <small id='wbwxP'></small><noframes id='wbwxP'>

    <legend id='wbwxP'><style id='wbwxP'><dir id='wbwxP'><q id='wbwxP'></q></dir></style></legend>

      1. Protractor Cucumber BDD 測試在執行前顯示通過

        Protractor Cucumber BDD Tests Show Pass before Execution(Protractor Cucumber BDD 測試在執行前顯示通過)
        <legend id='SC5KM'><style id='SC5KM'><dir id='SC5KM'><q id='SC5KM'></q></dir></style></legend>
          <tbody id='SC5KM'></tbody>

          <small id='SC5KM'></small><noframes id='SC5KM'>

        1. <i id='SC5KM'><tr id='SC5KM'><dt id='SC5KM'><q id='SC5KM'><span id='SC5KM'><b id='SC5KM'><form id='SC5KM'><ins id='SC5KM'></ins><ul id='SC5KM'></ul><sub id='SC5KM'></sub></form><legend id='SC5KM'></legend><bdo id='SC5KM'><pre id='SC5KM'><center id='SC5KM'></center></pre></bdo></b><th id='SC5KM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SC5KM'><tfoot id='SC5KM'></tfoot><dl id='SC5KM'><fieldset id='SC5KM'></fieldset></dl></div>
            <tfoot id='SC5KM'></tfoot>
            • <bdo id='SC5KM'></bdo><ul id='SC5KM'></ul>

                1. 本文介紹了Protractor Cucumber BDD 測試在執行前顯示通過的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個使用 Protractor 和 Cucumber 的示例 BDD 測試.在執行代碼時,控制臺立即顯示結果為通過,代碼實際上才開始執行.

                  I have a sample BDD test using Protractor with Cucumber. On executing the code, the console immediately shows the result as passed and the code actually begins executing only after that.

                  我希望執行狀態顯示與實際執行同步.(例如,控制臺顯示 - '鑒于我啟動量角器演示頁面'并執行下面的代碼,然后控制臺顯示下一步和等等)我知道它與異步編碼和回調有關,但無法找出確切的問題.

                  I wish execution status display to be in sync with actual execution.(e.g Console displays - 'Given I launch the protractor demo page' and the code underneath is executed, then console displays next step and so on) I know it has got something to do with Async coding and callbacks, not able to figure out the exact problem though.

                  功能文件:

                  Feature: Test
                  Scenario:  Test Scenario
                      Given I launch the protractor demo page
                      When I enter two in the first field
                      And I enter three in the second field
                      And I click Go button
                      Then Result should be displayed as Five
                  

                  步驟文件:

                   var chai = require('chai');
                      var chaiAsPromised = require('chai-as-promised');
                      chai.use(chaiAsPromised);
                      var expect = chai.expect;
                  
                      module.exports = function () {
                  
                  
                          this.Given(/^I launch the protractor demo page$/, function (callback) {
                              browser.driver.manage().window().maximize();
                              browser.get('http://juliemr.github.io/protractor-demo/');
                  
                              browser.getTitle().then(function(text){
                                 console.log('title is - ' + text);
                                  expect(text).to.equal('Super Calculator');
                              });
                           callback();
                          });
                  
                          this.When(/^I enter two in the first field$/, function (callback) {
                              element(by.model('first')).sendKeys('2');
                              callback();
                          });
                  
                          this.When(/^I enter three in the second field$/, function (callback) {
                              element(by.model('second')).sendKeys('3');
                              callback();
                          });
                  
                          this.When(/^I click Go button$/, function (callback) {
                              element(by.id('gobutton')).click();
                              callback();
                          });
                  
                          this.Then(/^Result should be displayed as Five$/, function (callback) {
                               element(by.repeater('result in memory')).all(by.tagName('td')).get(2).getText().then(function(text){
                              expect(text).to.equal('5');
                              });
                              callback();
                          });
                  
                      };
                  

                  推薦答案

                  您需要 return 一個承諾或在步驟定義中使用 done 回調.否則黃瓜不知道你什么時候異步動作完成.

                  You need to either return a promise or use the done callback in your step definitions. Otherwise cucumber doesn't know when your asynchronous actions are complete.

                  我有同樣的問題,上面的陳述是 protractor-cucumber github 論壇的核心成員之一的回復.

                  I had the same question and above statement was the response from one of the core members of the protractor-cucumber github forum.

                  當我使用 .then 函數對結果執行某些操作時,我更喜歡 return 承諾,并在我使用 .done 回調函數時不是,你也不需要 callbacks 現在 CucumberJS 支持承諾.所以你的步驟文件應該看起來像 -

                  I prefer to return promises when I am performing some actions on the results with .then function and use .done callback function when I am not, Also you don't need callbacks now CucumberJS supports promises. So your step file should look like -

                  var chai = require('chai');
                  var chaiAsPromised = require('chai-as-promised');
                  chai.use(chaiAsPromised);
                  var expect = chai.expect;
                  
                  module.exports = function () {
                  
                  
                      this.Given(/^I launch the protractor demo page$/, function () {
                          browser.driver.manage().window().maximize();
                          browser.get('http://juliemr.github.io/protractor-demo/');
                  
                        return browser.getTitle().then(function(text){
                             console.log('title is - ' + text);
                              expect(text).to.equal('Super Calculator');
                          });
                      });
                  
                      this.When(/^I enter two in the first field$/, function () {
                         return element(by.model('first')).sendKeys('2'); 
                      });
                  
                      this.When(/^I enter three in the second field$/, function () {
                         return element(by.model('second')).sendKeys('3'); // you can use return also
                      });
                  
                      this.When(/^I click Go button$/, function () {
                          return element(by.id('gobutton')).click();
                      });
                  
                      this.Then(/^Result should be displayed as Five$/, function () {
                          return element(by.repeater('result in memory')).all(by.tagName('td')).get(2).getText().then(function(text){
                          expect(text).to.equal('5');
                          });
                  
                      });
                  
                  };
                  

                  我建議你閱讀Promises http://www.html5rocks.com/en/tutorials/es6/promises/ 因為它需要一些了解它們的行為方式.它們有時可能很棘手,我花了一段時間才得到一個想法,但我還有很多東西要學:)

                  I would recommend you to read about Promises http://www.html5rocks.com/en/tutorials/es6/promises/ as it requires some understanding how they behave.They can be sometimes tricky, it took me a while to get an idea still I have lot to learn :)

                  這篇關于Protractor Cucumber BDD 測試在執行前顯示通過的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)

                  1. <legend id='14TCj'><style id='14TCj'><dir id='14TCj'><q id='14TCj'></q></dir></style></legend>

                        <tbody id='14TCj'></tbody>
                        <tfoot id='14TCj'></tfoot>
                        <i id='14TCj'><tr id='14TCj'><dt id='14TCj'><q id='14TCj'><span id='14TCj'><b id='14TCj'><form id='14TCj'><ins id='14TCj'></ins><ul id='14TCj'></ul><sub id='14TCj'></sub></form><legend id='14TCj'></legend><bdo id='14TCj'><pre id='14TCj'><center id='14TCj'></center></pre></bdo></b><th id='14TCj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='14TCj'><tfoot id='14TCj'></tfoot><dl id='14TCj'><fieldset id='14TCj'></fieldset></dl></div>

                        <small id='14TCj'></small><noframes id='14TCj'>

                        • <bdo id='14TCj'></bdo><ul id='14TCj'></ul>
                            主站蜘蛛池模板: 91精品国产综合久久精品 | 日本精品视频 | 在线观看免费黄色片 | 亚洲精品综合 | 精品国产乱码久久久久久图片 | 亚洲中午字幕 | 亚洲国产二区 | 久久夜视频| 午夜天堂精品久久久久 | 四虎影视一区二区 | 91视频入口 | 婷婷久久久久 | 精品伦精品一区二区三区视频 | 天久久 | 自拍视频一区二区三区 | 亚洲日本中文 | 亚洲伊人精品酒店 | 国产精品久久久久久久免费大片 | 久久久久久网站 | 久久久噜噜噜久久中文字幕色伊伊 | 午夜视频导航 | 在线看h| 成人毛片一区二区三区 | 亚州视频在线 | 亚洲有码转帖 | 91社区在线观看高清 | 国产精品久久亚洲7777 | 国产人免费人成免费视频 | www.av7788.com| 九九热视频这里只有精品 | 九九热在线免费观看 | 国产一区二区三区四区五区加勒比 | 高清国产一区二区 | 色婷婷亚洲 | 国产成人在线免费 | 美女视频网站久久 | 农村妇女毛片精品久久久 | 久久国产激情视频 | 一区二区福利视频 | av网站免费看| 麻豆国产一区二区三区四区 |