2013-11-22 3 views
0

AngularJS를 처음 사용했습니다. 각도기로 엔드 투 엔드 테스트를 실행하려고합니다. 현재, 나는 grunt-protractor-runner의 도움을 받아 무언가를 테스트하고 있습니다. 내 기본 테스트는 다음과 같습니다.각도기 테스트 러너로 앱을로드 할 수 없습니다.

describe('My Tests', function() { 
    var p = protractor.getInstance(); 

    beforeEach(function() { 
    }); 

    it('My First Test', function() { 
     var message = "Hello!"; 
     expect(message).toEqual('Hello!'); 
    }); 
}); 

잘 작동합니다. 그러나, 그것은 정말 내 애플 리케이션을 테스트하지 않습니다. 그렇게하기 위해 항상 앱의 루트에서 시작하고 싶습니다. 이렇게하기 위해 위의 내용을 다음과 같이 업데이트했습니다.

describe('My Tests', function() { 
    var p = protractor.getInstance(); 

    beforeEach(function() { 
     p.get('#/'); 
    }); 

    it('My First Test', function() { 
     var message = "Hello!"; 
     expect(message).toEqual('Hello!'); 
    }); 
}); 

이 테스트를 실행하면 Chrome이 실행됩니다. 그러나 "about : blank"는 검색 주소창에로드됩니다. 내 앱이 절대로드되지 않습니다. protractor.config.js 파일을 검토 한 결과 올바른 것으로 보입니다. 다음과 같이 보입니다 :

exports.config = { 
    allScriptsTimeout: 110000, 

    seleniumServerJar: './node_modules/protractor/bin/selenium/selenium-server-standalone-2.37.0.jar', 
    seleniumPort: 1234, 
    seleniumArgs: [], 
    seleniumAddress: null, 

    chromeDriver: './node_modules/protractor/bin/selenium/chromedriver.exe', 
    capabilities: { 'browserName': 'chrome' }, 

    specs: [ '../tests/**/*.spec.js' ], 

    jasmineNodeOpts: { 
     showColors: true, 
     defaultTimeoutInterval: 30000 
    } 
}; 

각도기를 통한 통합 테스트를 위해 Chrome에 내 앱을로드하려면 어떻게해야합니까?

// A base URL for your application under test. Calls to protractor.get() 
// with relative paths will be prepended with this. 
baseUrl: 'http://localhost:3000' 

이 protractor.config이 속성을 추가

답변