断言错误:预期 false 等于 true

问题描述 投票:0回答:1

这是代码:

this.Then(/^I click to the next button on the edit page$/,function(callback) {
    targetPO.getEditNextButton().isPresent().then(function(){
        targetPO.getEditNextButton().click().then(callback);
    });
})

我得到了:

断言错误:预期 false 等于 true

错误。我找不到任何有用的教程,只有圣故事。

错误原因是什么?

这是 getEditNextButton() 函数:

function getEditNextButton() {
    return element(by.id(selectors.editNextButton));
}
angularjs protractor cucumber e2e-testing cucumberjs
1个回答
0
投票

看起来您调用该函数的方式有问题。可以通过两种方式解决:
1) 从 function getEditNextButton() 中,您可以在 return element(by.id(selectors.editNextButton)); 中删除 'element';

或者

2) 因为,通过调用 getEditNextButton() 函数,您将返回 'element(by.id(...)' 。
因此,您应该从 'element.getEditNextButton().click 中删除 element. ().then(回调);'

© www.soinside.com 2019 - 2024. All rights reserved.