cmorten/cypress-web-vitals

Calculating FID perform random clicks on page which sometimes click element which opens other page

parul1220 opened this issue · 3 comments

Issue

To calculate FID the plugin perform realClicks() multiple times and randomly clicks on element and sometimes it clicks such element which is loading another page, hence plugin doesn't calculate accurate web-vitals metrics.

Setup:

  • node version: 16.18.0
  • cypress-web-vitals version: 2.2.1

Details

When I ran cy.vitals() commands it clicks on multiple element and sometime click such element which opens another page and this affect web vitals metrics calculation. Is there a way that we can control selector and prevent it from clicking such element which navigates to other page.

I also tried solution by passing firstInputSelector in the command but for first click it uses the defined selector and for other clicks it target random elements.
if you are aware of a solution please can you advise.

Impact:
Currently due to this issue we can not use this plugin.

Feature:
It would be nice if we can have control over which elements to be clicked while calculating FID.

Experiencing the same issue on my end, haven't found a workaround yet.

Ok that’ll be the lines here https://github.com/cmorten/cypress-web-vitals/blob/main/src/vitalsCommandHandler.js#L56

In hindsight not a great idea

Hardcoded element clicks have been removed in the latest version, only the body will be clicked by default if not first input selector is provided, otherwise the provided value(s) are used.

Please try 3.0.0