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

Can I use Jest framework to assert? #3889

Closed
Shyam-Chen opened this issue Dec 29, 2016 · 5 comments
Closed

Can I use Jest framework to assert? #3889

Shyam-Chen opened this issue Dec 29, 2016 · 5 comments

Comments

@Shyam-Chen
Copy link
Contributor

Shyam-Chen commented Dec 29, 2016

Jest seems like Jasmine.

Jest support for testing with promises and async/await.

[...]
  beforeEach(async () => {
    await browser.driver.get('http://localhost:9876/en/home');
  });

  it('should be able to get the text', () => {
    let el = webdriver.findElement(by.css('h2.mdl-color-text--blue-900'));
    expect(el.getText()).toEqual('Home');
  });
[...]
@juliemr
Copy link
Member

juliemr commented Dec 29, 2016

We have not experimented with using Jest yet, and we don't have built-in support for it. However, you can write and use a custom adapter a framework following the instructions in the README at https://github.com/angular/protractor/tree/master/lib/frameworks

@NickTomlin
Copy link
Contributor

I'm going to go ahead and close this since there hasn't been much activity on it. I think we'd accept a pull request if folks want to add a framework adapter for Jest.

@winnemucca
Copy link

Was this ever added?

@marcus-sa
Copy link

So.... what's the update on this?

@andredesousa
Copy link

Hi, it´s possible because Jest exports your assertion library. For more details:

https://jestjs.io/docs/en/expect

So, we can configure it in the onPrepare function:

onPrepare() {
  global.expect = require('expect');
},

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

6 participants