Fix TypeError: Wait for cytoscape instance to be ready before taking snapshot#173
Fix TypeError: Wait for cytoscape instance to be ready before taking snapshot#173
Conversation
Co-authored-by: leecalcote <7570704+leecalcote@users.noreply.github.com>
Co-authored-by: leecalcote <7570704+leecalcote@users.noreply.github.com>
Co-authored-by: leecalcote <7570704+leecalcote@users.noreply.github.com>
|
@copilot don't do this. Figure out another way to wait for cytoscape to be ready. There is no point in continuing with a screenshot if cytoscape isn't ready. |
|
|
Co-authored-by: leecalcote <7570704+leecalcote@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes a Cypress E2E snapshot test failure by guarding viewport operations when the Cytoscape instance isn’t available on window, allowing snapshot generation to proceed.
Changes:
- Add a null check around
win.cytobefore calling.fit()/.center() - Log a Cypress runner-visible message when Cytoscape is unavailable
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // Wait for cytoscape instance to be available |
There was a problem hiding this comment.
captureSnapshot is passed a window argument from the caller, but it calls cy.window() again and uses win instead, leaving the window parameter unused. Consider either using the passed-in window to read window.cyto, or removing the window parameter to avoid confusion and an extra Cypress command.
Co-authored-by: leecalcote <7570704+leecalcote@users.noreply.github.com>
Co-authored-by: leecalcote <7570704+leecalcote@users.noreply.github.com>
Co-authored-by: leecalcote <7570704+leecalcote@users.noreply.github.com>
Co-authored-by: leecalcote <7570704+leecalcote@users.noreply.github.com>
Updated to wait for cytoscape instance to be ready using |
Cypress snapshot test fails when
win.cytois undefined, blocking snapshot generation:Changes
cy.window().its('cyto').should('exist')to wait for cytoscape instance.then()to execute fit() and center() operations once cytoscape is confirmed to existThis ensures snapshots are only captured when the cytoscape canvas is fully loaded and properly positioned, preventing screenshots from being taken with an incomplete or missing canvas.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.