Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo in Cypress scrollIntoView parameter duration as durution still works. #30958

Open
masaid2244 opened this issue Jan 27, 2025 · 0 comments
Open
Labels
topic: scrolling ↕️ type: enhancement Requested enhancement of existing feature

Comments

@masaid2244
Copy link

masaid2244 commented Jan 27, 2025

Current behavior

In Cypress, the scrollIntoView function accepts a parameter named duration to control the scrolling animation duration. However, if the parameter is misspelled as durution, the function still works without throwing an error or warning. The scrolling animation proceeds as expected despite the typo.

typo :
Image

test case pass with typo in parametre.

Image

Steps to Reproduce

  1. Open a Cypress test file.
  2. Use the scrollIntoView function with the parameter durution instead of duration as shown above.
  3. Run the test.
  4. Observe that no error or warning is thrown, and the scrolling animation works as if the correct parameter was provided.

Desired behavior

An error or warning should be thrown, indicating that durution is not a recognized parameter for the scrollIntoView function. The typo should be flagged, and the function should not silently accept incorrect parameters.

Test code to reproduce

describe("Demo Website Automation", () =>
     {
    
   it(' scrolling the page ', () => // 
   {

  cy.visit("https://www.worldometers.info/geography/flags-of-the-world/")
  cy.get("img[src='/img/flags/small/tn_tu-flag.gif']").scrollIntoView().should("be.visible") // for scrolling 

  cy.get("img[src='/img/flags/small/tn_tu-flag.gif']").scrollIntoView({durution:5000}) // this duration function takes time i.e in how many second we want to scroll to that location
  cy.get("body > div:nth-child(19) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(5) > div:nth-child(1) > div:nth-child(164) > div:nth-child(1) > div:nth-child(2)").contains("Sri Lanka") 
});


});
Image

Cypress Version

13.17.0

Node version

10.9.2

Operating System

window 22H2

Debug Logs

visithttps://www.worldometers.info/geography/flags-of-the-world/
(fetch)POST 204 https://analytics.google.com/g/collect?v=2&tid=G-ZDP3BFSX60>m=45je51n0v9169231628za200&_p=1738013226416&_gaz=1&gcd=13l3l3l3l1l1&npa=0&dma=0&tag_exp=102015666~102067555~102067808~102081485~102123608&cid=2128222923.1738013226&ul=en-us&sr=1280x720&uaa=x86&uab=64&uafvl=Not%2520A(Brand%3B8.0.0.0%7CChromium%3B132.0.6834.111%7CMicrosoft%2520Edge%3B132.0.2957.127&uamb=0&uam=&uap=Windows&uapv=10.0.0&uaw=0&are=1&pae=1&frm=1&pscdl=noapi&_s=1&sid=1738013226&sct=1&seg=0&dl=https%3A%2F%2Fwww.worldometers.info%2Fgeography%2Fflags-of-the-world%2F&dt=Flags%20of%20the%20World%20-%20Worldometer&en=page_view&_fv=1&_nsi=1&_ss=1&_ee=1&tfd=179
(fetch)POST 204 https://pagead2.googlesyndication.com/pagead/ping?e=1
2
getimg[src='/img/flags/small/tn_tu-flag.gif']
3
scrollIntoView
4
assertexpected <img> to be visible
5
getimg[src='/img/flags/small/tn_tu-flag.gif']
6
scrollIntoView{durution: 5000}
7
getbody > div:nth-child(19) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(5) > div:nth-child(1) > div:nth-child(164) > div:nth-child(1) > div:nth-child(2)
8
containsSri Lanka
(xhr)GET 200 https://ep1.adtrafficquality.google/getconfig/sodar?sv=200&tid=gda&tv=r20250122&st=env
(fetch)POST 204 https://analytics.google.com/g/collect?v=2&tid=G-ZDP3BFSX60>m=45je51n0v9169231628za200&_p=1738013226416&gcd=13l3l3l3l1l1&npa=0&dma=0&tag_exp=102015666~102067555~102067808~102081485~102123608&cid=2128222923.1738013226&ul=en-us&sr=1280x720&uaa=x86&uab=64&uafvl=Not%2520A(Brand%3B8.0.0.0%7CChromium%3B132.0.6834.111%7CMicrosoft%2520Edge%3B132.0.2957.127&uamb=0&uam=&uap=Windows&uapv=10.0.0&uaw=0&are=1&pae=1&frm=1&pscdl=noapi&_eu=AEA&_s=2&sid=1738013226&sct=1&seg=0&dl=https%3A%2F%2Fwww.worldometers.info%2Fgeography%2Fflags-of-the-world%2F&dt=Flags%20of%20the%20World%20-%20Worldometer&en=scroll&epn.percent_scrolled=90&_et=651&tfd=5835

Other

Possible Cause
The issue may arise because Cypress does not strictly validate option keys passed to the scrollIntoView function. It might silently ignore unrecognized parameters or treat them as valid, leading to unintended behavior.

Reported By
Name: Masaid Zeb
Email: masaid.zeb2244@gmail.com
My LinkedIn

@jennifer-shehane jennifer-shehane added type: enhancement Requested enhancement of existing feature topic: scrolling ↕️ labels Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: scrolling ↕️ type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

No branches or pull requests

2 participants