1

我正在尝试配置 gulp 以启动 Protractor(和 webdriver),但我得到了 "[launcher] Error: ReferenceError: System is not defined" 。我之前将 Karma 设置为识别 System,但我不知道如何为 Protractor 做同样的事情。

这是我的 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'
}

我的吞咽任务(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);
});

和量角器相关(package.json)

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

任何建议都非常感谢!

4

1 回答 1

2

所以,过了一会儿,我弄清楚了问题所在:

当我使用打字稿时,我已经导入了一些库,例如

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

ts 转译器将编译代码(按预期)添加 System. ...而量角器不知道“系统”是什么。

*** 我们为测试编写的代码是 Jasmine(不是 Angular)!

于 2016-04-22T20:09:57.967 回答