Comments (3)
@zquancai are you having problems with the font?
from cypress-image-snapshot.
I have had this issue as well, I think the best way to ensure consistent snapshots locally and on CI is to run your tests in a container, Cypress has some docs about using containers.
Alternatively if you're not interested in reworking your test setup at the moment, I have also had some success with tweaking the app styles to be more consistent across local and CI.
I'm not proud of this code but here is what I've tried in my Cypress commands:
function hackScreenshot() {
const iframe = window.parent.document.querySelector(
"iframe[id^='Your App']"
);
const contentDocument = iframe && iframe.contentDocument;
if (contentDocument) {
const style = contentDocument.createElement('style');
style.type = 'text/css';
style.appendChild(
contentDocument.createTextNode(
'* { font-family: Helvetica !important; } html { overflow-y: hidden; }'
)
);
contentDocument.head.appendChild(style);
return style;
}
return false;
}
function cleanupHackScreenshot(style) {
if (style) {
style.remove();
}
}
function hackAndMatchSnapshot(options) {
cy.hackScreenshot();
cy._snapshot(options);
cy.cleanupHackScreenshot();
}
from cypress-image-snapshot.
@zquancai are you having problems with the font?
Yes,you can install necessary font in your private image which is base on official image.
from cypress-image-snapshot.
Related Issues (20)
- Where i can see result for --reporter cypress-image-snapshot/reporter ?
- failureThreshold configuration question HOT 1
- cy.matchImageSnapshot() keeps takeing new screenshots and doesn't validate on any HOT 4
- Upgrade to Cypress version 8
- Upgrade to Cypress version 8 HOT 8
- I am getting the expected failure but the image doesn't have the red spots HOT 1
- matchImageSnapshot command options not being respected in cloud containers
- cy.task('Matching image snapshot') failed with the following error HOT 7
- Please upgrade term-img due to xmldom security issue
- Failure Threshold ENV variable or ENV var for config file HOT 1
- Is the project still in maintaining? HOT 2
- Critical Security vulnerability CVE-2022-22912 in latest version 4.0.1 due to [email protected]
- Update to be compatible with Cypress 10 HOT 31
- Is there any way to host the screenshots on cloud storage
- Unable to click more than one snapshot error. "The snapshot is missing..."
- It is impossible to stop updating UI snapshots after migration to Cypress 10
- How to update Snapshot for specific test instead of all tests HOT 2
- How to use Relative path instead of Absolute path for failed screenshot due to cypress-image-snapshot
- Problems that always pass visual regression tests run with the GitHub action
- Blackout parameter not working when combined with filename
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-snapshot.