我正在尝试使用Internet Explorer在量角器中运行测试。 运行conf.js文件时,我收到以下消息,
我从另一个主题读到,该主题通过在conf.js文件中进行以下更改而得以解决。 另一个帮助主题的声明:
我的问题: 我不确定在conf.js文件中将onPrepare()使用异步的位置。如果有人可以帮助我,那就太好了。
我的conf.js文件
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
var today = new Date(),
timeStamp = today.getMonth() + 1 + '-' + today.getDate() + '-' + today.getFullYear() + '-' + today.getHours() + 'h-' + today.getMinutes() + 'm';
var reporter = new Jasmine2HtmlReporter({
consolidateAll: true,
savePath: 'reports/',
takeScreenshots: true,
filePrefix: 'index -' + today
});
exports.config = {
directConnect: false,
capabilities: {
'browserName': 'internet explorer'
},
/* multiCapabilities: [
{'browserName': 'chrome'},
{'browserName': 'firefox'},
], */
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
// We can mention the number of test scripts to be executed inside a suite by calling their file names.
suites: {
one: 'BudgetNewForm.js',
},
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 360000
},
allScriptsTimeout: 360000,
onPrepare: function () {
jasmine.getEnv().addReporter(reporter);
}
};
我的Testscript文件:
"use strict";
var util = require('util');
describe('Budget Setup form', function () {
var homescreen = require('./../BFRWEB_Automation//BudgetHomeScreen.po.js');
it('verify Net revenue calculation', function () {
beforeAll(function () {
browser.executeScript('window.sessionStorage.clear();'); //clear session
browser.executeScript('window.localStorage.clear();'); //clear local storage
});
debugger
browser.waitForAngularEnabled(false);
homescreen.get_QAurl();
homescreen.NavigatetoBudgetasUser1();
browser.driver.sleep(10000);
homescreen.clickRevenue();
function sumValueInColumn(tableID, columnNumber, expectedResult){
var expectedCells = element.all(by.css('.'+dx-datagrid-content+' tr td:nth-of-type(2)'));
var currentSum = 0;
expectedCells.each((eachCell) => {
eachCell.getText().then((cellText) => {
currentSum += Number(cellText);
});
}).then(() => {
expect(currentSum.toString()).toEqual(expectedResult);
});
};//END OF sumValueInColumn
});
});