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

Add protractor tests to CI for generator #572

Closed
DaftMonk opened this issue Sep 21, 2014 · 11 comments
Closed

Add protractor tests to CI for generator #572

DaftMonk opened this issue Sep 21, 2014 · 11 comments

Comments

@DaftMonk
Copy link
Member

Use saucelabs to allow travis to run through e2e tests on generated projects: https://docs.saucelabs.com/ci-integrations/travis-ci/

We could then add tests that ensure the whole application is working in each build by adding tests for logging in, logging out, registering, creating new items, etc.

@kingcody
Copy link
Member

Awesome I was seriously just looking into this. Several of the recent issues are best exposed through protractor. I've already written a few tests that should do the trick.

@kingcody
Copy link
Member

Side question: @DaftMonk do you have much experience with writing protractor tests? I'd like to get some feedback on the ones I've put together for exposing some recent issues with canary.

@DaftMonk
Copy link
Member Author

Sure, I'll take a look. I've written a fair number of protractor tests

@kingcody
Copy link
Member

One thing in particular, I'm looking for a way to clean and stub the DB for the signup/login tests. Would you suggest simply requiring the user schema and using it in beforeEach and afterEach blocks?

@DaftMonk
Copy link
Member Author

I think that would work fine. It seems like the easiest way to clean the test DB.

@kingcody
Copy link
Member

@DaftMonk I'm having an issue with Model.method(callback) in protractor tests, callback never gets called. Kinda stumped atm, was just wondering if you had any ideas.

Heres my require:

var UserModel = require(serverConfig.root + '/server/api/user/user.model');

and in protractor.conf.js:

...

  // Prepare environment for tests
  onPrepare: function() {
    global.serverConfig = require('./server/config/environment');
  }
};

@kingcody
Copy link
Member

Ok, protractor tests are running in a different process as the server; that didn't occur to me at first.

Adding:

// Setup mongo connection
var mongoose = require('mongoose-bird')();
mongoose.connect(serverConfig.mongo.uri, serverConfig.mongo.options);

to the onPrepare fn got mongoose connecting properly

@kingcody
Copy link
Member

@DaftMonk
Copy link
Member Author

👍 Awesome, looks good. One thing I noticed though, you don't need to do waitForAngular before calling done, protractor will do that for you.

@kingcody
Copy link
Member

Cool deal, I take it you mean here

@DaftMonk
Copy link
Member Author

Yep.

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

No branches or pull requests

2 participants