tomastrajan / angular-ngrx-material-starter

Angular, NgRx, Angular CLI & Angular Material Starter Project
https://tomastrajan.github.io/angular-ngrx-material-starter
MIT License
2.82k stars 919 forks source link

Angular testability is unstable due to changeHours effect #511

Closed dvargas46 closed 4 years ago

dvargas46 commented 4 years ago

Minimal reproduction of the bug with instructions:

Load up the site and check Angular's built-in Testability to verify it stabilizes after requests are made. This can be checked via the console in your browser's Dev tools:

window.getTestabilities().forEach(testability => console.log(testability.isStable()))

This should display true eventually after all angular requests are completed. However it is always false. I believe this issue is caused by the changeHours effect that sets an interval within angular scope (assumed).

Expected behavior:

Checking Angular's testability to stabilize should return true after all requests have been made and completed.

Other information:

This can be resolved by removing the changeHours effect, but it'd be nice to keep it in. The effect is setting a pendingMacroTask in the testability, which never completes. Checking Angular's testability to be stable is helpful to verify that it's ok to proceed to the next step in Protractor and Selenium style E2E test cases.

I would be willing to submit a PR to fix this issue:

[X] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No