-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add screenshot-comparison utility, to protect against visual regressions during CSS refactors. #7395
Add screenshot-comparison utility, to protect against visual regressions during CSS refactors. #7395
Conversation
@@ -12,7 +12,12 @@ target | |||
.idea | |||
*.iml | |||
*.log | |||
/test/output | |||
/test/screenshots/diff/**/* | |||
!/test/screenshots/diff/.empty |
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.
I suggest using mkdirp.sync(dirname(path))
before saving. It's more future proof and less messy that way.
Looking good |
shadow: true, | ||
}, function (comparisonError, result) { | ||
if (comparisonError) { | ||
return console.log(comparisonError); |
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.
If this is a CLI tool I would just throw comparisonError
.
07aa5a3
to
8f8b82e
Compare
var self = this; | ||
var testName = (testObj.parent) ? [testObj.parent.name, testObj.name].join('_') : testObj.name; | ||
handleError(testObj) { | ||
const self = this; |
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.
one more self to get rid of, sorry
LGTM |
const screenshot = await this.remote.takeScreenshot(); | ||
mkdirp.sync(directoryPath); | ||
fs.writeFileSync(filePath, screenshot); | ||
} catch (err) { |
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.
Probable move catch
clause one level up, so we saveScreenshot.catch(reason => console.log(reason))
. Leave error handling to consumer
Few style comments but LGTM otherwise |
193dde3
to
eb5618d
Compare
…ons during CSS refactors. - Remove test/output and added test/screenshots (requires a Jenkins change). - Add test/screenshots/baseline images. These document the expected state of the UI. - Add dependency on image-diff package. - Add utilities/compareScreenshots.js, which can be run via 'npm run compareScreenshots'.
eb5618d
to
9fa2e82
Compare
@spalger Looks like Jenkins is pushing the S3 artifacts! Thanks. |
Changes
Reference
Based upon #7382