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

Karma/Testacular hangs up when running ngMidwayTester #2

Open
sheniff opened this issue May 29, 2013 · 5 comments
Open

Karma/Testacular hangs up when running ngMidwayTester #2

sheniff opened this issue May 29, 2013 · 5 comments

Comments

@sheniff
Copy link

sheniff commented May 29, 2013

Hi,

I'm trying to run some midway tests in my app using your awesome plugin and mocha, as in the example of your article, but it turns out that when I run

karma start spec/javascripts/config/testacular.midway.conf.js

for this file

describe('Midway: Testing Routes', function () {

  var test;

  before(function (done) {
    ngMidwayTester.register('distill', function(instance) {
      test = instance;
      done();
    });
  });

  it('should have a stacks_path', function () {
    expect(ROUTER.routeDefined('stacks_path')).to.equal(true);
    var url = ROUTER.routePath('stacks_path');
    expect(url).to.equal('/stacks');
  });

  it('should have a stack_path', function () {
    expect(ROUTER.routeDefined('stack_path')).to.equal(true);
    var url = ROUTER.routePath('stack_path');
    expect(url).to.equal('/stacks/:id');
  });

[... (testing 12 routes)]

In a random moment during execution, Karma opens a second socket connection, making it crash and getting this log:

[2013-05-28 23:38:16.405] [WARN] config - "/" is proxied, you should probably change urlRoot to avoid conflicts
INFO [karma]: Karma server started at http://localhost:9202/
INFO [launcher]: Starting browser Chrome
INFO [karma]: To run via this server, use "karma run --runner-port 9302"
INFO [Chrome 27.0 (Mac)]: Connected on socket id SnicZ5NGAmsjIBQ3Ailq
Chrome 27.0 (Mac): Executed 21 of 24
INFO [Chrome 27.0 (Mac)]: Connected on socket id 5Ua9cvKEWU-v5g59Ailr
INFO [karma]: Delaying execution, these browsers are not ready: Chrome 27.0 (Mac)

my midway.conf.js is:

// base path, that will be used to resolve files and exclude
basePath = '../../..';

files = [
  MOCHA,
  MOCHA_ADAPTER,
  'spec/javascripts/config/mocha.conf.js',

  // 3rd Party Code
  'spec/javascripts/lib/jquery.min.js',
  'spec/javascripts/lib/angular.min.js',
  'vendor/assets/javascripts/angular-ui.min.js',
  'app/assets/javascripts/v2/angular-ui-bootstrap.min.js',

  // App-specific code
  'app/assets/javascripts/angular/**/*.js',
  'app/assets/javascripts/angular/**/*.coffee',

  // Test-specific code
  'spec/javascripts/lib/chai.js',
  'spec/javascripts/lib/chai-should.js',
  'spec/javascripts/lib/chai-expect.js',
  'spec/javascripts/lib/angular-resource.js',
  'spec/javascripts/lib/ngMidwayTester.js',

  // Test-Specs
  'spec/javascripts/midway/**/*.js'
];

port = 9202;
runnerPort = 9302;
captureTimeout = 5000;

shared = require(__dirname + "/testacular.shared.conf.js").shared;
growl     = shared.growl;
colors    = shared.colors;
autoWatch = shared.autoWatch;
singleRun = shared.singleRun;
reporters = shared.defaultReporters;
browsers  = shared.defaultBrowsers;
proxies   = shared.defaultProxies;

logLevel  = LOG_INFO;

Any idea? Thanks beforehand, it's driving me crazy...

@matsko
Copy link
Member

matsko commented Jun 13, 2013

I will take a look and get back to you.

@basarat
Copy link

basarat commented Jun 30, 2013

It happens on angular 1.1.4 and 1.1.5.
Older versions 1.1.3 etc continue to work fine.

@matsko
Copy link
Member

matsko commented Jul 1, 2013

It's got something todo with the onChange callbacks that get fired. I think the midway tester needs a bit of a refactoring.

@basarat
Copy link

basarat commented Aug 11, 2013

Have it figured. You need to do scope.apply at the end of your tests starting with angular 1.1.4 due to the way interceptors were implemented. Basically http methods do not make the request automatically anymore and need to be called from an angular run loop.

@matsko
Copy link
Member

matsko commented Oct 20, 2013

Can you guys give it a try with the new version?

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

3 participants