I think I found the solution myself. If a promise is used the eventually keyword has to be used:
// this code is working expect(po.selectBoxes.count()).to.eventually.equal(4); see link here: http://chaijs.com/plugins/chai-as-promised Am Mittwoch, 11. November 2015 18:16:44 UTC+1 schrieb Jens Hoffmann: > > Hi, > > I have a protractor test in which I would like to check the count of > select boxes. > I am using chai as promised: (see also link here: > https://angular.github.io/protractor/#/frameworks) > > 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); > }); > > greetings > jens > > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.