Created
October 22, 2013 16:59
-
-
Save klamping/7104237 to your computer and use it in GitHub Desktop.
Build your own CSS regression testing tool
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
Script to build URLs | |
https://github.com/cgiffard/node-simplecrawler | |
Script to build CSS selector file | |
https://github.com/caplin/SuperSelector | |
http://selectorgadget.com/ | |
Script to convert :hover, :focus, etc to .hover, .focus etc | |
https://github.com/jacobrask/styledocco/blob/master/share/previews.js | |
Apply for any selectors that match | |
Script to parse css | |
https://github.com/NV/CSSOM | |
var els = []; | |
var selectors = 'td:nth-child(1) , #style, .output-cell'; | |
var arr = selectors.split(','); | |
arr.forEach(function (selector){ els = els.concat([].slice.call(document.querySelectorAll(selector))); }) | |
els.forEach(function (el) { console.log(el) }); | |
Script to take screenshots and save (localStorage?) (also, looping through repeated elements) | |
http://html2canvas.hertzen.com/examples.html | |
Script to save screenshots to hard drive? | |
Script to compare screenshots to existing source | |
https://github.com/HumbleSoftware/js-imagediff | |
https://github.com/thingsinjars/Hardy/blob/master/features/support/imagetest.js | |
http://huddle.github.io/Resemble.js/ | |
Script to integrate with selenium and make all this come together | |
WebDriver | |
Selenium to do test execution, driving of browsers (but can also be run w/o selenium) | |
https://saucelabs.com/builder | |
var elementSelector = selectors(elementName); | |
imageTest.init({ | |
screenshotRoot: process.env.TESTPATH + '/screenshots', | |
processRoot: process.env.BINARYPATH, | |
webdriver: this | |
}); | |
imageTest.screenshot(elementSelector, function(err, result) { | |
if (err) { | |
return callback.fail(err); | |
} | |
if (result.status === 'firstrun') { | |
return callback.fail(new Error("First time this test has been run. New test cases have been created.")); | |
} | |
imageTest.compare(result.value, callback); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment