GithubHelp home page GithubHelp logo

Comments (4)

mjhea0 avatar mjhea0 commented on June 15, 2024

Can you provide insight into your workflow? How are you running your tests?

from cypress-visual-regression.

 avatar commented on June 15, 2024

Hello @mjhea0 ,

I'm working with cypress-visual-regression and i've same difficulties to work my tests.

Here is my workflow :

I've configured support/commands.js

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

And i've configured plugins/index.js

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

Then, after have created my test "visual_testing.spec.js into "cypress/integration/examples" like this :

describe('Integration test with visual testing', function () {
	it('Loads the homepage', function() {
		cy.visit('https://www.amazon.fr').then(() => {
			cy.compareSnapshot();
		})
	})
})

I run this cmd : npx cypress run --spec cypress/integration/examples/visual_testing.spec.js --env type=base --config screenshotsFolder=cypress/snapshots/base

It creates me a folder "snapshots/base/examples/visual_testing" where the .png file named "undefined-base.png" is included.

Then, i run this cmd : npx cypress run --spec cypress/integration/examples/visual_testing.spec.js --env type=actual

I get an error :

The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (/Users/<myuser>/Documents/Projects/Cypress-projects/cypress-visual-regression-plugin/cypress/plugins/index.js)

Error: ENOENT: no such file or directory, open '/Users//Documents/Projects/Cypress-projects/cypress-visual-regression-plugin/cypress/snapshots/base/examples/visual_testing.spec.js/undefined-actual.png'

And it creates me a folder "snapshots/diff/examples/visual_testing.spec.js" but is empty

Env :
"cypress": "^4.4.0",
"cypress-visual-regression": "^1.2.0",

from cypress-visual-regression.

mjhea0 avatar mjhea0 commented on June 15, 2024

This should fix it: #40

Use version 1.3.1 of the library to test: https://www.npmjs.com/package/cypress-visual-regression

from cypress-visual-regression.

 avatar commented on June 15, 2024

Hi @mjhea0
Thank you for your fix.
I allow myself to add this in the use of your plugin at the time of launching the script for the non regression. When launching the script, it's important to specify the directory like this: cypress run --env type=actual --config screenshotsFolder=cypress/snapshots/actual.
No mentioned into your documentation https://www.npmjs.com/package/cypress-visual-regression.
Unless, it works :)
Simple question : How to custom the image name? I would like to have the combo "Test suite + context" for the image name. Ex : "Integration test with visual testing -- Loads the homepage.png"

from cypress-visual-regression.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.