Jay
Jay

Reputation: 115

Karma E2E Tests found but skipped and marked as fail

Given the e2e config:

module.exports = function(config) {
    config.set({
        basePath: '../',

        files: [
            'E2E/**/*.js'
        ],

        autoWatch: false,

        browsers: ['Chrome'],

        frameworks: ['ng-scenario'],

        singleRun: true,

        proxies: {
            '/': 'http://localhost:8000/'
        },

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

        junitReporter: {
            outputFile: 'test_out/e2e.xml',
            suite: 'e2e'
        },

        urlRoot: '/_karma_/'
    });
};

and the scenario:

'use strict';

/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */

describe('Mailing App', function () {

    it('should filter the phone list as user types into the search box', function () {
        expect(true).toBe(true);
    });

    it('should filter the phone list as user types into the search box', function () {
        expect(Element('foo').count()).toEqual(1);
    });

    describe('Sample Test', function () {

        beforeEach(function () {
            browser().navigateTo('../../Client/Views/Shared/_Layout.cshtml');
        });

        it('should filter the phone list as user types into the search box', function () {
            pause();
            expect(Element('.ng-binding')).toBeDefined();
        });
    });
});

The programs finds the 3 tests but does not pass or fail them, rather skips them. Running the script (with windows 8.1, git bash) returns says:

Karma v0.12.1 server started atHTTP://localhost:9876/karma/"

starting Chrome Connected on Socket Chrome 31.0.1650 Executed 0 of 3

(skipped 3) Error

Any idea why tests that don't even need to traverse the site or look at the DOM etc can be found but can not be run?

Upvotes: 1

Views: 328

Answers (1)

Jay
Jay

Reputation: 115

Ok, not sure if this will help anyone but basically the issue was I didn't realise that angular-scenario.js is not part of the Karma test running suite, it is from before karma when tests were running with testacular.

angular-scenario.js was being included as part of the file includes with the */.js wildcards.

Once I changed it to no longer see that it seems to now be working, guess I would have expect some kind of conflicting functions or stuff not defined to be thrown, if classes were messing each other up.

Upvotes: 1

Related Questions