2017-12-29 6 views
1

Protractor과 함께 Jasmine을 사용하여 Angular2 앱용 e2e 테스트 사례를 작성합니다.각도기의 "defaultTimeoutInterval"은 언제 재설정됩니까?

나는 두 가지 질문이 : 나는 카운트 다운 할 때마다 약속의 시작을 시작 있음을 이해하고 DefaultTimeoutInterval

소개

1. 약속은 protractor.conf.js에 지정된 defaultTimeoutInterval 내에 완료되지 않을 경우 각도기를 사용하면 콘솔에 오류가 발생합니다. 그러나 약속이 defaultTimeoutInterval 이내에 완료되면 카운트 다운이 재설정되고 다음 약속이 시작될 때 시작됩니다.

위의 내용이 사실이라면 나는 약속의 사슬을 가지고 있다면 카운트 다운이 언제 재설정되는지 명확히하고 싶다. 체인의 모든 약속이 완료되거나 각 약속이 완료된 후에?

체인의 모든 약속이 완료된 후 카운트 다운이 재설정되면 it()/fit() blocks의 직접 하위로 약속을하는 것이 올바른 방법일까요?

나는 아래의 샘플 코드를 통해 무엇을 묻고 싶습니다.

it("when does protractor's default timeout interval gets reset?",() => { 

expect("a single promise here").toBe('something');  // I believe, after the promise inside the expect block finishes, the defaultTimeoutInterval should Reset. 

// what happens if I have a chain of promises, like below? 
// whether the defaultTimeoutInterval resets after every single promise inside the method `validateSuccessAlert()` and then the chained promises are finsihed? 
// or will it reset on completion of every single promise? 
PO.validateSuccessAlert('a method which has chained promises inside itself, returns a promise').then(() => { 
    browser.waitForAngularEnabled(false).then(() => { 
     PO.getEmailActivationLink('xxxxxx').then((activationCode) => { 
      PO.openNewTab(activationCode).then(() => { 
       PO.switchToTab(1).then(() => { 
        expect(PO.isVisible(element(by.css('.activateMailBox h3 small')))).toBeTruthy(); 
        expect(element(by.css('.activateMailBox h3 small')).getText()).toBe('Congratulations!!'); 
        expect(PO.isNotVisible(PO.getButtonByText('Proceed'))); 
        PO.switchToTab(0); 
        browser.waitForAngularEnabled(true);      // Re-enable the angular wait 
       }) 
      }) 
     }); 
    }); 
}) 

})

2 allScriptsTimeout 소개

내가 정말 이해가 안

는,이에 대한 계산 : 각 파일에 하나의 스펙? 이것에 대해서 조금이라도 설명 할 수 있다면, 좋을 것입니다. 당신이 당신의 it을 초과해서는 안 믿는 일부 기본값으로 http://www.protractortest.org/#/timeouts#timeouts-from-jasmine

설정이 -

답변

2

1) defaultTimeoutInterval 각 it 영원히 또는 매우 긴 테스트 실행을하지 않도록하기위한 자스민에서 제한 시간입니다. 테스트는이 구문을 사용하여 기본 시간 제한보다 훨씬 적은 이상 실행하면 재정의 :

describe('Some feature', function() { 

    it('can be really slow', function() { 

    }, 5 * 60 * 1000) // 5 minutes 

    it('can be really fast', function() { 

    }, 5000) //5 seconds 
}) 

2) allScriptsTimeout는 각도기의 각 비동기 명령에 대한 시간 제한이다, 너무 오래 실행되지 않을 수 있습니다.

http://www.protractortest.org/#/timeouts#timeouts-from-webdriver

나는 보통 각 명령을하지, 그것을 10 초 이상을 설정하지 ((.sendKeys 등), .click() 등) 많은 시간이 걸릴 수 있습니다. 때로는 그리드에서 실행하거나 커다란 .executeScript() 등과 같은 긴 명령을 내릴 때 증가시킬 필요가 있습니다.

+0

감사합니다. 나는 줄 밖의 방법을 생각하고있었습니다! –

관련 문제