UI elements on the page: headers, footers, button etc for visual defects •Testing responsive designs •Testing complex visualizations (think charts, diagrams, graphs) which cannot be easily covered with unit or functional tests
retrieve certain CSS properties from elements and compare them to the benchmark: assert(element.getCss("color") === "red") Hardly an option due to the amount of code need to be written and complex maintenance.
C 567.328 25.899999999999977 567.328 33.89999999999998 562 33.89999999999998 C 556.672 33.89999999999998 556.672 25.899999999999977 562 25.899999999999977 Z" stroke-width="1"></ path> Ain't no testing framework gonna help your here
1. Open a page and take a screenshot of an element 2. Store the screenshot as a baseline 3. After a change is done, take another screenshot and compare it to the baseline
.then(function() { // Take a screenshot of the UI component phantomcss.screenshot('#my-elemenmt', 'a screenshot of my element'); }) .then(function() { // compare screenshots phantomcss.compareAll(); }) .run(function() { casper.test.done(); });