0

I can’t seem to run my e2e tests with protractor. Before I begin here is some background info:

Node: 7.7.4
NPM:  4.1.2.
Angular: 4.1.0
Protractor: 5.1.2

After I ran npm install protractor, I installed and updated web driver and got an update for IE. After I wrote my first test—a simple test to grab the text of the h1 tag on my login page—I attempted to run protractor and got an error: Error: Cannot find module ‘ts-node’ so I went and installed that. Now when I rerun protractor I get a mysterious error I cannot resolve: the specified path does not exist: e2e/tsconfig.e2e.json. What does this mean? My protractor conf.js file looks like this:

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

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

exports.config = {
  allScriptsTimeout: 11000,
  specs: [ //path of specs is relative to location of protractor.conf.js file. 
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
      //'browserName': 'chrome' ---default
      'browserName': 'internet explorer',
      'platform': 'ANY',
      'version': '11'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function() {}
  },
  beforeLaunch: function() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
  },
  onPrepare() {
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};

I tried fooling around with the path under the project parameter, but no luck with that resolving the issue. And my project structure is set up likes this:

proj structure

Any suggestions? Should I post this as an issue on github? To ts-node? Or protractor? Any suggestions would be appreciated. Please let me know if you need additional context too.

jrDeveloper
  • 167
  • 2
  • 10

1 Answers1

2

It means it's trying to find tsconfig.e2e.json (the typescript config file for your 'e2e' project) and can't. This part of the config shows the path it's looking for:

beforeLaunch: function() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
  },

But it's clear from your directory structure that it isn't there. Given the path to your spec files, I would imagine the line should read:

project: './e2e/tsconfig.e2e.json'

Looking at your project structure though, it could well be:

project: './app/e2e/tsconfig.e2e.json'

In which case, the path to your spec files will probably need changing to match.

M. Hudson
  • 889
  • 5
  • 11
  • Thank you! That's how I read the error, and I fiddled around with the path but had no success. I'll try tomorrow and accept your answer if all goes well. – jrDeveloper Jul 11 '17 at 03:40