-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: src/components/__tests__: use snapshot test for testing icon rendering #456
base: main
Are you sure you want to change the base?
Conversation
cc9deaf
to
1d3e7cd
Compare
My opinion that tests are failed (number of image pixels are different) under Mozilla Firefox web browser, because that scrollbar width size is different across web browsers and rendered image size will be different (I solved similar issue in the past). Solution is disable scrollbar before running tests (I think we have this example in our test code). |
d3df06d
to
5769f5d
Compare
With wrap<i.q-icon.notranslate.material-icons> Make code simple as possible, please. |
BannerChallengeDescription.cy.js component test (icon image snapshot) passed across different web browsers. Refactored and simplified Cypress.Commands.add('testIcon', ({ element, name }) => {
cy.get(element[0]).matchImageSnapshot(name, {
failureThreshold: 0.1,
failureThresholdType: 'percent',
timeout: 4000,
customDiffConfig: { threshold: 0.4 },
screenshotsFolder: 'test/cypress/snapshots',
retries: 2,
});
}); Which tests you are identify as the problematic tests? |
c130bc8
to
927350d
Compare
Updated with the simplified example. |
Add a common test command
testIcon
that makes use of snapshot command to visually test rendered icon.Replace individual icon tests with the common test across component test specs.