2016-12-12 4 views
0

This ist HTML von Tabelleninhalten, und ich will diese HTML-Tags Tabelle Wie testet man die Tabelle und ihren Inhalt im Winkelmesser?

<thead> 
 
    <tr> 
 
    <td> 
 
     <a href="#" ng-click="sortType = 'date'; sortReverse = !sortReverse"> 
 
       Date-Time 
 
       </a> 
 
    </td> 
 
    <td><a>Amount</a> 
 
    </td> 
 
    <td><a>Transaction Type</a> 
 
    </td> 
 
    </tr> 
 
</thead> 
 

 
<tbody> 
 

 

 
    <!-- ngRepeat: tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end --> 
 
    <tr id="anchor0" ng-repeat="tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end" class="ng-scope"> 
 
    <td class="ng-binding">Dec 8, 2016 4:44:43 PM</td> 
 
    <td class="ng-binding">210</td> 
 
    <td class="ng-binding">Credit</td> 
 
    </tr> 
 
    <!-- end ngRepeat: tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end --> 
 
    <tr id="anchor1" ng-repeat="tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end" class="ng-scope"> 
 
    <td class="ng-binding">Dec 8, 2016 4:45:08 PM</td> 
 
    <td class="ng-binding">100</td> 
 
    <td class="ng-binding">Debit</td> 
 
    </tr> 
 
    <!-- end ngRepeat: tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end --> 
 
    <tr id="anchor2" ng-repeat="tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end" class="ng-scope"> 
 
    <td class="ng-binding">Dec 13, 2016 10:54:03 AM</td> 
 
    <td class="ng-binding">1000</td> 
 
    <td class="ng-binding">Credit</td> 
 
    </tr> 
 
    <!-- end ngRepeat: tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end --> 
 
    <tr id="anchor3" ng-repeat="tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end" class="ng-scope"> 
 
    <td class="ng-binding">Dec 13, 2016 10:54:05 AM</td> 
 
    <td class="ng-binding">32</td> 
 
    <td class="ng-binding">Credit</td> 
 
    </tr> 
 
    <!-- end ngRepeat: tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end --> 
 
    <tr id="anchor4" ng-repeat="tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end" class="ng-scope"> 
 
    <td class="ng-binding">Dec 13, 2016 10:54:10 AM</td> 
 
    <td class="ng-binding">155</td> 
 
    <td class="ng-binding">Debit</td> 
 
    </tr> 
 
    <!-- end ngRepeat: tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end --> 
 
    <tr id="anchor5" ng-repeat="tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end" class="ng-scope"> 
 
    <td class="ng-binding">Dec 13, 2016 10:54:12 AM</td> 
 
    <td class="ng-binding">12</td> 
 
    <td class="ng-binding">Debit</td> 
 
    </tr> 
 
    <!-- end ngRepeat: tx in transactions | orderBy:sortType:sortReverse | sDate:startDate:end --> 
 
</tbody> 
 
</table>

+0

Was möchten Sie darin testen? und setzen Sie Ihre HTML dieser Tabelle –

+0

Spaltenwert ..Ich fügte einen Screenshot der Tabelle hinzu, aber weiß nicht, warum es nicht zeigt –

+0

http://meta.stackexchange.com/questions/75491/how-to-upload-an-image -to-a-post –

Antwort

1

Bei testen Repeater erzeugt wird verwenden, können Sie Schleife schreiben können Zeilen zu bekommen und dann Spalten in Das.

Zum Beispiel:

element.all(by.repeater('row in rows')).then(function(rows){ 
rows.forEach(function(row){ 
    row.all(by.repeater('column in row.columns')).then(function(columns){ 
     /* your code here 
      navigate columns using columns[] 
     */ 
    }); 
}); 
}); 

Edit:

element.all(by.repeater('tx in transactions')).then(function(rows){ 
    rows.forEach(function(row){ 
     row.all(by.tagName('td')).then(function(columns){ 
      /* For getting text in date column*/ 
      columns[0].getAttribute('innerText').then(function(dateText){ 
       console.log('Date: ' + dateText); 
      }); 
      /* For getting text in Amount column*/ 
      columns[1].getAttribute('innerText').then(function(amountText){ 
       console.log('Amount: ' + amountText); 
      }); 
      /* For getting text in Transaction column*/ 
      columns[2].getAttribute('innerText').then(function(transactionType){ 
       console.log('Transaction Type: ' + transactionType); 
      }); 
     }); 
    }); 
}); 

obigen Code verwenden können Sie das Raster drucken, und Sie können schreiben, was Sie brauchen Logik zu Daten zu verifizieren.

+0

http://www.way2automation.com/angularjs-protractor/banking/#/listTx –

+0

Dies ist die Website, die –

+0

ich entscheidet das ist mein Tabelleninhalt –

Verwandte Themen