Comments (5)
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.
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.
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;
@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.
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.
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.
from cypress-image-diff.
Related Issues (20)
- Customizable baseline image name format HOT 9
- In projects with cucumber, the standard json report is not generated HOT 5
- Incorrect Difference Percentage Resulting from compareSnapshot Command HOT 6
- v1.31.0 was a breaking change HOT 3
- Add option to not take full size screenshot HOT 5
- Taken screenshots are not the size I configured HOT 10
- Option to run all tests and get diff files at once even if there are failing ones HOT 2
- Custom config file is not working HOT 14
- Cannot find module cypress-image-diff-js/dist/plugin HOT 12
- Error preparing file: cypress/support/e2e.js HOT 8
- Cypress integration broken: The deleteScreenshot 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task() HOT 4
- User config error `cypress-image-diff.config.js`
- Missing JSON report when in `cypress OPEN` mode HOT 3
- Unable to update folder locations HOT 5
- Unable to generate JSON REPORT under Folder cypress-image-diff-html-report HOT 1
- Specify shared location/path for Screenshots and Reports HOT 2
- Package subpath './dist/plugin' is not defined by "exports"... HOT 7
- Intermittent Error: ENOENT: no such file or directory, open '/a/b/foo.png'
- Error: ERR_PACKAGE_PATH_NOT_EXPORTED HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress-image-diff.