protractor Control Flow and Promises Understanding the Control Flow

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Consider the following test:

it('should test something', function() {
  browser.get('/dashboard/');

  $("#myid").click();
  expect(element(by.model('username')).getText()).toEqual('Test');

  console.log("HERE");
});

In the following test, when the console.log() is executed and you see HERE on the console, none of the Protractor commands from previous lines have been executed. This is an entirely asynchronous behavior. The commands are represented as promises and were put on the Control Flow which would execute and resolve the promises sequentially, one by one.

See more at Promises and the Control Flow.



Got any protractor Question?