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;
});
});
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() === 'shippingcosts') {
deferred.resolve(true);
}
});
return deferred.promise;
}
return getShippingCosts();
}
}
});