You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While running some tests I run into the following error:
TypeError: The following error originated from your application code, not from Cypress.
> [My-app]Cannot read properties of null (reading 'top')
When Cypress detects uncaught errors originating from your application it will automatically fail the current test.
This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.
Looking deeper into the error I notice the issue comes from the this.selectedElementRect.top in the else statement in the code below:
// ngx-guided-tour/projects/ngx-guided-tour/src/lib/guided-tour.component.tsscrollToAndSetElement(){this.updateStepLocation();// Allow things to render to scroll to the correct locationsetTimeout(()=>{if(!this.isOrbShowing&&!this.isTourOnScreen()){if(this.selectedElementRect&&this.isBottom()){// Scroll so the element is on the top of the screen.consttopPos=this.windowRef.nativeWindow.scrollY+this.selectedElementRect.top-this.topOfPageAdjustment-(this.currentTourStep.scrollAdjustment ? this.currentTourStep.scrollAdjustment : 0)+this.getStepScreenAdjustment();try{this.windowRef.nativeWindow.scrollTo({left: null,top: topPos,behavior: 'smooth'});}catch(err){if(errinstanceofTypeError){this.windowRef.nativeWindow.scroll(0,topPos);}else{throwerr;}}}else{// Scroll so the element is on the bottom of the screen.consttopPos=this.windowRef.nativeWindow.scrollY+this.selectedElementRect.top+this.selectedElementRect.height-this.windowRef.nativeWindow.innerHeight+(this.currentTourStep.scrollAdjustment ? this.currentTourStep.scrollAdjustment : 0)-this.getStepScreenAdjustment();try{this.windowRef.nativeWindow.scrollTo({left: null,top: topPos,behavior: 'smooth'});}catch(err){if(errinstanceofTypeError){this.windowRef.nativeWindow.scroll(0,topPos);}else{throwerr;}}}}});}
The text was updated successfully, but these errors were encountered:
eltongonc
added a commit
to eltongonc/ngx-guided-tour
that referenced
this issue
Jul 3, 2023
While running some tests I run into the following error:
Looking deeper into the error I notice the issue comes from the
this.selectedElementRect.top
in the else statement in the code below:The text was updated successfully, but these errors were encountered: