1

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();
}
Umesh_IoT
  • 59
  • 1
  • 11

1 Answers1

1

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();
    });
}
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195