It would be helpful to be able to do as chaijs says in their doc: return doSomethingAsync().should.eventually.equal("foo");
This would speed up writing my e2e tests as I wouldn't have to explicitly resolve the promises like this:
// I wouldn't have to resolve this promise like this as it's very verbose and slows down
// my development
return somePromise.then(function(resolvedPromise){
expect(resolvedPromise).to.equal(expectedResult);
});
It would be nice to use chai; chai.expect; chai.should(); chai-as-promise to resolve those promises and assert on them very quickly; however, nothing I have tried worked so far; a search on SO seems to suggest that Chai uses different promise types than Protractor does and that incompatibility in promise type might be resulting in
TypeError: Cannot read property 'should' of undefined"
This is how I import these libs:
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
var should = require('chai').should();
var assert = chai.assert;
Has anyone been successful at using return doSomethingAsync().should.eventually.equal("foo");
without using other libraies like 'Q'
? Again I don't want to rely on other libs like 'Q'
; I just want to use pure chaijs in my protractor e2e if it's possible; NOT the expect() but the .should.eventually.....
Thanks