how can I return from an asynchronous protractor test?

I have created an asynchronous protractor test, but am unsure when I should call the done() function? How can I determine when all of the subfolders in the each loop has completed? If you see my code below, you can see that I have placed the done() obviously in the incorrect location. Can anyone tell me how / where I should place the done?

it('should make sure that there are no edit or delete buttons beside subfolders',function(done){
    folderContentPg.subFolders.each(function(subFolder){
        //get fid of subfolder
        subFolder.getAttribute('fid').then(
            function(subFolderFid){
                expect(folderContentPg.subFolderDeleteBtn(subFolderFid).isPresent()).toBe(false);
                expect(folderContentPg.subFolderEditBtn(subFolderFid).isPresent()).toBe(false);

            }
        );
        done();    
    })
});

Answers


You don't need the done callbacks. Protractor uses promises and WebDriver's controlFlow to handle execution.


Need Your Help

Swiping from one screen to another screen in android

android android-animation swipe gesture swipe-gesture

I have two arraylists name and price in an activity. It contains the name and prices of 3 products.We can call it as Product A, Product B, Product C. Now I want to display the product details of al...

Some of my asp.net api attribute based routing are returning 404 (not found)

c# asp.net asp.net-mvc-5 asp.net-web-api2

In the asp.net mvc 5 + web api 2 am working on, some of the webapi routes that I defined are not working, while some are working perfectly. I can't seem to identify what the problem is. And before ...