title: CircleCI error your tests likely make requests to this 'baseUrl' and these tests will fail if you don't boot your server
body: <p>I am running an Angular 2+ app with integration testing using Cypress.io and CI using circleCI.</p>
  
  <p>I riffed off of a tutorial provided <a href="https://medium.freecodecamp.org/our-journey-for-using-circleci-2-0-to-build-and-deploy-an-angular-app-to-aws-s3-8e7ea3f51503" rel="nofollow noreferrer">here</a> for setting up an Angular project with circleCI, but needed to add the cypress orbs as well to run Cypress. So I ended up with the following config.yml script:</p>
  
  <pre><code>version: 2.1
  orbs:
    cypress: cypress-io/cypress@1.0.1
  jobs:
    build:
      working_directory: ~/project
      docker:
        - image: angular/ngcontainer
      steps:
        - checkout
        - run:
            name: Show current branch
            command: |
              echo ${CIRCLE_BRANCH}
              echo $fireBaseApiKey
        - restore_cache:
            keys:
              - v1-dependencies-{{checksum "package.json"}}
              - v1-dependencies-
        - run:
            name: Install local dependencies
            command: |
              npm install
        - save_cache:
            key: v1-dependencies-{{checksum "package.json"}}
            paths:
              - node_modules
        - run:
            name: Building
            command: npm run build
        - save_cache:
            key: v1-dist-{{ .Environment.CIRCLE_BRANCH}}-{{ .Environment.CIRCLE_SHA1}}
            paths:
              - dist
  workflows:
    version: 2.1
    build:
      jobs:
        - build
        - cypress/install:
            requires:
              - build
            build: 'npm run build'
            context: fireBaseApiKey
        - cypress/run:
            requires:
              - cypress/install
              - build
            start: 'npm start'
            context: fireBaseApiKey
  </code></pre>
  
  <p>When circleCI kicks off, the first two jobs of the workflow are successful (build and cypress/install), but cypress/run produces the following error:</p>
  
  <blockquote>
    <p>Cypress could not verify that the server set as your 'baseUrl' is
    running:</p>
    
    <blockquote>
      <p><a href="http://localhost:4200" rel="nofollow noreferrer">http://localhost:4200</a></p>
    </blockquote>
    
    <p>Your tests likely make requests to this 'baseUrl' and these tests will
    fail if you don't boot your server.</p>
    
    <p>Please start this server and then run Cypress again.</p>
  </blockquote>
  
  <p>I'm guessing that I did not boot the server with the <code>npm run build</code> command.</p>
  
  <p>I tried adding:</p>
  
  <pre><code>- run:
            name: start ng server
            command: ng serve
  </code></pre>
  
  <p>in the "build" job, but then the error was:</p>
  
  <blockquote>
    <p>/bin/bash: ng: command not found</p>
  </blockquote>
  
  <p>I tried to find a docker container on dockerhub that would execute ng commands and "angular/ngcontainer" seemed like a good candidate because using circleci/node:6.10-browsers as my docker image per the tutorial link also didn't recognize ng commands.</p>
  
  <p>I guess I'm mostly just way out of my depth here and haven't been able to find an example of an Angular project that uses Cypress and runs CI on circleCI. Having such an example would probably go a long way in helping things make sense. Until then, does anyone have any recommendations for how I might execute a command like <code>ng serve</code> and do you suppose that would solve my server not booting error?</p>
  
  <p>Update 3 Feb., 2019 19:34:</p>
  
  <p>I added <code>wait-on</code> after looking into <a href="https://circleci.com/orbs/registry/orb/cypress-io/cypress#usage-start-server" rel="nofollow noreferrer">the cypress orb usage</a> a little more per advice advice from a friend on the internet. Thus, my updated <code>-cypress/run</code> command reads:</p>
  
  <pre><code>...
  - cypress/run:
            requires:
              - cypress/install
              - build
            start: 'npm start'
            wait-on: 'http://localhost:4200'
            context: fireBaseApiKey
  </code></pre>
  
  <p>This seems to wait for an '<a href="http://localhost:4200" rel="nofollow noreferrer">http://localhost:4200</a>' that never happens.</p>