2017-09-16 27 views
0

我的量角器測試昨天在Chrome瀏覽器上運行得很好。 今天,它開始失敗一直在我解決諾言的地步。進一步調試時,我發現如果我評論了這個承諾聲明,那麼它會掛在下一個承諾解決方案聲明上。量角器測試在解決在Chrome中執行時的承諾時卡在中間

昨天和今天之間的量角器腳本沒有變化。在測試中的Angular應用程序中,開發人員進行了一些更改,但不是主要的。

任何人都可以幫我指出這裏可能會出錯嗎?

以下是代碼片段。它掛在許分辨率聲明template.getTemplatesCount(),則: - 。

mainMenu.clickTemplatesMenuOption(); 

templatePage.getTemplatesCount().then(count => { 
    console.log("Count of template card is:-"+count.toString()); 
    templateCountBeforeInsert = count; 

}); 

templatePage.openCreateTemplatePanel(); 
createTemplatePage.createTemplateWithoutDocument(templateName); 

我量角器conf.json看起來是這樣的: -

exports.config = { 
allScriptsTimeout: 30000000, 
specs: [ 
'./e2e/TestPlan/*.ts' 
], 
capabilities: { 
'browserName': 'chrome' 
}, 
directConnect: true, 
baseUrl: 'http://10.37.1.86:81/', 
getPageTimeout: 120000, 
framework: 'jasmine2', 
jasmineNodeOpts: { 
showColors: true, 
defaultTimeoutInterval: 120000, 
print: function() { } 
} 

以下是我使用工具的版本: - 量角器: - 5.1.2 ChromeDriver: - `2.32 鉻瀏覽器: - 61.x

+0

我完全封鎖在這裏。任何人都可以拋出一些指針來解決問題嗎? – user2337353

回答

0

你應該傳遞一個函數到你.then()塊,應該是這樣的:

templatePage.getTemplatesCount().then((count) => { 
    console.log("Count of template card is:-"+count.toString()); 
    templateCountBeforeInsert = count; 
}); 
0

一個簡單的方法是添加捕()如下:

templatePage.getTemplatesCount().then(count => { 
    console.log("Count of template card is:-"+count.toString()); 
    templateCountBeforeInsert = count; 
}) 
.catch(function(err){ 
    console.log('getTemplatesCount error: ' + err); 
}); 

如果你得到的錯誤日誌,請檢查其內部getTemplatesCount()。