lundi 4 juin 2018

cucumber, protractor test passed even if it is not correct

I'm using protractor with cucumber (and cucumber reports) to test my app but I have an issue when I launch it. I check if a string is equal to another string, but is not and i know it. The fact is that after test launch the test passed but returns me an exeption.

The console returns this:

[15:56:41] E/launcher - expected 'Login Failed: This value is not existing' to equal 'Values are incorrect'

[15:56:41] E/launcher - AssertionError: expected 'Login Failed: This value is not existing' to equal 'Values are incorrect'

My stepdefinitions.js:

Then('I see the alert "Values are incorrect" for the contents which does not match the proper data', function (next) {

    let failed_msg = element(by.css('.faild-message'));
    failed_msg.getText().then(function(text){
        console.log('MY ALERT MESSAGE FOR SCENARIO EIGHT IS: ',text);
        expect(text.should.be.equal("Values are incorrect"));  
        next();
    });
});

The output for console.log is:

MY ALERT MESSAGE FOR SCENARIO EIGHT IS:  Login Failed: This value is not existing

Can someone help me?

PS: Cucumber reports don't shows nothing about this exception and told me that every tests are passed. Why? The strings are not equal and console told me that too. How can I solve this?

Thank you.

Aucun commentaire:

Enregistrer un commentaire