我想将测试规范名称设置为browserstack中的测试名称。以下是我的browserstack堆栈配置文件。我正在使用量角器。
exports.makeDefaultCapabilities = function(that) {
return {
browserName: 'chrome',
chromeOptions: {
prefs: {
credentials_enable_service: false,
args: [
'disable-infobars=true',
]
},
loggingPrefs: {
driver: 'WARNING',
server: 'WARNING',
browser: 'INFO'
},
'browserstack.user': 'xx'
'browserstack.key': 'xxx',
'browserstack.debug': true,
};
};
exports.config = {
suites: {
smoke: [
'*/*.js'
]
},
SELENIUM_PROMISE_MANAGER: false,
baseUrl: undefined,
framework: 'jasmine',
allScriptsTimeout: 100000,
getPageTimeout: 100000,
maxSessions: 1,
seleniumAddress: 'https://hub-cloud.browserstack.com/wd/hub',
getMultiCapabilities: function() {
let that = this;
return new Promise(function(resolve) {
let defaults = exports.makeDefaultCapabilities(that);
let capabilities = [];
capabilities.push({
os: 'OS X',
os_version: 'High Sierra'
});
_.forEach(capabilities, function(capability) {
_.defaultsDeep(capability, defaults);
});
resolve(capabilities);
});
},
beforeSession: function(config, capabilities, specs) {
capabilities.name = specs && specs[0].split('/').pop() || undefined;
},
onPrepare: function() {
jasmine.getEnv().addReporter(failFast.init());
let reporter = new SpecReporter();
jasmine.getEnv().addReporter(reporter);
}
};
beforeSession挂钩不会将浏览器堆栈中的测试名称更新为测试规范名称。 期待任何建议。感谢您的帮助。
谢谢
答案 0 :(得分:0)
在* .conf.js文件中包含db2
,并在onPrepare()函数中遵循以下片段。这将获得测试规范的名称,并使用BrowserStack REST API更改名称。
const request = require('request');