Webdriver instances not created for custom protractor.conf file

My current protractor.conf:

chromeOptions: {
      args: [
        '--headless',
        'window-size=1920,1080'
      ]
    }

protractor.conf.js

const SpecReporter = require('jasmine-spec-reporter').SpecReporter;

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
   './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    shardTestFiles: true,
    maxInstances: 2,
    'browserName': 'chrome',
    chromeOptions: {
      args: ['--start-maximized']
    }
  },
  directConnect: true,
  baseUrl: 'localhost:4000/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 300000,
    print: function () {
    }
  },
  useAllAngular2AppRoots: true,
  onPrepare: function () {
    jasmine.getEnv().addReporter(new SpecReporter());
    require('ts-node').register({
      project: 'e2e/tsconfig.json'
    });
  }
};
 "scripts": {
    ...
    "test": "ng test --watch=false",
    "pree2e": "webdriver-manager update",
    "e2e": "concurrently --kill-others \"ng e2e --port=4000\" \"npm run _server:run\"",
    "e2e:ci": "concurrently --kill-others \"ng e2e --port=4000 --protractor-config=e2e/protractor.ci.conf.js\" \"npm run _server:run\"",
    "_server:run": "tsc -p ./server && concurrently \"tsc -w -p ./server\" \"nodemon dist/server/index.js\" ",
    ...
  },

.travis.yml

branches:
 only:
  - staging
  - prod
  - functional-testing
 script:
   ...
  - if [[ $TRAVIS_COMMIT_MESSAGE == *"[skip e2e]"* ]]; then echo "skipping E2E test"; else npm run e2e:ci; fi
  ...
before_deploy:
  - sed -i '/dist/d' .gitignore
  - git add . && git commit -m "latest build"
  - cd $TRAVIS_BUILD_DIR/dist

When I runnpm run e2e, every test is working fine. But when I’m using npm run e2e:ci command scripts hangs and no instance of WebDriver runs, nothing on GitHub issues or google, any ideas?

Pretty simple, that’s because since you made a new config file and apparently placed in the folder /e2e instead of the default root folder, that should have been your first clue.

The path to the test files in your case should also be updated.

The following:

./e2e/**/*.e2e-spec.ts

Will be changed to:

./**/*.e2e-spec.ts

Since, currently the test is not able to find any files specified, it doesn’t run any instances in runtime. My suggestion is to have better practices for placing your files in the proper directory (some vim plugins might help.)

1 Like