在我的Angular2應用程序中,我有一個需要等待元素啓用的Karma單元測試。Angular2 Karma /量角器 - 等待元素啓用
我的問題是,我不知道如何使測試等待這個元素成爲啓用之前嘗試點擊它。
it('should check the fundDropdown exists', function() {
browser.get(url);
var menuStratItem = element(by.xpath('/html/body/alg-app/mainviewer/p-tabview/div/ul/li[2]/a'));
// Need to wait for this element to become enabled before I try to click it...
expect(menuStratItem.isEnabled()).toBe(true);
menuStratItem.click();
expect(element(by.id('fundDropdown')).isPresent()).toBe(true);
});
在繼續測試之前,我該如何等待這個元素變爲可用?
感謝你們,我仔細研究過,發現.wait不是阻塞功能。您需要使用.then來處理承諾。感謝您的提示。 –