valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.53k stars 1.69k forks source link

Longer closing time of modals in 18.0.2 affecting Cypress tests #6678

Open SitDownBe opened 2 months ago

SitDownBe commented 2 months ago

Description: After updating from 18.0.0 to 18.0.2 many of our Cypress tests started failing. These are tests that close a modal and then immediately starts typing in input fields. Standard behaviour seems to be that page focus returns to the button that opened the modal after it is closed, but in 18.0.2 this is happening some time later than before. This results in some Cypress tests failing because the input field being typed in loses focus.

We've tried waiting for the modal to disappear from the DOM before continuing the tests with:

cy.get('bs-modal-backdrop').should('not.exist'); cy.get('modal-container').should('not.exist'); cy.get('body').should('not.have.class', 'modal-open');

but none of these delay the tests long enough for the modal opening button to be focussed before continuing. We also tried waiting for the button to be focussed before continuing, but it caused some flakiness. The only reliable way of solving this issue we've found so far is waiting for 500 ms after closing the modal in every test that interacts with an input field after closing a modal, which is not ideal.

lexasq commented 5 days ago

@SitDownBe Sorry for the late response, but i think the issue is that we have fade-out animation that normally takes 450ms. You can set animation false for your tests, or close your modal using BsModalService.hide() call which bypasses animation.