Hi,
I have a protractor test in which I would like to check the count of select boxes.
The problem is that I don't want to resolve the promise manually like below (see (2) ).
I am using mocha, chai by the way.
Could you please help me?
// Page Object
var ProductDetailPO = function () {
// ...
};
ProductDetailPO.prototype = Object.create({}, {
selectBoxesNumber: {
get: function () {
return element.all(by.css('.dropdownSelect')).count();
}
}
});
module.exports = ProductDetailPO;
// productDetail.spec.js
var po = new ProductDetailPO();
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
// Doesn't work like that (1)
it('only one select should be enabled "',
function () {
expect(po.selectBoxesCount).to.be.above(5);
});
// The following would work: (2)
po.selectBoxesCount.then(function (number) {
expect(number).to.equal(5);
});