I am also in same situation, My function returns undefined instead cell 
value, any help is appreciated

async verifyCreateAuditReport(FieldValue?: string): Promise<any> {
        
        var deferred = protractor.promise.defer();
        browser.logger.info("Verify Data on Create Audit Report");
        await browser.wait(element(by.xpath("//td/span['Name:']")).
isDisplayed(), 30000);

        await this.auditCriteriaReport.all(by.tagName('tr')).then(function (
rows) {
            browser.logger.info("Row Count::" + rows.length);
            rows.forEach(function (row: ElementFinder) {
                row.all(by.tagName('td > span')).then(function (cols) {
                    browser.logger.info("Column Count::" + cols.length);

                    if (cols.length > 0) {
                        cols.forEach(function (col: ElementFinder) {
                            col.getText().then(function (columnText) {
                                if (columnText == FieldValue) {
                                    
//browser.logger.info("Column Text is::" + columnText);
                                    //return Promise.resolve(columnText);
                                    return columnText;
                                    
                                    
                                }
                            });

                        });
                    }

                });
            });
        });
        
    }

On Friday, 28 August 2015 18:53:05 UTC+5:30, Jens Hoffmann wrote:
>
> Hello, 
>
>
> *I am trying to write a protractor test which check for the existence of an 
> table element. *
>
> *If the element doesn't exist in the table, the test should be successful.*
>
> *But the promise never resolves. I hope you can help me out. *
>
>
> *HTML:*
>
>
> *<table>
>     ...
>     <tr ng-hide="vm.noShippingCosts">
>         <td>shippingcosts</td>
>     </tr>
>     ...
> </table>*
>
>
>
> Page Object: 
>
> FreeShippingPO.prototype = Object.create({}, {
>     myelement: {
>         get: function () {
>             function getShippingCosts() {
>                 var deferred = protractor.promise.defer();
>
>                 element.all(by.css('table tr')).each(function (element, 
> index) {
>                     if(element.getText() === 'shippingcost') {
>                         deferred.resolve(true);
>                     }
>                 });
>                 return deferred.promise;
>             }
>             return getShippingCosts();
>         }
>     }
> });
>
>
> describe('free shipping costs', function () {
>     it('should not have table cell with "shipping costs"', function () {
>         browser.get('http://localhost:7777/#/shoppingCart#12314313121231');
>         expect(po.myelement).to.be.false;
>     });
> });
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/5b38c437-c8ca-4f1a-86ba-05f927756837%40googlegroups.com.

Reply via email to