0

When using the Angular 4/5 CLI a node script is created named e2e. This executes the application and the Protractor tests from a single command.

Without using the CLI - I have a project that is too large to migrate to the CLI, how is this achievable? The following command does not work:

"e2e": "npm run server:dev && protractor protractor.conf

The webserver does not start.

Currently to run the tests I run 3 separate commands

webdriver-manager start 
npm start //run the app
protractor protractor.conf //run the tests

Current protractor conf is

const { SpecReporter } = require('jasmine-spec-reporter');
// conf.js
exports.config = {
    framework: 'jasmine',
    seleniumAddress: 'http://localhost:4444/wd/hub',
    allScriptsTimeout: 11000,
    // For angular2 tests
    useAllAngular2AppRoots: true,
    specs: [
      './e2e/**/*.e2e-spec.ts'
    ],
    capabilities: {
      'browserName': 'chrome'
    },
    directConnect: true,
    baseUrl: 'http://localhost:3000/',
    framework: 'jasmine',
    jasmineNodeOpts: {
      showColors: true,
      defaultTimeoutInterval: 30000,
      print: function() {}
    },
    onPrepare() {
      require('ts-node').register({
        project: 'e2e/tsconfig.e2e.json'
      });
     jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
    }
  }

Thanks in advance.

KnowHoper
  • 4,352
  • 3
  • 39
  • 54
  • Depending on the OS you are running, you could use a batch file, or shell script, to run those commands. – R. Richards Dec 17 '17 at 13:59
  • ```"e2e": "concurrently \"npm run start\" \"protractor protractor.conf\""``` does not work. Yields error Could not find update-config.json. Run 'webdriver-manager update' to download binaries. – KnowHoper Dec 17 '17 at 14:41
  • Hey this is NOT a duplicate as marked and I have a solution that works well here: https://stackoverflow.com/questions/49365602/how-to-start-a-server-before-protractor-runs-and-clean-up-afterwards/50185006#50185006 – light24bulbs May 08 '18 at 15:13

0 Answers0