I am trying to test that a growl message appears after a valid email is entered and the submit button is clicked.
我正在测试在输入有效的电子邮件并单击submit按钮之后是否会出现咆哮消息。
I know the functionality is there, because I see the growl message appear when webdriver is running. The problem is capturing the growl message in the test.
我知道功能在那里,因为我看到咆哮消息出现时,webdriver正在运行。问题是在测试中捕获咆哮信息。
I have tried putting the forgotPasswordPage.submitButton.click()
both outside(before) and inside the browser.wait function. We have our growl configured to display the messages for 4 s so that's where I got the wait time. I'm looking for a way to make this test more reliable, and ideally I would be able to test the text that is actually inside the growl message, but first thing's first.
我尝试过将forgotPasswordPage.submitButton.click()同时放在浏览器内外。等功能。我们将咆哮配置为显示4秒的消息,这就是我的等待时间。我正在寻找一种方法使这个测试更可靠,并且理想情况下,我可以测试在growl消息内部的文本,但是首先要做的是。
it('should display green growl message if user email does exist', function(){
// uses testUsers[0]
forgotPasswordPage.emailInput.sendKeys(testUsers[0].email);
browser.wait(function() {
forgotPasswordPage.submitButton.click();
return element(by.css('.alert-success')).isPresent()
}, 4000)
.then(function(growlMessageIsPresent){
expect(growlMessageIsPresent).toBeTruthy();
})
.then(null, function(err) {
console.log('error', err)
expect(err).not.toBeTruthy();
})
})
1 个解决方案
#1
2
We had a similar problem, trying to catch a status message which appeared for couple of seconds and then disappeared, which we had to approach turning the Protractor-to-Angular sync off temporarily:
我们遇到了类似的问题,试图捕捉一个状态信息,它出现了几秒钟后就消失了,我们不得不将前向角同步暂时关闭:
browser.ignoreSynchronization = true;
#1
2
We had a similar problem, trying to catch a status message which appeared for couple of seconds and then disappeared, which we had to approach turning the Protractor-to-Angular sync off temporarily:
我们遇到了类似的问题,试图捕捉一个状态信息,它出现了几秒钟后就消失了,我们不得不将前向角同步暂时关闭:
browser.ignoreSynchronization = true;