我有不可預知的行爲頁面,取決於創建開發人員的更改。有時我的測試失敗,因爲頁面沒有加載。我的測試場景結構如下:特定故障後停止測試
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