백엔드없는 e2e 테스트를하고 싶습니다. 따라서 mocks API 호출이 필요합니다. 여기 내가 무슨 짓을 :
angular.module('foo.bar.e2eConf', ['foo.bar', 'ngMockE2E']).
run(function($httpBackend) {
$httpBackend.whenGET('/foo/bar').respond({foo:'bar'});
});
가 그럼 난 구성 내이 같은
conf/karma.e2e.conf
(Pathes를 확인하다) :
var basePath = '../';
var files = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
// bower libs
'components/angular/index.js',
'components/jquery/jquery.js',
'components/angular-resource/index.js',
'components/angular-mocks/index.js',
'components/chai/chai.js',
'test/chai.conf.js',
'src/app/**/*.js',
{pattern:'src/app/**/partials/*.tpl.html', included:false},
'test/e2e/**/*.js'
];
var singleRun = false;
var browsers = ['Chrome'];
var proxies = {'/': 'http://localhost:8000/'};
내가 실행할 때 내가 API 호출을 포함하지 않는 테스트를 실행할 수 있지만, 그것을 포함하는 시험 나는 좋은 것을 얻는다 Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9876/foo/bar
나는 약간의 재료를 잘못 구성했다고 생각하지만, 나는 무엇을 알아낼 수 없다?
프록시와 모의가 충돌합니까? 즉 모의를 사용하는 대신 /foo/bar
~ http://localhost:8000/foo/bar
을 프록시로 사용 하시겠습니까?
아이디어가 있으십니까?
감사
자이 버
안녕하세요, 감사합니다. 'angular.module ('foo.bar ', ['ngMockE2E ']). run (...)'으로 변경하고 index.html에 포함 시키면됩니다. (플러스 필수 deps) –
귀하의 의견과 함께, 그 물건을 이해해 주셔서 감사합니다 나는 ngMockE2E :: $ httpBackend와 함께 최소한의 e2e 테스트를했습니다 : https://github.com/xseignard/e2eMock 나는 조건부로 html로 테스트 스크립트, 어떻게 그것을 달성하기 위해 어떤 아이디어? 또는 angular.bootstrap이있는 더 깨끗한 방법입니까? 참조 : https://github.com/xseignard/e2eMock/blob/master/src/index.html#L18 –
조건부 가져 오기에 사용할 계획입니다. http://stackoverflow.com/questions/12401998/have-grunt-generate-index-html-for-different-setups/14970339 # 14970339 –