Currently, I am in the process of writing a Unit Test to verify the presence of a modal window (sweetalert) within a headless browser environment. To perform this verification, I can utilize the jQuery accessor shown below:
$('*').hasClass('sweet-overlay')
Based on my examination of sweetalert in Chrome and the documentation provided, it appears that this window is not dynamically added to the DOM. However, during the execution of the test suite, the unit test concludes before the sweetalert window is actually inserted into the DOM. This observation has been confirmed through logging information to the console.
Given this scenario, I am now faced with the question of how to effectively test the presence of the sweetalert window. Is there a method available to monitor the changes within the phantom.js DOM and detect when the window is added? Additionally, since this project pertains to an Angular application, I am open to exploring any Angular-specific solutions that may help address this issue.
EDIT - It's worth noting that I am utilizing Jasmine for these tests, rather than Selenium as clarified in the title.