赛普拉斯中的嵌套回调函数

时间:2020-05-20 13:28:45

标签: jquery automated-tests cypress nested-function

我如何在cypress中编写以下量角器代码作为类的方法

 this.openIf = function (element, ctrl) {
        return element.isDisplayed()
            .then(
                function clickCtrlUnlessElementVisible(visible) {
                if (!visible) {
                    return ctrl.click();
                }
                return;
            })
            .then(
                function waitForElementToBeDisplayed() {
                return browser.wait(
                    function() {
                    return element.isDisplayed();
                })
            }).then(function checkElement() {
                expect(element.isDisplayed()).toBeTruthy();
            })
  };

0 个答案:

没有答案