Forked from andreroggeri/angular-stability-check.js
Last active
October 21, 2021 07:26
-
-
Save sandipchitale/e4cf1dd36dd74db45889cc88618f4b1b to your computer and use it in GitHub Desktop.
Checks the Angular stability and logs on the console. Useful for debugging long protractor waits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copy and paste the code below on your browser console | |
* It will log the stable changes and how long it took to become stable | |
*/ | |
let currentStatus = undefined; | |
let root = $('ia-infoarchive-app'); // Change this selector to the component that you'll be watching (Usually the root component) | |
let startTime = new Date(); | |
let stabilityChecker = setInterval(() => { | |
let newStatus = window.getAngularTestability(root).isStable(); | |
if (currentStatus !== newStatus) { | |
currentStatus = newStatus; | |
console.log(`[StabilityChecker] Stable status changed to => ${currentStatus}`); | |
if (currentStatus) { | |
let delta = (new Date() - startTime) / 1000; | |
console.log(`[StabilityChecker] Took ${delta} seconds`); | |
} else { | |
startTime = new Date(); | |
} | |
} | |
}, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment