当我运行gulp启动量角器时我得到了这个错误
E / launcher - 未知错误:无法解析功能:代理 来自未知错误:proxyType是“手动”但未找到手动代理功能 (驱动程序信息:chromedriver = 2.35.528161(5b82f2d2aae0ca24b877009200ced9065a772e73),platform = Windows NT 10.0.16299 x86_64的)量角器版本5.1.1
gulpfile
ar gulp = require('gulp');
var path = require('path');
var child_process = require('child_process');
var requireDir = require('require-dir');
requireDir('./config/gulp/tasks');
var runSequence = require('run-sequence');
var open = require('gulp-open');
gulp.task('default', [
//'complete'
'protractor-test'
]);
function getBinary(packageName, binaryLocation) {
var pkgPath = require.resolve(packageName);
return path.resolve(path.join(path.dirname(pkgPath), '..', binaryLocation));
}
gulp.task('protractor-install', function(done) {
var binary = getBinary('webdriver-manager', '../bin/webdriver-manager');
child_process.spawn('node', [binary, 'update --versions.chrome 2.29'], {
stdio: 'inherit'
}).once('close', function() {
done();
});
});
gulp.task('protractor-start', function(done) {
var binary = getBinary('protractor', 'bin/protractor');
child_process.spawn('node', [binary, 'protractor.conf.js'], {
stdio: 'inherit'
}).once('close', function() {
gulp.src('protractor-results/report.html')
.pipe(open({ app: 'chrome' }));
done();
});
});
gulp.task('t', function() {
runSequence('start-server',
'start-proxy',
'protractor-start',
'stop-servers');
});
gulp.task('debug-proxy', function(done) {
child_process.spawn('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', ['--proxy-server=http=localhost:8080', '--user-data-dir=C:\\tmp', 'http://localhost:49852'], {
stdio: 'inherit'
}).once('close', function() {
done();
});
});
和量角器的配置
exports.config = {
directConnect: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
prefs: {
'credentials_enable_service': false,
'profile': {
'password_manager_enabled': false
}
}
},
'proxy': {
'proxyType': 'manual',
'httpsProxy': 'localhost:3000'
}
},
framework: 'jasmine',
specs: [
'Tests/Common/common-e2e-spec.js',
// 'Tests/S4B/skype4-business-e2e-spec.js',
// 'Tests/CM/client-management-e2e-spec.js',
// 'Tests/MC/manage-compute-e2e-spec.js'
],
useAllAngular2AppRoots: true,
baseUrl: 'https://localhost:44300',
beforeLaunch: function() {
return new Promise(function(resolve) {
screenshotreporter.beforeLaunch(resolve);
});
},
onPrepare: function() {
jasmine.getEnv().addReporter(screenshotreporter);
jasmine.getEnv().addReporter(xmlreporter1);
jasmine.getEnv().addReporter(xmlreporter2);
},
afterLaunch: function(exitCode) {
return new Promise(function(resolve) {
screenshotreporter.afterLaunch(resolve.bind(this, exitCode));
});
},
jasmineNodeOpts: {
//1 minute timeout
defaultTimeoutInterval: 60000,
showTiming: true,
print: function() {}
}
};
答案 0 :(得分:0)
请确保在没有 sudo的情况下运行gulp!