1

I can run unit and midway tests, however when I want to run e2e tests, nothing happens. There is not tests found as the output of karma suggests:

C:\>karma start
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser IE
INFO [IE 10.0 (Windows)]: Connected on socket id 8lG9jAG8mloBmjFez5V9
IE 10.0 (Windows): Executed 0 of 0 SUCCESS (0.125 secs / 0 secs)

my karma.conf file is as followed:

files = [
 JASMINE,
 JASMINE_ADAPTER,
 'Scripts/libs/jquery/jquery-*.js',
 'Scripts/libs/angular/angular.js',
 'Scripts/libs/angular/angular-mocks.js',
 'Scripts/libs/angular/angular-resource.js',
 'Scripts/libs/angular/angular-scenario.js',
 'Scripts/sinon-1.7.3.js',
 'app/**/index.js', 
 'app/**/*.js',
 'app/*.js',
 'test/unit/**/*.js',
 'test/midway/**/*.js',
 'test/e2e/*.js'
];


reporters = ['progress'];
port = 9876;
runnerPort = 9100;
colors = true;
logLevel = LOG_INFO;
autoWatch = true;
browsers = ['IE'];
captureTimeout = 60000;
singleRun = false;
proxies = {
   '/': 'http://localhost:1506/portal.web'
};

Any idea what's wrong ?

Sam
  • 13,934
  • 26
  • 108
  • 194
  • Have you tried getting your e2e tests working with a test runner like this: https://github.com/angular/angular-seed/blob/master/test/e2e/runner.html – Karen Zilles Jul 02 '13 at 06:46
  • I'm giving up. I can't find a good tutorial on how to setup karma for e2e testing. When I follow the tutorial on angular's website (http://docs.angularjs.org/tutorial/step_03), there are too many assumptions and it's not helpful at all. Browsing to http://localhost:8000/test/e2e/runner.html just fails, although I've specified this port in the proxies parameter of the karma.conf file. I've added the test runner html file as you have told me, with no effects.... – Sam Jul 02 '13 at 08:03
  • The test runner does not use karma. Just bring it up in your browser from the same web server as your application – Karen Zilles Jul 02 '13 at 15:03

5 Answers5

4

I had the same problem - almost gave up - but followed http://blog.diniscruz.com/2013/06/running-karmas-angularjs-example.html - and it works!

gnom1gnom
  • 735
  • 7
  • 15
  • 1
    Thanks for linking to that blog post and I'm happy that it helped you. In case you are still looking at Karma , I've just posted an follow-up post that shows how I created a set of Eclipse Views to help running my tests: http://blog.diniscruz.com/2014/02/creating-eclipse-ui-to-run-angularjs.html – Dinis Cruz Feb 24 '14 at 14:51
3

AngularJS team recommends Protractor for E2E testing and Karma only for unit testing.

Kunal Kapadia
  • 3,223
  • 2
  • 28
  • 36
0

setting up karma for e2e testing

you will also need to comment out JASMINE AND JASMINE_ADAPTER inside files in the karma.conf.js and add frameworks = "jasmine" underneath this. Hope this helps

Ian Richards
  • 1,618
  • 4
  • 17
  • 36
0
    // frameworks to use
                frameworks: ['jasmine']

By adding these lines above in config file worked for me.

According to [https://github.com/ksunair/introtokarma][1]

Lisa Satpathy
  • 23
  • 1
  • 5
0
frameworks: ['jasmine'],

files: [
    //adapter - ignore deprecation warnings karma spits out -- you need this!
    //JASMINE, 
    //JASMINE_ADAPTER,
    ANGULAR_SCENARIO,
    ANGULAR_SCENARIO_ADAPTER,

    //includes
    'client/common/vendor/angular.js',

    //own files
    'client/admin/views/admin.html',

    //tests
    //'test/client/*-unit-spec.js',
    'test/client/*-e2e-spec.js'
]

(for ANGULAR_SCENARIO, you will have done npm install karma-ng-scenario --save-dev)

Jasmine is not E2E, E2E (although it looks much the same) is not Jasmine. You need to include either one or the other, never both.

See this answer for more.

FWIW, my versions:

  • karma: 0.10.8
  • karma-ng-scenario: 0.1.0
  • karma-jasmine: 0.1.5
Community
  • 1
  • 1
Engineer
  • 8,529
  • 7
  • 65
  • 105