【发布时间】:2018-06-10 11:07:16
【问题描述】:
我是魅力报告的新手,想生成魅力报告。有人可以帮忙吗?
我正在尝试一个简单的示例,我的项目文件夹包含 config.js 和 test.js 以及安装的魅力报告
当我运行配置文件时,它会创建一个文件夹 allure-results,因为我可以看到屏幕截图和一个 xml 文件。我不知道从这里做什么,我正在尝试使用 maven 但无法生成 html 报告。
我已经添加了我的示例代码
config.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: 'test.js',
onPrepare: function () {
var AllureReporter = require('jasmine-allure-reporter');
jasmine.getEnv().addReporter(new AllureReporter({
allureReport: {
resultsDir: 'allure-results'
}
}));
jasmine.getEnv().afterEach(function (done) {
browser.takeScreenshot().then(function (png) {
allure.createAttachment('Screenshot', function () {
return new Buffer(png, 'base64');
}, 'image/png')();
done();
});
});
}
};
test.js
describe('angularjs homepage todo list', function () {
var todoList = element.all(by.repeater('todo in todoList.todos'));
it('should add a todo', function () {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
});
it('test 2', function () {
expect(todoList.count()).toEqual(3);
});
it('test 3', function () {
expect(todoList.get(2).getText()).toEqual('write first protractor test');
});
it('test 4', function () {
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
【问题讨论】:
-
尝试通过 maven 生成报告,但它给了我一个错误,说构建失败,找不到 pom.xml 文件,我从哪里可以得到这个项目的 pom.xml,因为我只有 2 个文件。?
标签: maven jasmine protractor allure