0
votes

I'm confronted with a strange error when executing my E2E tests. A broadcasted event is not consumed by one of my directives anymore and therefore a particular view is not rendered correctly.

This does not occur only when I run the test alone. And, this does not occur either when I run the test for the first time (singleRun=true) or the first run in debug mode.

The implemented event logic itself works fine.

What can cause this strange behavior?

My set up:

  • Karma version: 0.10.10
  • Angular version: 1.3.0

My Karma Config:

module.exports = function(config) {
config.set({

    basePath: '',

    files: [
        'test/e2e/*.js'
    ],

    singleRun: true,

    frameworks: ['ng-scenario', 'jasmine-jquery', 'jasmine'],

    browsers: ['Chrome'],

    plugins: [
        'karma-chrome-launcher',
        'karma-jasmine-jquery',
        'karma-jasmine',
        'karma-junit-reporter',
        'karma-ng-scenario'
    ],

    junitReporter: {
        outputFile: 'test-result.xml'
    },
    urlRoot: '/_karma_/',
    proxies: {
        '/': 'http://localhost:' + (process.env.PORT ? process.env.PORT : '8080') + "/"
    },
});
};

Any hints are very much appreciated!

Thanks, Sebastian

1
If you have problems with your tests, it is more likely to do with your tests rather than your config. Why not using protractor for e2e btw?Thomas Roch
Mmh, I read through a tutorial which pointed that out. But since protactor is referenced in the official documentation I will try that out. Thanks for the remark!Sebastian Woinar

1 Answers

0
votes

As Thomas pointed out: Protractor is more appropriate for angular acceptance/E2E tests (https://docs.angularjs.org/guide/e2e-testing).

When using Protractor as test runner, the issue does not occur (at least not, when executing it only once [which was working fine with karma as well g]).

Thanks anyhow.