Ben Aston
Ben Aston

Reputation: 55729

Protractor and promises

A lot of the functions exposed by Protractor return promises.

Do I need to structure my Jasmine tests using Protractor using things like async tests (with the done parameter), and .then, or does Protractor provide some magic to do this for me?

Upvotes: 1

Views: 356

Answers (2)

Delian Mitankin
Delian Mitankin

Reputation: 3691

WebDriverJS takes care of that with the control-flow. Protractor adds the modification of Jasmine's expect to keep the thens at bay. It's best explained here.

Upvotes: 3

Davin Tryon
Davin Tryon

Reputation: 67296

Yes, there is some magic that protractor performs in order to wait for each promise to resolve.

The best description of the process is in the protractor documentation: How It Works.

This means we don't have to structure the tests as async using a done. We can simply assert using expect (in Jasmine) and everything should work.

Upvotes: 1

Related Questions