question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

compareSnapshot is not a function

See original GitHub issue

I cannot get the snapshot command to be available in my cypress.

I ran npm install cypress-visual-regression Here’s my setup (from this plugins docs):

// cypress/plugins/index.js

const getCompareSnapshotsPlugin = require('cypress-visual-regression/dist/plugin');
module.exports = (on) => {
  getCompareSnapshotsPlugin(on);
};

// cypress/support/commands.js

const compareSnapshotCommand = require('cypress-visual-regression/dist/command');
compareSnapshotCommand();

Result Screenshot 2020-09-04 at 21 50 32

// cypress configuration

{
animationDistanceThreshold:5
fileServerFolder:""
baseUrl:null
fixturesFolder:"cypress/fixtures"
blockHosts:null
chromeWebSecurity:true
modifyObstructiveCode:true
integrationFolder:"cypress/integration"
env:failSilently
pluginsFile:"cypress/plugins"
hosts:null
screenshotsFolder:"./cypress/snapshots/actual"
numTestsKeptInMemory:50
supportFile:"cypress/support"
port:null
projectId:null
videosFolder:"cypress/videos"
reporter:"spec"
reporterOptions:null
ignoreTestFiles:"*.hot-update.js"
testFiles:"**/*.*"
defaultCommandTimeout:4000
trashAssetsBeforeRuns:true
execTimeout:60000
userAgent:null
pageLoadTimeout:60000
viewportWidth:1000
requestTimeout:5000
viewportHeight:660
responseTimeout:30000
video:true
taskTimeout:60000
videoCompression:32
videoUploadOnPasses:true
screenshotOnRunFailure:true
watchForFileChanges:true
waitForAnimations:true
nodeVersion:"default"
firefoxGcInterval:runMode, openMode
retries:runMode, openMode
componentFolder:"cypress/component"
browsers:Chrome, Firefox, Electron
experimentalSourceRewriting:false
experimentalComponentTesting:false
experimentalShadowDomSupport:false
experimentalFetchPolyfill:false
experimentalNetworkStubbing:false
}

I can’t find any help on google about this.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
iseabockcommented, Apr 29, 2022

I’m having the same issue. I have imported commands in support/index.js and I’m on Cypress 9.0.0

0reactions
mjhea0commented, Sep 7, 2020

@Rolandisimo

Yeah, that file + import is added by default when you scaffold a new Cypress project. I just added a note about it to the README.

Read more comments on GitHub >

github_iconTop Results From Across the Web

compareSnapshot is not a function · Issue #54 · cypress-visual ...
I cannot get the snapshot command to be available in my cypress. I ran npm install cypress-visual-regression Here's my setup (from this ...
Read more >
How to fix TypeError: cy.document(...).toMatchSnapshot is not ...
But I got this error TypeError: cy.document(...).toMatchSnapshot is not a function . Here are my configurations: plugins/index.js
Read more >
property 'comparesnapshot' does not exist on type 'cy - You.com
I have follow the steps not able to find this function.. Please help. The error is saying property compareSnapshot does not exist on...
Read more >
Visual Testing - Cypress Documentation
Passing Cypress functional test. Cypress does NOT see how the page actually looks though. For example, Cypress will not see if the CSS...
Read more >
How to set up screenshot comparison testing with cypress ...
Now, if we run our tests using the npm run functional:customer:debug command, the cypress test runner will open, but the screenshot will not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found