The Problem:
In Protractor, expect()
is patched to implicitly understand promises which enables a shorthand assertion style. E.g.:
expect(elm.getText()).toEqual("expected text");
elm.getText()
here does not need to be explicitly resolved with then()
and would be implicitly resolved by Protractor before the expectation is checked.
But, what if the "to equal" part is also a promise. For instance, a text from an another element. In this case we have to resolve the second part explicitly:
elm2.getText().then(function (text2) {
expect(elm1.getText()).toEqual(text2);
});
The Question:
Is it possible to patch Jasmine/Protractor to make it understand promises on both sides of the assertion? To be able to write:
expect(elm1.getText()).toEqual(elm2.getText());
Aucun commentaire:
Enregistrer un commentaire