Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expect(<primitive>).toEqual(<promise>) no longer works #47

Open
juliemr opened this issue Jun 1, 2016 · 2 comments
Open

expect(<primitive>).toEqual(<promise>) no longer works #47

juliemr opened this issue Jun 1, 2016 · 2 comments

Comments

@juliemr
Copy link
Member

juliemr commented Jun 1, 2016

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
Copy link

modiho commented Jan 17, 2017

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
Copy link

modiho commented Jun 28, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants