mercredi 27 mai 2020

Modal / Pop-up window does not appear in Cypress

I have a page that when you visit the site, a modal / dialog window appears. However, when I am running it via Cypress, it does not seem to appear on the runner. Sample code:

cy.visit('http://demo-site.com')
cy.get('[id="modal"]').invoke('show') // This works so it seems the element can be found.
.get('[id="ok-button"]').click(); // This does not work as this is an element inside the modal

Snippet of the element console:

<div id="modal">
 <div class="modal-container">
  <div class="ui-container">
   <div class="ui-mask ui-mask-is-active" aria-hidden="false">
    <section class="ui-modal ui-modal-layout" tabindex="0" role="dialog">
     <footer class="ui-modal--footer ui-actions ui-actions-layout">
      <button id="ok-button" type="button">OK</button>
     </footer>
    </section>
</div></div></div></div>

Note: I have checked this blog but the problem is the calendar modal appears here while on mine, it does not: https://www.cypress.io/blog/2019/01/22/when-can-the-test-click/

Aucun commentaire:

Enregistrer un commentaire