Giter Club home page Giter Club logo

Comments (5)

Strezzo06 avatar Strezzo06 commented on June 20, 2024 2

Can you try the following changes, please?

I think assigning to config.specPattern should do job, you don't have to return with that.

const { defineConfig } = require('cypress');
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/plugin');

module.exports = defineConfig({
	defaultCommandTimeout: 15000,
	viewportWidth: 1440,
	viewportHeight: 900,
	waitForAnimations: true,
	scrollBehavior: 'center',
	e2e: {
		setupNodeEvents(on, config) {
			//Separate CV/LCV
			if (config.env.WEB === 'lcv') {
                                config.specPattern = 'cypress/e2e/lcv/**/product*.cy.js'
			} else if (config.env.WEB === 'cv') {
				config.specPattern = 'cypress/e2e/cv/**/*.cy.js'
			}
			return getCompareSnapshotsPlugin(on, config);
		},
		baseUrl: 'http://localhost:3000',
		specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
	},
});

Thank you so much, it's work.

from cypress-image-diff.

tamasmagyar avatar tamasmagyar commented on June 20, 2024 1

Can you try the following changes, please?

I think assigning to config.specPattern should do job, you don't have to return with that.

const { defineConfig } = require('cypress');
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/plugin');

module.exports = defineConfig({
	defaultCommandTimeout: 15000,
	viewportWidth: 1440,
	viewportHeight: 900,
	waitForAnimations: true,
	scrollBehavior: 'center',
	e2e: {
		setupNodeEvents(on, config) {
			//Separate CV/LCV
			if (config.env.WEB === 'lcv') {
                                config.specPattern = 'cypress/e2e/lcv/**/product*.cy.js'
			} else if (config.env.WEB === 'cv') {
				config.specPattern = 'cypress/e2e/cv/**/*.cy.js'
			}
			return getCompareSnapshotsPlugin(on, config);
		},
		baseUrl: 'http://localhost:3000',
		specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
	},
});

from cypress-image-diff.

tamasmagyar avatar tamasmagyar commented on June 20, 2024

I was not able to repro with:

  • Cypress 13.1.0 or above (unfortunately I had issues with 13.0.0)
  • cypress-image-diff-js 2.1.3

Config file (cypress-image-diff.config.cjs):

const config = {
  ROOT_DIR: '',
  FAILURE_THRESHOLD: 0.07,
  COMPARISON_OPTIONS: { threshold: 0.2 },
  RETRY_OPTIONS: {
    log: true,
    limit: 3,
    timeout: 1000,
    delay: 1000
  },
  JSON_REPORT: {
    OVERWRITE: true,
  }
};
module.exports = config;

Result:
image


@Strezzo06
Can you share the smallest amount of code that reproduces the bug? This helps in isolating the specific problem without the complexity of a larger codebase.

I created an initial project which you can configure to repro the bug, thank you in advance for the help!
Playground repository: https://github.com/tamasmagyar/cypress-image-diff-repro

from cypress-image-diff.

Strezzo06 avatar Strezzo06 commented on June 20, 2024

My config file

// cypress-image-diff.config.cjs
const config = {
	ROOT_DIR: '',
	FAILURE_THRESHOLD: 0.1,
	COMPARISON_OPTIONS: { threshold: 0.2 }, // default to { threshold: 0.1 }
	RETRY_OPTIONS: {
		log: true,
		limit: 3, // max number of iterations
		timeout: 15000, // time limit in ms
		delay: 1000, // delay before next iteration, ms
	},
	JSON_REPORT: {
		// FILENAME: 'cypress_visual_report', // default "report_[datetime].json"
		OVERWRITE: true, // default true
	},
};
module.exports = config; 

cypress.config.js

const { defineConfig } = require('cypress');
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/plugin');

module.exports = defineConfig({
	defaultCommandTimeout: 15000,
	viewportWidth: 1440,
	viewportHeight: 900,
	waitForAnimations: true,
	scrollBehavior: 'center',
	e2e: {
		setupNodeEvents(on, config) {
			// // import and initialise the cypress image diff plugin
			getCompareSnapshotsPlugin(on, config);

			//Separate CV/LCV
			if (config.env.WEB === 'lcv') {
				return {
					specPattern: ['cypress/e2e/lcv/**/product*.cy.js'],
				};
			} else if (config.env.WEB === 'cv') {
				return {
					specPattern: ['cypress/e2e/cv/**/*.cy.js'],
				};
			}
			return getCompareSnapshotsPlugin(on, config);
		},
		baseUrl: 'http://localhost:3000',
		specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
	},
});

I will try to run on cypress 13.6.1 to compare with cypress 13.0.0

from cypress-image-diff.

Strezzo06 avatar Strezzo06 commented on June 20, 2024

I found the root cause. My problem is this condition that i added before return config

//Separate CV/LCV
			if (config.env.WEB === 'lcv') {
				return {
					specPattern: ['cypress/e2e/lcv/**/product*.cy.js'],
				};
			} else if (config.env.WEB === 'cv') {
				return {
					specPattern: ['cypress/e2e/cv/**/*.cy.js'],
				};
			}

When i remove that condition. My config can work properly.
Screen Shot 2023-12-27 at 2 27 09 PM

from cypress-image-diff.

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.