-
Notifications
You must be signed in to change notification settings - Fork 1k
Adds visual regression testing to Fuel UX #1990
Adds visual regression testing to Fuel UX #1990
Conversation
…ause of declarative nature of fuelux requireing it for proper initialization of fuel ux components on page
In Jest snapshot testing which is kind of similar, but strings of DOM or HTML, there's an overwrite command Is there something like that that can be done? |
done. |
Of course it doesn't work on Travis 😐 |
…al-regression-testing
…al-regression-testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the regression test fails on Travis because it is .0005% different.
- can that error threshold be tuned somewhere? If so what is a reasonable amount of "noise" to use?
- is there a way to access those diff images for errored checks? I cannot reproduce this locally therefore without access to the diff that was generated on Travis troubleshooting errored regression checks will be nigh impossible.
Looks like niffy hardcodes the filepath to |
…fuel-ux-tests-should-include-visual-regression-testing
…-testing' of github.com:cormacmccarthy/fuelux into GH1986---fuel-ux-tests-should-include-visual-regression-testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we raise the threshold up from 0% enough for it to stop failing on TravisCI I think this is good to go!
test/REGRESSION_TESTING.md
Outdated
|
||
If a change intends to change the look of an asset, you will need: | ||
|
||
1. Make a build (`npm build`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm run build
Done! All ready for you again @futuremint |
fixes #1986
The regression tests require an express server to be spun up and render handlebars templates on the server side so that what is served to the page is static HTML. This is because Fuel UX is declarative and some components either initialize on page load or on user interaction (eg. checkbox). In order to accomplish this, the component has to be rendered and ready on pageload when Fuel UX scrapes the page looking for components to initialize.
The Fuel UX Handlebars templates are used to accomplish this.
The test/regression folder should have a separate file for each Fuel UX asset.
The regression tests will look at either the local dev code (from
js/*
ordist/css/fuelux.css
) or will look at the reference code inreference/dist/
. Ideally the reference code will match the last prod release. Upon Fuel UX release the code from/dist/
is copied into/reference/dist/
. We use the dist version of CSS so that we don't have to deal with LESS crap in the browser.If a change intends to modify the look of an asset, those changes should be manually copied into the reference directory. The reason this was done was that otherwise we would have to "ignore" failing tests when you made a change that modified the look and feel. Now since you will be manually copying the changes into the reference folder, you are intentionally changing the output of reference and when you run the tests they will merely be making sure they match. Further changes tested against this new output will make sure that the change did not revert.