Created by Jonathan Petitcolas / @Sethpolma
Only manual testing...
This is NOT PhantomCSS logo, just DeviantART! :(
A CasperJS module for automating visual regression testing with PhantomJS and Resemble.js. For testing Web apps, live style guides and responsive layouts.
CasperJS is a navigation scripting & testing utility for PhantomJS and SlimerJS written in Javascript
SlimerJS allows you to interact with a web page through an external JS script.
PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
Resemble.js analyses and compares images with HTML5 canvas and JavaScript.
# Installing PhantomJS sudo npm install -g phantomjs # Retrieving PhantomCSS sources git clone [email protected]:Huddle/PhantomCSS.git # Launching default test suite phantomjs demo/testsuite.js
With some awesome animated GIF!
<TABLE width=100% height=100%>
<TR>
<TD width=100% height=100% align=center valign=center>
<TABLE>
<TR align=center>
<TD align=center><IMG src=img/hammer.gif></IMG></TD>
</TR>
<TR align=center valign=center>
<TD><FONT size=7 color=red>Coming soon</FONT></p></TD>
</TR>
<TR>
<TD align=center><FONT size=5>Our website is currently under construction.</FONT></TD>
</TR>
<TR>
<TD align=center><BR><BR>
<FONT size=4>
<script type=text/javascript>
var date = (new Date()).toString()
document.write(date.split(' ').splice(1,4).join(' '));
</script>
</FONT>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR cellpadding=50>
<TD align=center>
<BR><BR><BR>
<FONT size=2 color=#666>
Website proudly created by <A href=#>FrontWeaver MX Gurus</A>
- © 1991 All rights reserved
</FONT>
</TD>
</TR>
</TABLE>
phantom.casperPath = './CasperJs';
phantom.injectJs(phantom.casperPath + '/bin/bootstrap.js');
var casper = require('casper').create({
viewportSize: {
width: 800,
height: 600
}
});
var phantomcss = require('./phantomcss.js');
var url = 'http://phantomcss/index.html';
phantomcss.init({
screenshotRoot: './screenshots',
failedComparisonsRoot: './failures'
});
casper
.start(url)
.then(function() {
phantomcss.screenshot('.coming_soon', 'coming-soon-page');
})
.then(function() {
phantomcss.compareAll();
})
.run(function() {
phantom.exit(phantomcss.getExitStatus());
});
jpetitcolas@jp-dev ~/dev/phantomcss $ phantomjs tests/css/coming-soon.js
Must be your first time?
Some screenshots have been generated in the directory ./screenshots
This is your 'baseline', check the images manually. If they're wrong, delete the images.
The next time you run these tests, new screenshots will be taken.
These screenshots will be compared to the original.
If they are different, PhantomCSS will report a failure.
<div class="coming_soon">
<img src="img/hammer.gif" alt="Under construction..." title="Under construction..." />
<h3>Coming soon</h3>
<p>Our website is currently under construction.</p>
<p class="date" id="date"></p>
</div>
<footer>
<p
>Website proudly created by <a href="#">FrontWeaver MX Gurus</a>
- © 1991 All rights reserved
</p>
</footer>
<script>
var date = new Date().toString().split(' ').splice(1,4).join(' ');
document.getElementById("date").innerText = date;
</script>
jpetitcolas@jp-dev ~/dev/phantomcss $ phantomjs tests/css/coming-soon.js
casper
.start(url)
.then(function() {
var Date = function () {
return {
toString: function() {
return 'Sun Sep 15 2013 10:28:50 GMT+0200 (Romance Daylight Time)';
}
}
}
phantomcss.screenshot('.coming_soon', 'coming-soon-page');
})