量角器conf.js: 我的控制台上没有显示任何颜色。 我已经添加了所有必需的配置,但仍然没有颜色输出
我正在尝试使用此处的报告器在此处打印所有浏览器报告。
var moment = require('moment');
var Jasmine = require('jasmine');
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var timeStamp=moment().format("MMDDYY_HHmmss");
exports.config = {
// ----- Connect to Browser Drivers ------------------------------------------
debugMode: true,
directConnect: true,
chromeDriver: 'C:/Users/LJQAuser/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.43.exe',
firefoxPath: 'C:/Users/LJQAuser/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.23.1',
//seleniumServer
// seleniumAddress: 'http://192.168.99.100:4445/wd/hub',
// seleniumServerJar: './node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.7.1.jar',
//seleniumAddress: 'http://192.168.99.100:4447/wd/hub',
/* webDriverStart: {
args: ['--seleniumPort', '4455']
},*/
noGlobals: false,
//seleniumArgs: ['--proxy=http://xxx:8080', '-Djava.security.egd=file:///dev/urandom'],
/* suites: {
regressionSuite: ['spec/!*kioskSampleWithCache*.js']//will run all specs in subfolders
},*/
// Spec patterns are relative to the location of this config.
specs: [
// 'spec/WEB*145*.spec.js',
'spec/sprint4/*415*.spec.js',
// 'spec/sprint5/*.spec.js',
// 'spec/sprint6/*.spec.js',
// 'spec/sprint7/*.spec.js',
//'spec/DB/*.spec.js',
/* 'spec/WEB-146.spec.js',
'spec/WEB-147.spec.js',
'spec/WEB-148.spec.js',
'spec/WEB-149.spec.js',
'spec/WEB-163.spec.js',
'spec/WEB-164.spec.js',
'spec/WEB-165.spec.js',
'spec/WEB-166.spec.js',
'spec/WEB-196.spec.js',*/
// 'spec/WEB-329.spec.js',
],
exclude: [
'spec/WEB*147*.spec.js',
'spec/WEB*148*.spec.js',
'spec/WEB*186*.spec.js',
'spec/WEB*192*.spec.js',
],
// ----- Set up browsers -----------------------------------------------------
/* capabilities: {
'browserName': 'chrome',
'idle-duration':10000,
/!* 'chromeOptions': {
'args': ['--user-data-dir=/a/random/path']
}*!/
},*/
multiCapabilities: [
{
'browserName': 'chrome',
'idle-duration':10000,
}, {
'browserName': 'firefox',
'marionette': true,
"moz:firefoxOptions": {
"binary": "C:/Program Files/Mozilla Firefox/firefox"
// "binary": "C:/Firefox Installer.exe"
},
'idle-duration':10000,
}],
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
showQuicklink: true,
defaultTimeoutInterval: 200000
},
params: {
max_wait_for_notification_popup:4000,
browserWidth:1080,
browserHeight:1920
},
// ----- Set up Runner, reporters -----------------------------------------------------
// TIMEOUTS
// https://github.com/angular/protractor/blob/master/docs/timeouts.md
// getPageTimeout: 60000, // Waiting for (Angular on) Page to Load
allScriptsTimeout: 120000, // Waiting for Angular AND Asynchronous Script Timeout
// browser.ignoreSynchronization // to disable waiting for Angular
//resultJsonOutputFile:'result.json',
restartBrowserBetweenTests: false,
useAllAngular4AppRoots: true,
onPrepare: function () {
// var SpecReporter = require('jasmine-spec-reporter');
return new Promise(function(fulfill, reject) {
browser.getCapabilities().then(function(value) {
reportName = 'protractor-report-' + '_' + value.get('browserName') + '_' + Math.floor(Math.random()*1E16);
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: __dirname+'/target',
docTitle: 'Web UI Test Report',
screenshotsFolder: '/image',
//takeScreenshots: true,
takeScreenshotsOnlyOnFailures: true,
consolidate: true,
consolidateAll: true,
preserveDirectory: true,
cleanDestination: false,
showColors:true,
//fixedScreenshotName: true,
fileName: "my-report.html",
fileNamePrefix: reportName
})
);
fulfill();
});
});
},
// Close the report after all tests finish
afterLaunch: function afterLaunch() {
var fs = require('fs');
var output = '';
fs.readdirSync('target/').forEach(function (file) {
if (!(fs.lstatSync('target/' + file).isDirectory()))
output = output + fs.readFileSync('target/' + file);
});
fs.writeFileSync('target/Consolidated-Report.html', output, 'utf8');
},
};
我还将在此处发布控制台输出。 请看看这个。
答案 0 :(得分:0)
Jasmine2HtmlReporter是html报告程序,表示它会生成包含测试信息的html报告。
当我阅读此框架的说明时,它不支持控制台日志。 showcolors 属性不是此框架内的选项。 https://github.com/Kenzitron/protractor-jasmine2-html-reporter#readme
如果您希望控制台输出,请取消注释 jasmine-spec-reporter 并注册到茉莉花。
请参考框架github页面:https://github.com/bcaudan/jasmine-spec-reporter