Comments (6)
Ran into this too - looks like it's not an issue with Cucumber, but with TypeScript preprocessor
Oops...we found an error preparing this test file:
cypress/integration/home/home.spec.ts
The error was:
Error: Webpack Compilation Error
/app/cypress/integration/home/home.spec.ts
./cypress/integration/home/home.spec.ts 35:23-38
[tsl] ERROR in /app/cypress/integration/home/home.spec.ts(35,24)
TS2339: Property 'compareSnapshot' does not exist on type 'Chainable<JQuery<HTMLBodyElement>>'.
at handle (/app/node_modules/@cypress/webpack-preprocessor/dist/index.js:172:23)
Using the following
// plugins/index.js
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor');
module.exports = (on, config) => {
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin');
getCompareSnapshotsPlugin(on, config);
on('file:preprocessor', cypressTypeScriptPreprocessor);
return config;
};
from cypress-image-diff.
yes, add the below to plugin/index.js
:
const compareSnapshotCommand = require('cypress-image-diff-js/dist/command')
compareSnapshotCommand()
so it will look like:
const cucumber = require('cypress-cucumber-preprocessor').default
const browserify = require('@cypress/browserify-preprocessor');
const resolve = require('resolve');
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin')
module.exports = (on, config) => {
const options = {
...browserify.defaultOptions,
typescript: resolve.sync('typescript', { baseDir: config.projectRoot }),
};
on('file:preprocessor', cucumber(options));
const compareSnapshotCommand = require('cypress-image-diff-js/dist/command')
compareSnapshotCommand()
};
from cypress-image-diff.
Thanks for your information! But I still cannot find the command after using your setting. :(
from cypress-image-diff.
I just realised you have the wrong imports happening... please follow the documentation below carefully:
https://github.com/uktrade/cypress-image-diff/blob/main/docs/Cypress%20integration.md
It's proven to work with cucumber setup so this is a setup issue in your end. I will be closing this issue shortly.
from cypress-image-diff.
This is a setup issue.
from cypress-image-diff.
solved this by using a different location: instead of cypress-image-diff-js/dist/command
, I used cypress-image-diff-js/command
.
commnds.js file
const compareSnapshotCommand = require('cypress-image-diff-js/command');
compareSnapshotCommand();
cypress.config.js
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/plugin');
setupNodeEvents(on, config) {
require('./cypress/plugins/index.js')(on, config);
cypressSplit(on, config);
getCompareSnapshotsPlugin(on, config)
return config;
},
from cypress-image-diff.
Related Issues (20)
- 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 8
- Intermittent Error: ENOENT: no such file or directory, open '/a/b/foo.png'
- Error: ERR_PACKAGE_PATH_NOT_EXPORTED HOT 4
- Trying to test maps but have uggly cut offs. HOT 1
- Component's transform translate changes unexpectedly during screenshot HOT 2
- Ability to reverse error - throw error if snapshots are the same and continue the test on different ones HOT 3
- Generate JSON Reports for Cypress Image Diff HTML Report when running GUI tests HOT 2
- Option to add browser name to screenshot or directory HOT 3
- JSON report not generated when cypress-split plugin in also used HOT 2
- Missing cucumber report when using cypress-image-diff and cypress-cucumber-preprocessor HOT 2
- Getting "Unable to resolve path to module 'cypress-image-diff-js/command'" and similarly for 'cypress-image-diff-js/plugin HOT 3
- 'userConfig' and 'generateJsonReport' should be added to the plugin exports HOT 2
- Are there any known issues with canvas elements? HOT 2
- Add actual diff percentage to the error message HOT 1
- Option to set a separate direction for baseline screenshot HOT 2
- Continue tests on failed comparison HOT 4
- Documentation page reported as containing malware 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.