How to visit localhost from zombie during grunt-cucumber test?

667 views Asked by At

Task

We're using an angular app generated by yeoman and we want to use cucumberjs to test our app. I have replaced the default grunt test task's karma with grunt-cucumber (it is otherwise the same).

We have a support file that adds zombiejs to the world, world.js:

var Zombie = require('zombie');
var World = function(callback) {
  this.browser = new Zombie();

  callback();
};
exports.World = World;

Inside of a step definition there is:

this.World = require('../support/world.js');
...
this.browser.visit('http://localhost:9000/', callback);

Problem

Which gives a 404 error:

Error: Server returned status code 404 from http://localhost:9000/ at /home/vagrant/Projects/ShadowWolf/client/node_modules/zombie/lib/zombie/window.js:411:23 at /home/vagrant/Projects/ShadowWolf/client/node_modules/zombie/lib/zombie/eventloop.js:234:18 at Object._onImmediate (/home/vagrant/Projects/ShadowWolf/client/node_modules/zombie/lib/zombie/eventloop.js:139:11) at processImmediate [as _immediateCallback] (timers.js:330:15)

Troubleshooting

However, when I ran a local grunt serer:test and from a node prompt ran the same javascript as above, everything worked as expected (although I did get "10 $digest() iterations reached. Aborting!" when I tried to print the text of the page -- which it did print).

Question

So my question is, how should I be accessing a test version of the webpage from within my cucumberjs step_definition files?

0

There are 0 answers