Я попытался запустить тесты E2E с Grunt Karma, но не успел. Я смотрю много решений, но никто не работал!AngularJS + Grunt + Karma + E2E
Моя карма-e2e.conf.js:
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '../',
// frameworks to use
frameworks: ['ng-scenario'],
// list of files/patterns to load in the browser
files: [
'test/e2e/**/*.js',
'test/e2e/*.js'
],
// list of files to exclude
exclude: [
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress'],
// web server port
port: 9877,
// enable/disable colors in the output (reporters and 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 and executing tests whenever any file changes
autoWatch: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['PhantomJS'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true,
// Uncomment the following lines if you are using grunt's server to run the tests
proxies: {
'/': 'http://localhost/test/e2e/'
},
// URL root prevent conflicts with the site root
urlRoot: '/_karma_/'
});
};
PS: Мое приложение работает в порту 80 (по умолчанию Apache).
Мой спецификации выглядит следующим образом:
describe('E2E: Testing Routes:', function() {
'use strict';
beforeEach(function() {
browser().navigateTo('/');
});
it('should jump to the /videos path when/is accessed', function() {
browser().navigateTo('#/');
expect(browser().location().path()).toBe("/main");
});
})
Таким образом, когда я запустил эту спецификацию, я получил это сообщение:
«Тип ошибки: не определено не является функцией (оценка $ document.injector()) «
Эта ошибка возникает в строке« ожидать (браузер(). location(). path()). toBe («/ main»);
Любая идея?
Я советую посмотреть на транспортир, новый AngularJS E2E тестов бегуна. Он все еще находится в разработке, но у меня было меньше проблем с ним, чем с кармой и сценаристом. –
посмотреть это сообщение: [http://stackoverflow.com/questions/15644908/getting-browser-path-in-angular-e2e-test-causes-an-exception](http://stackoverflow.com/ Вопросы/15644908/get-browser-path-in-angular-e2e-test-cause-the-exception) –
Я уже видел это решение, но не работает. – vitorvigano