I am using sweetalert2 on my website for creating popups. The sweetalert2 library adds DOM nodes to the page with JavaScript when a trigger is fired e.g. by clicking a button. The parent node of everything that is added is a div tag:
<div class="swal2-container">
...
</div>
In my Cypress test, I load the page and click the button that triggers the popup. However, the added DOM node (and its child nodes) are not found by Cypress:
it('Get content of popup', () => {
cy.get("[id='popup_trigger_button']").click()
cy.get("[class='swal2-container']", {timeout: 10000})
})
The test fails at the last row since the (added) node with the class "swal2-container" is not found on the page by Cypress. How can I get Cypress to find it?