我能够在今晚早些时候使用browserstack-local运行我的量角器测试但是在晚上结束时我无法弄清楚发生了什么。
node v7.4.0
protractor v5.0.0
browserstack-local v1.2.0
这是我的conf.ts文件:
'use strict';
import { Config, browser } from 'protractor';
import testSuites = require('./testSuites.js');
import browserstack = require('browserstack-local');
const commonCapabilities = {
'browserstack.user': '*****',
'browserstack.key': '*****',
'browserstack.local': true
};
export let config: Config = {
baseUrl: 'https://localhost:8443',
seleniumAddress: 'http://hub-cloud.browserstack.com/wd/hub',
multiCapabilities: [{
browserName: 'chrome',
browser_version: '54.0',
os: 'Windows',
os_version: '10',
resolution: '1280x800'
}],
specs: ['src/**/*spec.js'],
suites: testSuites.suites,
framework: 'mocha',
mochaOpts: {
reporter: 'spec',
slow: 0,
timeout: 60000
},
allScriptsTimeout: 3600000,
onPrepare: () => {
browser.manage().window().setSize(1280, 800);
},
params: {
user: 'seleniumtesting'
},
beforeLaunch() {
console.log('Starting BrowserStack Local...');
return new Promise((resolve, reject) => {
exports.bs_local = new browserstack.Local();
exports.bs_local.start({ key: commonCapabilities['browserstack.key']}, error => {
if (error) {
return reject(error);
}
console.log('BrowserStack Started.');
resolve();
});
});
},
afterLaunch() {
return new Promise(resolve => {
if (!exports.bs_local) {
console.log('Skipping shutdown of BrowserStack Local...');
resolve();
return;
}
console.log('Stopping BrowserStack Local...');
exports.bs_local.stop(resolve);
});
}
};
// Code to support common capabilities
exports.config.multiCapabilities.forEach((caps) => {
Object.keys(commonCapabilities).forEach(i => {
caps[i] = caps[i] || commonCapabilities[i];
});
});
当我运行我的量角器测试时,我得到了:
Starting BrowserStack Local...
(node:3755) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
/usr/local/lib/node_modules/protractor/node_modules/q/q.js:155
throw e;
^
Error
at /protractor/node_modules/browserstack-local/lib/Local.js:57:20
at ChildProcess.exithandler (child_process.js:202:7)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:885:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:501:12)
这很奇怪,因为我在环境中没有改变任何东西,因为它是在晚上的最后一次工作,现在我不能让它运行而不会看到这个错误。我一直试图调试这个没有任何运气,如果我遗失了什么,有人可以帮我发现吗?
提前致谢!
答案 0 :(得分:0)
“os.tmpDir”不推荐使用Node v7.0.0。尝试降级您的节点并执行。
中提供了更多详细信息