nathanboktae / mocha-casperjs

Write CasperJS tests using Mocha
MIT License
120 stars 30 forks source link

Getting casper.start() to Play Friendly When Node Server already Started by Automated Tasks #90

Closed dschinkel closed 8 years ago

dschinkel commented 8 years ago

My gulpfile starts my node server at localhost:4000

In my tests I have:

describe('Feature: View List of Companies', function() {
    before(function () {
        casper.start('http://localhost:4000');
        phantomPage = this;
    });

and so on...

I have an npm task I run which runs my gulp tasks and then mocha tests (I'll change it to use a mocha gulp task later, just trying to get this working): gulp && mocha-casperjs test/features/specs/*-spec.js

Of course when I run my gulp tasks they start the express app at localhost:4000 already so when casper.start runs I get a Error: listen EADDRINUSE :::4000

How do I get this playing nice together?

nathanboktae commented 8 years ago

casper.start does not start a webserver. It connects to it. E.g casper.start('http://Instagram.com/') does not spin up a new Instagram obviously it connects to it. You probably have the gulp task starting the server being called twice.

dschinkel commented 8 years ago

yea that's not it. I'll look at my node setup more...