Question: I'm super confused about how to tell Protractor and Selenium from where to serve my application for the integration tests (running Gulp on Jenkins).

This is my protractor configuration:

```
exports.config = {
    seleniumServerJar: '../node_modules/protractor/selenium/selenium-server-standalone-2.44.0.jar',

    multiCapabilities: [{
        browserName: 'chrome'
    }],

    baseUrl: 'http://127.0.0.1:9000/',

    rootElement: 'html',

    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000
    }
};

```

But here's the problem: `http://127.0.0.1:9000` doesn't exist. Should I deploy first and then do the integration tests or can it be done before deploying? Because if deploy needs to be done first, then it doesn't make any sense to me as to where to put it into the build system. Because then this is not and cannot be a part of a build system. So where does CI come in?

Answer: 
You need to do this in multiple steps/tasks with the help of `gulp`:

* start a selenium server (if you are using a local selenium server)
* start a web server, see [`gulp-webserver`](https://www.npmjs.com/package/gulp-webserver) (you were missing this step)
* run protractor tests
* shutdown a web server
* shutdown a selenium server
**A fully working example** of such configuration can be found on **angular-seed** project.
<https://github.com/angular/angular-seed>

I have managed to successfully use this example to use `protractor` tests in my GitHub project: <https://github.com/atais/angular-eonasdan-datetimepicker>

So you may use either to help you out.

---

**Basically the easiest way is to:**

1. run `http-server` as daemon
2. run gulp tests
3. manage everything from npm (`package.json`)

Full code is avaialable here: <https://stackoverflow.com/a/41983565/1549135>