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

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

      <tfoot id='Smfo9'></tfoot>

      1. <small id='Smfo9'></small><noframes id='Smfo9'>

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

        如何讓 Protractor 不等待 $timeout?

        How can I make Protractor NOT wait for $timeout?(如何讓 Protractor 不等待 $timeout?)
          <tbody id='kfskn'></tbody>
      2. <legend id='kfskn'><style id='kfskn'><dir id='kfskn'><q id='kfskn'></q></dir></style></legend><tfoot id='kfskn'></tfoot>

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

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

                  本文介紹了如何讓 Protractor 不等待 $timeout?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在使用 Protractor 測試我的 Angular 應用程序.一旦用戶登錄到我的應用程序,我設置一個 $timeout 在一小時內完成一些工作(所以如果用戶在 13:00 登錄,$timeout 將在 14:00 運行).我不斷收到這些失敗:

                  I'm testing my angular application with Protractor. Once the user is logged in to my app, I set a $timeout to do some job in one hour (so if the user was logged-in in 13:00, the $timeout will run at 14:00). I keep getting these failures:

                  "Timed out waiting for Protractor to synchronize with the page after 20 seconds. Please see https://github.com/angular/protractor/blob/master/docs/faq.md. The following tasks were pending: - $timeout: function onTimeoutDone(){....."
                  

                  我已閱讀此超時頁面:https://github.com/angular/protractor/blob/master/docs/timeouts.md所以我知道量角器會等到頁面完全加載,這意味著他正在等待 $timeout 完成......

                  I've read this timeouts page: https://github.com/angular/protractor/blob/master/docs/timeouts.md so I understand Protractor waits till the page is fully loaded which means he's waiting for the $timeout to complete...

                  如何讓 Protractor 不等待 $timeout?我不想使用:

                  How can I make Protractor NOT wait for that $timeout? I don't want to use:

                  browser.ignoreSynchronization = true;
                  

                  因為那樣我的測試將因其他原因而失敗(其他角度組件仍然需要時間來加載...)

                  Because then my tests will fail for other reasons (other angular components still needs the time to load...)

                  推薦答案

                  解決方案是刷新活動超時(@MBielski 在評論中提到它),但原始刷新方法本身僅在 anuglar-mocks 中可用.要直接使用 angular-mocks,您必須將其作為 <script> 標記包含在頁面中,并且您必須處理它創建的所有覆蓋,它會產生很多副作用.通過偵聽創建的任何超時,然后按需重置它們,我能夠在不使用 angular-mocks 的情況下重新創建刷新.

                  The solution will be to flush active timeouts (as @MBielski mentioned it in comments), but original flush method itself is available only in anuglar-mocks. To use angular-mocks directly you will have to include it on the page as a <script> tag and also you'll have to deal with all overrides it creates, it produces a lot of side effects. I was able to re-create flush without using angular-mocks by listening to any timeouts that get created and then reseting them on demand.

                  例如,如果您的 Angular 應用程序超時:

                  For example, if you have a timeout in your Angular app:

                  $timeout(function () {
                      alert('Hello World');
                  }, 10000); // say hello in 10 sec
                  

                  測試將如下所示:

                  it('should reset timeouts', function () {
                  
                      browser.addMockModule('e2eFlushTimeouts', function () {
                  
                          angular
                          .module('e2eFlushTimeouts', [])
                          .run(function ($browser) {
                  
                              // store all created timeouts
                              var timeouts = [];
                  
                              // listen to all timeouts created by overriding
                              // a method responsible for that
                              var originalDefer = $browser.defer;
                  
                              $browser.defer = function (fn, delay) {
                                  // originally it returns timeout id
                                  var timeoutId = originalDefer.apply($browser, arguments);
                                  // store it to be able to remove it later
                                  timeouts.push({ id: timeoutId, delay: delay });
                                  // preserve original behavior
                                  return timeoutId;
                              };
                  
                              // compatibility with original method
                              $browser.defer.cancel = originalDefer.cancel;
                  
                              // create a global method to flush timeouts greater than @delay
                              // call it using browser.executeScript()
                              window.e2eFlushTimeouts = function (delay) {
                                  timeouts.forEach(function (timeout) {
                                      if (timeout.delay >= delay) {
                                          $browser.defer.cancel(timeout.id);
                                      }
                                  });
                              };
                  
                          });
                  
                      });
                  
                  
                      browser.get('example.com');
                  
                      // do test stuff
                  
                      browser.executeScript(function () {
                          // flush everything that has a delay more that 6 sec
                          window.e2eFlushTimeouts(6000); 
                      });
                  
                      expect(something).toBe(true);
                  });
                  

                  這有點實驗性,我不確定它是否適用于您的情況.也可以通過將 browser.addMockModule 移動到單獨的 node.js 模塊來簡化此代碼.如果您想刪除短超時(如 100 毫秒)也可能會出現問題,它可以取消當前正在運行的 Angular 進程,因此測試會中斷.

                  It's kinda experimental, I am not sure if it will work for your case. This code can also be simplified by moving browser.addMockModule to a separate node.js module. Also there may be problems if you'd want to remove short timeouts (like 100ms), it can cancel currently running Angular processes, therefore the test will break.

                  這篇關于如何讓 Protractor 不等待 $timeout?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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() 的限制?)

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

                    <bdo id='tNKYO'></bdo><ul id='tNKYO'></ul>
                      <tbody id='tNKYO'></tbody>

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

                            主站蜘蛛池模板: 一级欧美黄色片 | 日韩图区| 伊人二区 | 亚洲国产精品久久久久 | 精品少妇一区二区三区在线播放 | 国产免费观看久久黄av片涩av | 在线观看中文字幕 | 欧美极品在线播放 | 亚洲欧美中文日韩在线v日本 | 成人永久免费视频 | 日韩精品在线播放 | 一级免费看片 | 亚洲欧美一区二区三区在线 | 在线一区观看 | 中文字幕精品一区二区三区精品 | 97人人超碰 | sese视频在线观看 | 成人午夜激情 | 欧美又大粗又爽又黄大片视频 | 男女国产网站 | 三区四区在线观看 | 欧美极品一区二区 | 一区二区三区亚洲 | 婷婷开心激情综合五月天 | 中文字幕一区在线 | 99亚洲精品 | www.日韩欧美 | 羞羞色在线观看 | 亚洲视频www | 黄色毛片在线播放 | 国产色婷婷久久99精品91 | 国产在线看片 | 亚洲国产精品视频 | 中文字幕国产一区 | 久久久精品一区二区 | 国产精品久久久久一区二区三区 | 天天躁日日躁狠狠躁2018小说 | 91久久国产综合久久 | 美女黄色在线观看 | 一区二区三区免费网站 | 日韩一区二区三区视频在线观看 |