如何在Protractor E2E测试中单击下一步按钮

时间:2016-09-12 12:23:01

标签: angularjs protractor e2e-testing

我有一个AngularJs应用程序,我正在寻找一个问题来点击我页面上的下一步按钮。这是按钮的AngularJs代码:

<button class="btn btn-primary btn-lg single-line next-step next-step ng-   
 scope" button-submit="" ng-click="sign(); $showNextPanel()" type="submit" 
 ng-if="currentFormality.hasTouchScreen === false || 
 currentFormality.signatureType === SignatureType.PAPER" step-panel-next="">
 <span ng-transclude="">

<i class="icon icon-azf-arrow-down pull-right ng-scope"></i>
                            <span class="pull-right ng-binding ng-scope">
                                Passer à l'étape suivante
                            </span>
                        </span></button>`

我尝试了以下代码:

我的功能:

export function nextStep(): webdriver.promise.Promise<any> {
let btnNextStep = element.all(by.css('.btn.next-step'));
return waitElementIsDisplayed(by.css('.btn.next-step'))
    .then(() => (
        btnNextStep.click()
    ))
    .then(() => {
        return Promise<boolean>((deferred) => {
            setTimeout(() => {
                deferred.fulfill(true);
            }, 1500);
        })
    });
}

我的代码点击按钮:

        it('should go to next step', () => {
                promise
                    .then(() => (
                        nextStep()                          
                    ));
            });

但它不起作用:(

你能帮帮我吗?

0 个答案:

没有答案