w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How does Protractor executes the function calls. (E2E AngularJS + Protractor + Jasmine)

At first: well, protractor does, what you told it to do... You may read a bit about promises and async JavaScript.

I try to explain a bit, please understand, that explaining everything would take a lot of time.

Starting protractor calls your script (spec). The most lines you wrote before calling getArrayList() are function calls which return promises. This means, the function is called, and when ready, it's callback function gets called (e.g.: then(...))

An example:

        var colCount = element.all(by.repeater('col in
renderedColumns')).count(); 
        colCount.then(console.log) // This prints '80'

In this two lines you are searching the DOM for every element which can be located by col in renderedColumns, then, if ready, count them and return the value to its callback then, afterwards print it via console.log.

But all of this takes time, and this is the reason why console.log('Array List function started'); gets printed before colCount.then(console.log).

Hope I could help a bit, as mentioned before, you may read a bit about promises.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.