Created
December 16, 2012 13:24
-
-
Save ypresto/4307223 to your computer and use it in GitHub Desktop.
Example for integrate test with casperjs
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
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<div id="hoge"><a href="#!/hoge">clickable hoge</a></div> | |
<div id="fuga" style="width:0px"><a href="#!/fuga">unclickable fuga</a></div> | |
</body> | |
</html> |
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
/*global require:false */ | |
var casper = require('casper').create(); | |
casper.start('./casper_test.html'); | |
casper.then(function () { | |
this.test.assertVisible('#hoge', 'hoge is clickable'); | |
this.clickLabel('clickable hoge'); | |
}); | |
casper.then(function () { | |
this.test.assertUrlMatch(/#!\/hoge/, 'hash changed to hoge'); | |
}); | |
casper.then(function () { | |
this.test.assertNotVisible('#fuga', 'fuga is not clickable'); | |
this.clickLabel('unclickable fuga'); | |
}); | |
casper.then(function () { | |
this.test.assertUrlMatch(/#!\/hoge/, 'hash not changed to fuga'); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment