app/scripts の下に定義されたかなり最小限のアプリ (1 つのコントローラー、3 つのディレクティブ) があります。
でカルマを実行しkarma start
、localhost:9100 に移動すると、単体テストが実行されます。ただし、で実行するとkarma start karma-2e2.conf.js
、次のエラーが発生します。
[31mChrome 27.0 (Mac) I haz all the things I haz grid FAILED[39m
TypeError: Cannot read property 'name' of undefined
Chrome 27.0 (Mac): Executed 1 of 1[31m (1 FAILED)[39m
私のテストは test/e2e/spec/*.js の下にあります
私の karma-e2e.conf.js は次のようになります。
basePath = '';
files = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'app/components/jquery/jquery.js',
'app/components/angular/angular.js',
'test/e2e/**/*.js'
];
proxies = {
'/' : 'http://localhost:9000'
}
exclude = [];
reporters = ['progress'];
port = 8080;
runnerPort = 9100;
colors = true;
logLevel = LOG_INFO;
autoWatch = false;
browsers = ['Chrome'];
captureTimeout = 5000;
singleRun = false;
私のテストは次のとおりです。
describe('I haz all the things', function(){
beforeEach(function(){
browser().navigateTo('/');
});
it('I haz grid', function(){
expect(angular.element('div.grid-item').count).toEqual(1);
});
});
なぜ失敗し、どうすれば修正できますか?