You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Would love to see this supported. Currently we are experimenting with using protractor as a library for our mocha tests; thank you, included code example ;)
If there is some high-level conceptual understanding that someone could present that would describe how to accomplish this, I would love to fork this and do it myself. Some guidance as to the right direction to head would be awesome, if anyone has any ideas.
I assume you saw examples/onMocha.js? It requires a bit more setup (if you look into the test file, you'll see that it has to build its own webdriver).
There are a couple things missing for good mocha integration. First, there's an adapter for Jasmine that allows expectations to be called directly on webdriver promises expect(myPromise).toEqual('foo'). This currently won't work for Mocha, so an adapter for one of Mocha's assertion libraries to work with promises would be nice.
The other missing bit would be a way to run it directly from the command line and with a configuration file (so your tests are separate from the configuration), but I'm not sure if that's what you're asking for.
I did; using that example as a sort of base to model after, and so far so good.
I would like to be able to use the Chai assertion library instead of Jasmine; our unit tests are Mocha/Chai, so having one less library for our developers to learn would be fantastic. The additional setup required in the current implementation (including Protractor and wrapping the driver) isn't an issue right now, but having things abstracted out and being able to use Protractor directly would be highly desired.
+1 on this.
I am working on integrating protractor with our project. We use grunt with karma, mocha, chai for our unit/integration (midway) tests already. That is working fine. I want to move away from karma-ng-scenario for e2e and use protractor. The bonus is if we could use mocha+chai through all levels of testing.
I have some time this week to work on this if someone is willing to join me.
Please check it out and see if it works for your project! The big problem is that it does not include an adapter for assertions yet - so you will have to resolve promises manually.
Activity
juliemr commentedon Jul 22, 2013
Hello,
I assume you saw
examples/onMocha.js? It requires a bit more setup (if you look into the test file, you'll see that it has to build its own webdriver).There are a couple things missing for good mocha integration. First, there's an adapter for Jasmine that allows expectations to be called directly on webdriver promises
expect(myPromise).toEqual('foo'). This currently won't work for Mocha, so an adapter for one of Mocha's assertion libraries to work with promises would be nice.The other missing bit would be a way to run it directly from the command line and with a configuration file (so your tests are separate from the configuration), but I'm not sure if that's what you're asking for.
steve-baer commentedon Jul 22, 2013
I did; using that example as a sort of base to model after, and so far so good.
I would like to be able to use the Chai assertion library instead of Jasmine; our unit tests are Mocha/Chai, so having one less library for our developers to learn would be fantastic. The additional setup required in the current implementation (including Protractor and wrapping the driver) isn't an issue right now, but having things abstracted out and being able to use Protractor directly would be highly desired.
kburson commentedon Aug 6, 2013
+1 on this.
I am working on integrating protractor with our project. We use grunt with karma, mocha, chai for our unit/integration (midway) tests already. That is working fine. I want to move away from karma-ng-scenario for e2e and use protractor. The bonus is if we could use mocha+chai through all levels of testing.
I have some time this week to work on this if someone is willing to join me.
jamestalmage commentedon Aug 15, 2013
As for promise adapters. I've done some preliminary work on one:
https://github.com/promise-testing/promise-testing
It has chai+mocha support built in.
I have been dogfooding it for a few months, and it works.
rweng commentedon Oct 28, 2013
nice, +1
juliemr commentedon Dec 27, 2013
Some early work done in 478c00a
Please check it out and see if it works for your project! The big problem is that it does not include an adapter for assertions yet - so you will have to resolve promises manually.
juliemr commentedon Dec 28, 2013
After a little more research, got mocha working using Chai As Promised for assertions. Check out https://github.com/angular/protractor/blob/master/docs/using-mocha.md for info on how-to.
Closing this issue - but please, give it a shot and open others if you find problems!
jamestalmage commentedon Dec 28, 2013
Doh!
jamestalmage@83f1469
demisx commentedon Sep 7, 2014
The updated URL for using the awesome Mocha/Chai framework with protractor appears to be https://github.com/angular/protractor/blob/master/docs/frameworks.md#using-mocha