cmorten / cypress-web-vitals

cypress-web-vitals
MIT License
21 stars 6 forks source link

cy.wrap(results) feature request #12

Closed msage-godaddy closed 2 years ago

msage-godaddy commented 2 years ago

Issue

Setup:

Details

This is not a bug. This is a feature request. Can you please wrap and return the results as an object, instead of the window, so it can be used and reported for metrics, trending over time, etc. and for console/headless running. Currently the test just 'passes' with no actual value in the output like it does in the cypress app window with the cy.log(result things). See screenshot.

feature-request-cy-wrap-results
cmorten commented 2 years ago

Sounds good đź‘Ť

msage-godaddy commented 2 years ago

Thank you :) The only caveat I haven't figured out, is how to report/return the errors too, if it runs into a fault, it doesn't return the object because it throws and returns faster.

cmorten commented 2 years ago

The pattern that cypress-audit and other tooling use is to accept an optional callback which receives the results as an argument, which fires before the error is thrown. Would that pattern work here? (Instead of returning the wrapped results)

The alternative would be a flag to optional turn off the lib throwing, but not sure about that…

msage-godaddy commented 2 years ago

Possibly - happy to test with you to see if we can get the results as object, just tell me where and I'll test the heck out of it.