在我的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来处理承诺。感谢您的提示。 –