jeudi 7 avril 2016

Protractor (to test angular-growl) passing/failing inconsistently

I am trying to test that a growl message appears after a valid email is entered and the submit button is clicked. 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. 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 :). Any input would be great.

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();
                })
            })

Aucun commentaire:

Enregistrer un commentaire