Control Flow and Promises

Other topics

Understanding the Control Flow

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.

Contributors

Topic Id: 8580

Example Ids: 26842

This site is not affiliated with any of the contributors.