2015-01-06 8 views
0

내 ExtJS 어플리케이션을 위해 Siesta에 여러 테스트 파일이 있습니다. 다른 사람들이 시작하기 전에 일부 테스트를 실행해야합니다. 이전 테스트가 통과 된 후에 만 ​​테스트를 실행할 수 있습니까?Siesta - 테스트 종속성

답변

1

Siesta에서 테스트를 사용하면 비동기 코드를 실행할 수 있으며 연결 및 대기를 수행 할 수 있습니다. 자세한 내용을 보려면 Get Started Guide을 참조하십시오. 여기에 완전성을 위해 예제가 포함되어 있습니다. 시에스타에서 chain를 사용

t.wait('xhrSample'); 

Ext.Ajax.request({ 
    url  : 'ajax_demo/sample.json', 

    success : function (response, opts) { 
     t.is(response, 'foobar', 'Response is correct'); 

     t.endWait('xhrSample'); 
    }, 

    failure : function (response, opts) { 
     t.fail("request failed"); 

     t.endWait('xhrSample'); 
    } 
}); 

:

wait, 비동기 방법 중 하나를 사용

t.chain(
    function (next) { 
     t.type(userNameField, 'username', next) 
    }, 
    function (next) { 
     t.type(passwordField, 'secret', next) 
    }, 
    function (next) { 
     t.click(loginButton, next) 
    }, 
    function() { 
     // done 
    } 
}); 

을 그리고 사용 지속 WAITFOR :

this.waitFor(
    // The condition to check for, this line will mean waiting until the presence of #foo element 
    function() { return document.getElementById('foo'); }, 

    // The callback, after the condition has been fulfilled 
    function(el) { /* DO COOL STUFF */ }   
); 

다른 질문이있는 경우, 나는 당신이 Sie를 기다리고있는 것에 대해 더 많은 정보를 요구할 것입니다. sta는 끝내려고한다.