Protractor ManagedPromise::2516 {[[PromiseStatus]]: "pending"}

1.2k Views Asked by At

I'm using protractor with Jasmine and I use page object pattern. In one of my page object I'm trying to hover the mouse over a pie chart. But when I use the following method it fails to get value for x coordinate using getDisHoverPoint(). When I put a logger for getDisHoverPoint(), it returns ManagedPromise::2516 {[[PromiseStatus]]: "pending"}. Please help.

this.hoverMouse = function() {
    var dis = element(by
            .css('#piecontainer .highcharts-series>path[fill="#434348"]'));

    function getDisHoverPoint() {
        return dis.getSize().then(function(text) {
            return (text['height'] / 2).toFixed(0);
        });
    }

    browser.actions().mouseMove(dis, {
        x : getDisHoverPoint(),
        y : 0
    }).perform();
}
1

There are 1 best solutions below

1
alecxe On BEST ANSWER

You have to resolve getDisHoverPoint() to get the actual value for x:

this.hoverMouse = function() {
    var dis = element(by
            .css('#piecontainer .highcharts-series>path[fill="#434348"]'));

    function getDisHoverPoint() {
        return dis.getSize().then(function(text) {
            return (text['height'] / 2).toFixed(0);
        });
    }

    getDisHoverPoint().then(function (value) {
        browser.actions().mouseMove(dis, {
            x : value,
            y : 0
        }).perform();
    });
}