Giter Site home page Giter Site logo

Comments (9)

juliemr avatar juliemr commented on May 5, 2024

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.

from protractor.

steve-baer avatar steve-baer commented on May 5, 2024

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.

from protractor.

kburson avatar kburson commented on May 5, 2024

+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.

from protractor.

jamestalmage avatar jamestalmage commented on May 5, 2024

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.

from protractor.

rweng avatar rweng commented on May 5, 2024

nice, +1

from protractor.

juliemr avatar juliemr commented on May 5, 2024

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.

from protractor.

juliemr avatar juliemr commented on May 5, 2024

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!

from protractor.

jamestalmage avatar jamestalmage commented on May 5, 2024

Doh!
jamestalmage@83f1469

from protractor.

demisx avatar demisx commented on May 5, 2024

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

from protractor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.