lib/clientsidescripts.js
function() {
      if (window.getAngularTestability) {
        if (rootSelector) {
          var testability = null;
          var el = document.querySelector(rootSelector);
          try{
            testability = window.getAngularTestability(el);
          }
          catch(e){}
          if (testability) {
            testability.whenStable(testCallback);
            return;
          }
        }

        // Didn't specify root element or testability could not be found
        // by rootSelector. This may happen in a hybrid app, which could have
        // more than one root.
        var testabilities = window.getAllAngularTestabilities();
        var count = testabilities.length;

        // No angular2 testability, this happens when
        // going to a hybrid page and going back to a pure angular1 page
        if (count === 0) {
          testCallback();
          return;
        }

        var decrement = function() {
          count--;
          if (count === 0) {
            testCallback();
          }
        };
        testabilities.forEach(function(testability) {
          testability.whenStable(decrement);
        });

      }
      else {testCallback();}  // not an angular2 app
    }
function() {
      if (window.getAngularTestability) {
        if (rootSelector) {
          var testability = null;
          var el = document.querySelector(rootSelector);
          try{
            testability = window.getAngularTestability(el);
          }
          catch(e){}
          if (testability) {
            testability.whenStable(testCallback);
            return;
          }
        }

        // Didn't specify root element or testability could not be found
        // by rootSelector. This may happen in a hybrid app, which could have
        // more than one root.
        var testabilities = window.getAllAngularTestabilities();
        var count = testabilities.length;

        // No angular2 testability, this happens when
        // going to a hybrid page and going back to a pure angular1 page
        if (count === 0) {
          testCallback();
          return;
        }

        var decrement = function() {
          count--;
          if (count === 0) {
            testCallback();
          }
        };
        testabilities.forEach(function(testability) {
          testability.whenStable(decrement);
        });

      }
      else {testCallback();}  // not an angular2 app
    }
function ( ) { if ( window . getAngularTestability ) { if ( rootSelector ) { var testability = null ; var el = document . querySelector ( rootSelector ) ; try { testability = window . getAngularTestability ( el ) ; } catch ( e ) { } if ( testability ) { testability . whenStable ( testCallback ) ; return ; } } // Didn't specify root element or testability could not be found // by rootSelector. This may happen in a hybrid app, which could have // more than one root. var testabilities = window . getAllAngularTestabilities ( ) ; var count = testabilities . length ; // No angular2 testability, this happens when // going to a hybrid page and going back to a pure angular1 page if ( count === 0 ) { testCallback ( ) ; return ; } var decrement = function ( ) { count -- ; if ( count === 0 ) { testCallback ( ) ; } } ; testabilities . forEach ( function ( testability ) { testability . whenStable ( decrement ) ; } ) ; } else { testCallback ( ) ; } // not an angular2 app }
Wait for Angular2 testability and then run test callback
Wait for Angular2 testability and then run test callback