meinaart / cypress-plugin-snapshots

Plugin for snapshot tests in Cypress.io
MIT License
498 stars 117 forks source link

The value of "offset" is out of range. It must be >= 0 and <= 22256636. Received -13216 #144

Closed david-boydell closed 4 years ago

david-boydell commented 4 years ago

Describe the bug I receive the error The value of "offset" is out of range. It must be >= 0 and <= 22256636. Received -13440 when trying .toMatchImageSnapshot()

To Reproduce

  1. With the following code:
    
    /// <reference types="cypress" />

describe('Signed out homepage', () => { it('displays the signed out banner', () => { cy.visit('https://www.test.bbc.co.uk/weatherwatchers').then(() => { cy.get('.banner--intro-signed-out').toMatchImageSnapshot(); }); }); });


2. Run `npx cypress open` and execute the test

**Expected behavior**
I expect the test to pass at this stage. Instead I receive the error `The value of "offset" is out of range. It must be >= 0 and <= 22256636. Received -13440`.

I feel this may be user error as no one else has experienced it, I have followed the README.md but perhaps have missed something. If so I apologise.

**Screenshots**
![image](https://user-images.githubusercontent.com/36667923/91160381-3b86fb80-e6c1-11ea-81d6-772aa0841eeb.png)

**Desktop (please complete the following information):**
 - OS: OS X 10.14.6 (18G1012)
 - Cypress Version: 5.0.0
lucidity-joe commented 3 years ago

Was there a solution to this issue please? I'm getting the same error, with a different offset.

jaythomas commented 3 years ago

@lucidity-joe I believe this happens when you try to snapshot an image that is larger than the viewport. Try resizing the viewport before taking the snapshot and see if that resolves your issue.