Protractor e2e test failures not failing build

We have circle ci properly running our single page app. We have unit tests passing and failing while properly passing or failing the build. But with out protractor e2e tests the build will always pass regardless of wether or not the build passes.

Does any one know how to fix this?

How are your Protractor tests being run? May we see your .circleci/config.yml file?

I would expect that this is a Unix command that returns 0 on success and non-zero on failure, so make sure you don’t have any additional commands that would cause the line to return 0.

Hi Thanks for the response!

I figured it out - in my protractor.conf.js file, in the afterLaunch method I had forgotten the resolve() call inside the returned promise.

1 Like

And since the resolve() was missing, it wouldn’t actually return any thing since the promise was un-resolved or rejected

version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:9.2.0-browsers

  # Specify service dependencies here if necessary
  # CircleCI maintains a library of pre-built images
  # documented at https://circleci.com/docs/2.0/circleci-images/
  # - image: circleci/mongo:3.4.4

working_directory: ~/RA
# dependencies:
#   override:
#     - npm install
steps:
  - checkout

  # Download and cache dependencies
  # - restore_cache:
  #     keys:
  #     - v1-dependencies-{{ checksum "package.json" }}
  #     # fallback to using the latest cache if no exact match is found
  #     - v1-dependencies-
  - run:
      name: install
      command: npm install
  - save_cache:
      key: dependency-cache-{{ checksum "package.json" }}
      paths:
        - ./node_modules
  - run:
      name: start
      command: npm run dev
      background: true
  # - test:
  #     pre:
  #       - npm start:
  #           background: true
  #       - sleep 5
  #     override:
  #       - npm test
  #       - npm run protractor
  - run:
      name: Run jest unit tests
      environment:
        JEST_JUNIT_OUTPUT: /tmp/test-results/junit/js-test-results.xml
        E2E_JUNIT: /tmp/test-results/e2e/
      command: npm test

  - run:
      name: Run e2e tests
      command: |
        sudo npm i -g protractor
        sudo webdriver-manager update
        protractor
  - store_test_results:
        path: /tmp/test-results/`Preformatted text`

and here is a link to public gist of my protractor.conf.js https://gist.github.com/surfjedi/509c3751c8127a42034d8d79048a6bd6

(Regarding the formatting above, YAML needs to be code formatted throughout to be readable. Would you edit this post to add a four-space Markdown indent to it? You can select the whole file and click the code formatting icon to do so.)