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
# 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
  # - image: circleci/mongo:3.4.4

working_directory: ~/RA
# dependencies:
#   override:
#     - npm install
  - 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" }}
        - ./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
        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
  - store_test_results:
        path: /tmp/test-results/`Preformatted text`

and here is a link to public gist of my protractor.conf.js

(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.)