我一直在尝试使用" protractor-jasmine2-screenshot-reporter"来获取我的执行结果的html报告和截图。但HTML报告是使用
之类的内容创建的报告
摘要
测试的总规格:0
总失败:0
此处未保存任何屏幕截图。
我的配置文件如下
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots',
filename: 'my-report.html'
});
exports.config = {
directConnect: true,
//seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {'browserName': 'chrome'},
framework: 'jasmine',
specs: ['Login_spec3.js'],
allScriptsTimeout: 180000,
getPageTimeout: 180000,
jasmineNodeOpts: {
defaultTimeoutInterval: 180000
},
// Setup the report before any tests start
beforeLaunch: function() {
return new Promise(function(resolve){
reporter.beforeLaunch(resolve);
});
},
// Assign the test reporter to each running instance
onPrepare: function() {
jasmine.getEnv().addReporter(reporter);
afterAll(function(done) {
process.nextTick(done);
})
},
// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
reporter.afterLaunch(resolve.bind(this, exitCode));
});
},
onPrepare: function() {
var width = 1300;
var height = 1200;
browser.driver.manage().window().setSize(width,height);
}
};
其他详情如下: protractor@3.2.2, nodeVersion:4.2.4, npmVersion:2.14.12, 茉莉:2.4.1, selenium-webdriver:2.52.0
有人可以建议我解决吗?
答案 0 :(得分:1)
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots'
, filename: 'my-report.html'
});
exports.config = {
directConnect: true, //seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
}
, framework: 'jasmine'
, specs: ['spec.js']
, allScriptsTimeout: 180000
, getPageTimeout: 180000
, jasmineNodeOpts: {
defaultTimeoutInterval: 180000
},
// Setup the report before any tests start
beforeLaunch: function () {
return new Promise(function (resolve) {
reporter.beforeLaunch(resolve);
});
},
// Close the report after all tests finish
afterLaunch: function (exitCode) {
return new Promise(function (resolve) {
reporter.afterLaunch(resolve.bind(this, exitCode));
});
}
, onPrepare: function () {
var width = 1300;
var height = 1200;
browser.driver.manage().window().setSize(width, height);
jasmine.getEnv().addReporter(reporter);
afterAll(function (done) {
process.nextTick(done);
})
}
};
我在我的系统中对它进行了测试,结果非常好;)