Description
From my understanding, currently this plugin will only save coverage at the end of the test. Since coverage is stored on the window
, if you have a test that navigates across more pages where window
gets replaced, only the coverage from the last window
will get saved even though different could could have been executed in the previous pages. I would like to collect coverage from every part of the app that was executed in the test.
As a workaround, I can manually save coverage using the combineCoverage
task in my test when I think I am done with executing the current page and I expect the next interaction to cause the page to change. However, this is less than ideal because it is an implementation detail that interrupts the flow of the test. It may be possible that I would also miss some coverage with this approach on something like additional form submission logic.
I have attempted to add a binding to the Cypress window events described here: https://docs.cypress.io/api/events/catalog-of-events.html#Binding-to-Events
However that generates an error about returning a promise inside a promise, so I'm not sure if it's possible to use cy.task()
or combineCoverage
in particular with a Cypress event listener.
Does anyone have an idea how saving coverage before a page could be automated? If it's possible, would that be a feature that could be added to this plugin?
Thank you for the work on this plugin, I find it very useful!