diff --git a/.travis.yml b/.travis.yml index e7fe5ca..4f37744 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,8 @@ before_install: - npm install -g gulp - git clone git://github.com/n1k0/casperjs.git ~/casperjs - cd ~/casperjs -# - git checkout tags/1.0.2 - export PATH=$PATH:`pwd`/bin - - cd - +# - cd - before_script: - phantomjs --version - casperjs --version \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 9a8e159..3fd8d64 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,8 +3,7 @@ var spawn = require('child_process').spawn, gutil = require('gulp-util'); gulp.task('test', function () { - var tests = ['myTests.js']; - + var tests = ['test/']; var casperChild = spawn('casperjs', ['test'].concat(tests)); casperChild.stdout.on('data', function (data) { @@ -15,5 +14,8 @@ gulp.task('test', function () { var success = code === 0; // Will be 1 in the event of failure // Do something with success here + if (!success) { + process.exit(1); + } }); }); \ No newline at end of file diff --git a/myTests.js b/test/test1.js similarity index 100% rename from myTests.js rename to test/test1.js diff --git a/test/test2.js b/test/test2.js new file mode 100644 index 0000000..bb18017 --- /dev/null +++ b/test/test2.js @@ -0,0 +1,17 @@ +casper.test.begin('testing.html contains stuff', 3, function (test) { + + casper.start('testing.html', function () { + test.assertTitle('Test Page'); + test.assertSelectorHasText('h1', 'Test!'); + }); + + casper.then(function () { + this.click('button'); + test.assertSelectorHasText('h1', 'New title'); + }); + + casper.run(function() { + test.done(); + }); + +}); \ No newline at end of file