我有不可预知的行为页面,取决于创建开发人员的更改。有时我的测试失败,因为页面没有加载。我的测试场景结构如下:特定故障后停止测试
describe('0. first actions', function() {
var lib = require("../../common.js");
var config = browser.params;
var url = config.listOfReferencesUrl, toolbar;
load(url, "list-of-references");
beforeAll(function() {
// some actions on the page
});
it('test0', function() {
since('test0 failed').
expect(toolbar.isPresent()).toBe(true);
});
describe('1.actions1', function() {
beforeAll(function() {
// some actions on the page
});
it('test1', function() {
since('test1 failed').
expect(table.getRow(clientNameNum).getRowInput().isEnabled()).toBe(true);
});
// ... another invested describes
});
如果负载的功能是:
global.load = function (url, pageType) {
browser.get(url);
if (pageType == 'list-of-references'){
browser.executeScript("icms.go('WEB_INQ_PROC', 'InquiryList', null, 0)");
}
browser.waitForAngular();
};
我不知道是否可以创建结构,停止我的测试,如果页面无法加载。但我不想使用'jasmine-bail-fast'
,因为如果页面加载,我希望看到另一个失败。 我试着写类似:
if (this.results_.failedCount > 0) {
// Hack: Quit by filtering upcoming tests
this.env.specFilter = function(spec) {
return false;
};
}
但它无法正常工作。我用茉莉花2。 也许有人知道我如何组织它?
什么是网页时,失败或成功加载'load'函数的值?它是否返回布尔值,承诺,HTML元素? – Freezystem
@Freezystem我更新了我的问题并添加了负载函数描述。它只是运行脚本并等待角度。 –
除非你正在加载外部库,我认为'beforeAll()'实际上并不存在于Jasmine核心中。您是否尝试在'beforeEach()'块中加载页面? – Freezystem