Permalink
Browse files

New functional tests using casperjs

  • Loading branch information...
laurentj committed Dec 10, 2012
1 parent bc49154 commit 277b03887d03b8e1d70b6e3a6973fdda8ab83c10
@@ -0,0 +1,3 @@
#!/bin/bash
casperjs test --pre=pre.js tests/
@@ -0,0 +1,9 @@
var testUrl = 'http://testapp.local';
if (casper.cli.has("testurl"))
testUrl = casper.cli.get('testurl');
casper.echo("Tests will be done on "+testUrl);
casper.test.done();
@@ -0,0 +1,18 @@
casper.start(testUrl+'/index.php/testapp/main/hello', function() {
this.test.assertEquals(this.fetchText('h1'), 'Hello YOU !', "Check page title");
this.click('h1+p+p a');
});
casper.then(function(){
this.test.assertEquals(this.fetchText('h1'), 'Hello BOB !', "Check page title with a given name");
})
casper.thenOpen(testUrl+'/index.php/testapp/main/hello?output=text', function(){
this.test.assertEquals(this.getPageContent(), 'Hello World !', "load a page using a text response");
})
casper.run(function() {
this.test.done(3);
});

0 comments on commit 277b038

Please sign in to comment.