Thanks Matthew. That is how we were testing components till now.
But lately we also have use cases which require checking UI state. The simplest example I could share is,
Flow to test
- Show alert on page load with content, "Loading"
- Fetch something from server
- Based on promise result show another alert or hide the alert
I agree the code can refactored and multiple view models can be imported and tested. But by the way code is origanized, it is much easier to test by navigating to that page, wait for the DOM to load and check for the required HTML using jQuery or something.
How can we achieve this?