Cypress encounters difficulty locating an element or scrolling to its view when it contains a deferred (@defer) block. Specifically, attempts to scroll to the bottom or to the element’s view are ineffective. In Cypress, using
cy.get(selectorname).scrollIntoView().should(‘exist’)
this is intended to scroll to the specified selector, but it fails to do so in this case. Although performance improves with the addition of defer, end-to-end tests (E2Es) still fail. Are there any adjustments required in the Cypress configuration to accommodate defer? Alternatively, could you suggest a resolution for this issue?
Tried using @if block like below, but this is not recommended, as we are not supposed to make changes in the product code for test fixing.
`@if(isdeferred()){@defer (on viewport){
<ng-container *ngTemplateOutlet="content"></ng-container>
} @placeholder () {
} } @else {
<ng-container *ngTemplateOutlet="content"></ng-container>
}`