gruntjs - AngularJS + Grunt + Karma + E2E -
i tried run e2e tests grunt karma, no success. i've many solutions, no 1 worked!
my karma-e2e.conf.js:
module.exports = function(config) { config.set({ // base path, used resolve files , exclude basepath: '../', // frameworks use frameworks: ['ng-scenario'], // list of files / patterns load in browser files: [ 'test/e2e/**/*.js', 'test/e2e/*.js' ], // list of files exclude exclude: [ ], // test results reporter use // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' reporters: ['progress'], // web server port port: 9877, // enable / disable colors in output (reporters , logs) colors: true, // level of logging // possible values: config.log_disable || config.log_error || config.log_warn || config.log_info || config.log_debug loglevel: config.log_info, // enable / disable watching file , executing tests whenever file changes autowatch: true, // start these browsers, available: // - chrome // - chromecanary // - firefox // - opera // - safari (only mac) // - phantomjs // - ie (only windows) browsers: ['phantomjs'], // if browser not capture in given timeout [ms], kill capturetimeout: 60000, // continuous integration mode // if true, capture browsers, run tests , exit singlerun: true, // uncomment following lines if using grunt's server run tests proxies: { '/': 'http://localhost/test/e2e/' }, // url root prevent conflicts site root urlroot: '/_karma_/' });
};
ps: app run @ port 80 (apache default).
my spec follows:
describe('e2e: testing routes:', function () { 'use strict'; beforeeach(function() { browser().navigateto('/'); }); it('should jump /videos path when / accessed', function() { browser().navigateto('#/'); expect(browser().location().path()).tobe("/main"); });
})
so, when ran spec, got message:
"type error: undefined not function (evaluating $document.injector())"
this error occurs @ line "expect(browser().location().path()).tobe("/main");"
any idea?
make sure running web server karma. try changing proxy settings this:
proxies: { '/': 'http://localhost:8000/' },
Comments
Post a Comment