量角器+ ax-core错误jasmine.DEFAULT_TIMEOUT_INTERVAL
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了量角器+ ax-core错误jasmine.DEFAULT_TIMEOUT_INTERVAL相关的知识,希望对你有一定的参考价值。
我正在尝试在量角器 ax上编写辅助功能自动测试。测试用例:
1)打开URL
2)开始第一张幻灯片
3)Ax分析
4)下一张幻灯片
5)重复3-4
这是我测试的一部分
const excelbuilder = require('msexcel-builder');
const moment = require('moment');
const AxeBuilder = require('axe-webdriverjs');
const COLS = require('./../report-builder/lcomColumn').cols();
const workbook = excelbuilder.createWorkbook('reports', 'lcom_report' +
moment(new Date()).format('hh_mm_ss__DD-MM-YY') + '.xlsx');
const sheet1 = workbook.createSheet("sheet1", Object.keys(COLS).length, 65536);
let row = 2;
describe('Accessibility testing', () => {
beforeAll(() => {
let col;
for (col in COLS) {
if (col !== undefined) {
sheet1.set(COLS[col], 1, col);
}
}
});
afterAll(() => {
workbook.save((err) => {
if (err) {
console.log('======> Failed to save a WORKBOOK.');
throw err;
} else {
console.log('======> WORKBOOK has been saved.');
}
});
});
describe('Protractor Demo App', function () {
it('slide vwr', function () {
(async () => {
const startButton = element(by.className('play-button'));
const nextSlide = element(by.className('fa fa-arrow-right'));
browser.get(`local url`);
const EC = protractor.ExpectedConditions;
browser.wait(EC.visibilityOf(element(by.className('play-button')), 5000));
startButton.click();
const slides = element(by.className('counter'));
const getmaxslides = await slides.getText().then(function (text) {
const counts = +text.split('/')[1];
return counts;
});
const builder = AxeBuilder(browser.driver);
for (let slide = 0; slide < getmaxslides; slide++) {
builder.analyze(results => {
results.violations.forEach(v => {
const nodes = [];
v.nodes.forEach(node => {
nodes.push(node.html.substring(0, 250));
});
sheet1.set(COLS.file_name, row,);
sheet1.set(COLS.slide_num, row, slide + 1);
sheet1.set(COLS.violations, row, results.violations.length);
sheet1.set(COLS.rule_id, row, v.id);
sheet1.set(COLS.impact, row, v.impact);
sheet1.set(COLS.description, row, v.description);
sheet1.set(COLS.tags, row, v.tags);
sheet1.set(COLS.nodes_html, row, nodes.join(','));
row++;
});
});
nextSlide.click();
}
})();
});
});
});
我有160个型号(每个型号约30个幻灯片)。我使用此代码来测试可访问性。但在某些型号上我遇到了问题。我已经尝试更改defaultTimeoutInterval,但问题仍然存在。
这是日志的一部分:
FA Jasmine spec timed out. Resetting the WebDriver Control Flow.
Accessibility testing
Protractor Demo App
× slide vwr
- Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at ontimeout (timers.js:469:11)
at tryOnTimeout (timers.js:304:5)
- WebDriverError: no such session
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.10240 x86_64)
答案
在spec中添加超时解决了这个问题
describe('Protractor Demo App', function () {...} , timeout_in_millis)
以上是关于量角器+ ax-core错误jasmine.DEFAULT_TIMEOUT_INTERVAL的主要内容,如果未能解决你的问题,请参考以下文章
量角器 - 天蓝色 devops 管道中的 Chromedriver 错误