Skip to content

Commit

Permalink
New functional tests using casperjs
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentj committed Dec 10, 2012
1 parent bc49154 commit 277b038
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions testapp/tests-jelix/casperjs/launch.sh
@@ -0,0 +1,3 @@
#!/bin/bash

casperjs test --pre=pre.js tests/
9 changes: 9 additions & 0 deletions testapp/tests-jelix/casperjs/pre.js
@@ -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();
18 changes: 18 additions & 0 deletions testapp/tests-jelix/casperjs/tests/hellopage.js
@@ -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.