ng-flo
ng-flo

Reputation: 293

Error: ReferenceError: System is not defined

I am trying to configure gulp to launch Protractor (and webdriver) and I get the "[launcher] Error: ReferenceError: System is not defined" . I previously set Karma to recognize System but I have no idea how to do same thing for Protractor.

Here is my protractor.conf.js

exports.config = {
  framework: 'jasmine',
  specs: ['./dist/**/*e2e.js'],
//    seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
   seleniumServerJar: './node_modules/selenium-standalone-jar/bin/selenium-server-standalone-2.45.0.jar'
//   seleniumServerJar: './node_modules/selenium/selenium-standalone-jar/bin/selenium-server-standalone-2.48.2.jar'
}

my gulp task (gulpfile.js):

gulp.task('e2e', function(callback) {
    gulp
        .src(['./dist/**/*e2e.js'])
        .pipe(angularProtractor({
            'configFile': 'protractor.conf.js',
            'debug': true,
            'autoStartStopServer': true
        }))
        .on('error', function(e) {
            console.log(e);
        })
        .on('end', callback);
});

and protractor related (package.json)

"gulp-protractor": "^2.1.0",
"protractor": "2.5.1",
"selenium-standalone-jar": "2.45.0",

Any suggestion highly appreciated!

Upvotes: 1

Views: 1457

Answers (1)

ng-flo
ng-flo

Reputation: 293

So, after a while I figured out what the problem was :

As I was using typescript I had imported some libraries e.g.

import {
    it,
    describe,
    expect
} from 'angular2/testing';

The ts transpiler would compile the code (as intended) adding System. ... and protractor does not know what "System" is .

*** We write code for tests is Jasmine (not angular)!

Upvotes: 2

Related Questions