End to end testing

It would be great to be able to run my end-to-end tests with a single command npm test without having to separately launch ionic serve first.

Anybody have any experience with that they’d like to share?

You could possibly create a gulp task for that. Waiting for more experts on the field to come.

I’ve mostly automated our e2e tests with gulp and the gulp-shell plugin, but running ionic serve in the background is one thing I can’t get working yet.

@juice Thanks for the reply. I’d be interested to see your gulpfile if you would like to share it.

// m

sure, we use rails, here are the relevants parts:

var shell = require('gulp-shell');
var runSequence = require('run-sequence');

gulp.task('rails-kill', shell.task([
    "kill `cat ../tmp/pids/server.pid`"

gulp.task('rails-start', shell.task([
    "rails s -d"

gulp.task('db-setup', shell.task([
  'bundle exec rake db:drop db:create db:migrate && bundle exec rake seed_protractor'

gulp.task('protractor', shell.task([
  'protractor ./www/test/protractor.config.js'

gulp.task('e2e-test', function(){
  // start servers, setup test db,
  // run e2e tests,
  // reset db, kill rails daemon
  // will NOT kill rails daemon if protractor test fails
  runSequence('rails-start', 'db-setup', 'protractor',

but yeah, i’d love to know how to start ionic serve as a background process and then i could automate the whole thing