이 테스트에서 나는 executeAsync()
을 사용하여 테스트중인 페이지의 일부 이벤트를 잡아 냈습니다. 나는 일어날 사건의 숫자를 알지 못한다. 그리고 그것들이 붙잡 혔을 때마다 나는 .takeScreenshot()
으로 스크린 샷을 찍고 싶다. 현재,이 코드를 사용하고 있습니다 :intern을 사용하여 execute 또는 executeAsync 내에서 스크린 샷을 찍는 방법
return this.parent
.setExecuteAsyncTimeout(5000)
.executeAsync(function(done) {
window.events = function(event){
if(event.message == 'takeScreenshot'){
return done(event);
} else if(event.message == 'endTest'){
return done(event);
}
};
}, [])
.then(function(event){
return this.parent
.takeScreenshot()
.then(function(data) {
//previously defined array to save the screenshots
bufferArray.push(data);
})
.end();
})
이 코드는 작동하지만 문제는 그것이 첫 번째 이벤트를 잡는다 이후 단 하나 개의 스크린 샷을 소요하고 다음 대신 다른 이벤트를 기다리는의 테스트를 완료합니다. 누가 전화를 할 수있는 경우 .takeScreenshot()
.executeAsync()
대신 콜백 완료 (이벤트)를 반환 할 수 말해 줄래?