v1.10.0
This minor release has a bug fix for handling large canvases and a new feature to change the behavior for inlining canvas elements.
Bug fix: canvas
performance
When a test suite has to handle a significant amount of inlined canvas data, we were seeing timeouts from happoRegisterSnapshot
calls. We think this is because the underlying node process runs out of memory. Even though the root cause hasn't been confirmed, we're making some changes to canvas handling to improve performance (mainly memory footprint). Canvases are now written to disk instead of kept in memory.
New feature: responsiveInlinedCanvases
When canvases are inlined as <img>
elements, we copy over as much styling as possible, including the width
and height
of the canvas (which are often fixed numbers). When the registered snapshots are sent to Happo for screenshots, the fixed width and height can become problematic, as the screen size can differ from when the canvas was first created. A new responsiveInlinedCanvases
option allows users to better control what styles are applied to the inlined image element. You can set this option globally or locally. Here's how you do it globally in cypress/support/commands.js
:
import { configure } from 'happo-cypress';
configure({ responsiveInlinedCanvases: true });
Here's how you do it locally in a spec
file:
cy.get('.selector').happoScreenshot({ responsiveInlinedCanvases: false });
When the value is true
, the following css is applied to the inlined <img>
element:
width: 100%;
height: auto;