-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add visual diffing proof-of-concept.
- Add scripts/compareScreenshots.js. - Add gm dependency. - Temporarily introduce error to app-link. - Rename test/output to test/screenshots.
- Loading branch information
Showing
13 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var fs = require('fs'); | ||
var gm = require('gm').subClass({imageMagick: true}); | ||
|
||
function compareScreenshots() { | ||
const BASELINE_SCREENSHOTS_DIR = 'test/screenshots/baseline'; | ||
const DIFF_SCREENSHOTS_DIR = 'test/screenshots/diff'; | ||
const SESSION_SCREENSHOTS_DIR = 'test/screenshots/session'; | ||
|
||
fs.readdir(SESSION_SCREENSHOTS_DIR, (err, files) => { | ||
const screenshots = files.filter(file => file.indexOf('.png') !== -1); | ||
screenshots.forEach(screenshot => { | ||
gm().compare( | ||
`${SESSION_SCREENSHOTS_DIR}/${screenshot}`, | ||
`${BASELINE_SCREENSHOTS_DIR}/${screenshot}`, | ||
{ | ||
file: `${DIFF_SCREENSHOTS_DIR}/${screenshot}` | ||
}, | ||
(err, isEqual, change, raw) => { | ||
if (err) return handle(err); | ||
const changePercentage = (change * 100).toFixed(2); | ||
console.log(`${screenshot} has changed by ${changePercentage}%`) | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
|
||
} | ||
|
||
compareScreenshots(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters