I am new to protractor and have written a short expect to get all the columns in a grid by their name:
it('All headers are present', function(){
element.all(by.css('.ag-header-cell-text'))
.map(function(header){
return header.getText()
}).then(function(headers){
expect(headers).toEqual(['Publisher Name', 'IpAddress', 'AddedDate', 'Delete Ip']);
});
});
But I get the error when I run my test saying it doesn't recognise the 'Delete Ip' name and expects the value of $[3]
× All headers are present
- Expected $[3] = '' to equal 'Delete Ip'.
Code (by developer not by myself - I am writing tests for their code) is as follows:
{headerName: "Publisher Name", field: "abbreviation", width: 298, suppressFilter: true},
{headerName: "IpAddress", field: "ipAddress", width: 298, suppressFilter: true},
{headerName: "AddedDate", field: "addedDate", width: 298, suppressFilter: true},
{headerName: "Delete Ip", field: "value", cellRendererFramework: RemoveIpComponent, colId: "params", width: 180, suppressFilter: true, suppressSorting: true}
Please note this works whenever the following is input (whenever Delete Ip is not present and I change it to '' - what it is expecting:
it('All headers are present', function(){
element.all(by.css('.ag-header-cell-text'))
.map(function(header){
return header.getText()
}).then(function(headers){
expect(headers).toEqual(['Publisher Name', 'IpAddress', 'AddedDate', '']);
});
});
Looking at how the header for Delete IP is different in the code (as a value for its field) is there any way I can access it by change of syntax in my test instead of ''?
All help is appreciated and thanks!
Kirsty
Aucun commentaire:
Enregistrer un commentaire