I'm trying to write a Unit Test that checks if a modal window (sweetalert) is present in the headless browser. To test if it's present, I can use this jQuery accessor
$('*').hasClass('sweet-overlay')
From testing sweetalert in Chrome, I do not believe this window is added to the DOM asynchronously. Also, according to the documentation, there isn't a load event.
However, in the test suite, the unit test finishes before the sweetalert window is added to the DOM. I can verify this by logging to the console.
So the question is, how do I test this? Is there a way to add a watch on the phanton.js DOM and listen for changes?
Note this is in an Angular application, so if there is a way to do this with Angular, that would great.
EDIT - I am not using Selenium. the title clearly states I'm using Jasmine.