expect(<primitive>).toEqual(<promise>) no longer works
juliemr opened this issue · 2 comments
juliemr commented
We should attempt to solve this situation as well, or at least better document failures.
For the record, the following all work:
expect(<primitive>).toEqual(<primitive>)
expect(<promise>).toEqual(<promise>)
expect(<promise>).toEqual(<primitive>)
modiho commented
If anyone stumbles upon this issue and needs a workaround, they may try wrapping every actual
value in a promise.
// protractor-config.js
exports.config = {
onPrepare: () => {
const originalExpect = global.expect
global.expect = (v) => originalExpect(Promise.resolve(v))
}
}
modiho commented
This seems to be fixed. Using protractor@5, the test
expect(1).toEqual(Promise.resolve(2))
correctly results in the error
Expected 1 to equal 2