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
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.
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!
The text was updated successfully, but these errors were encountered:
I've had success now by accumulating references to the coverage objects every time a window loads and then combining the coverage at the end. I plan on opening a PR with my suggested changes soon.
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 wherewindow
gets replaced, only the coverage from the lastwindow
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()
orcombineCoverage
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!
The text was updated successfully, but these errors were encountered: