moveToObject not working after buttonDown() #1806

Open
poorpaddy opened this Issue Jan 9, 2017 · 4 comments

Projects

None yet

2 participants

@poorpaddy

The problem

I'm trying to drag the handle on a slider and specifically noUIslider (https://refreshless.com/nouislider/).

I am using the following method to replicate a drag.

browser.waitForExist("selector");
browser.moveToObject("selector", 0, 0);
browser.buttonDown();
browser.moveToObject("selector", 300, 0);
browser.buttonUp();

I would believe it would slide, even returned the element coordinates in the console and they do not change. I've attempted this in both Chrome and Firefox.

Environment

  • WebdriverIO version: 3.0.1
  • Node.js version: 6.9.1
  • Standalone mode or wdio testrunner: WDIO Testrunner
  • if wdio testrunner, running synchronous or asynchronous tests: asynchronous
  • Additional wdio packages used (if applicable): karma-mocha, karma-chai

Code To Reproduce Issue [ Good To Have ]

it("the user interacts with the slider, the values change",function(){
        browser.refresh();
        if (browser.waitForExist('.noUi-handle')){
            console.log('it exists');
        }
        var oldValue = browser.getText("#seCalcSectionValueExpenses");

        if (browser.moveToObject('.noUi-handle')){
            console.log('handle found');
            var originalLocation = browser.getLocation('.noUi-handle');
            console.log(originalLocation);
        }
        if (browser.buttonDown()){
            console.log('pressing down on slider handle');
        }
        if (browser.moveToObject(".noUi-handle", 200, 0)){
            console.log('moving handle over 200px');
            var newLocation = browser.getLocation('.noUi-handle');
            console.log(newLocation);
        }
        if (browser.buttonUp()){
            console.log('releasing slider handle');
        }
        var newValue = browser.getText("#seCalcSectionValueExpenses");
        assert.notEqual(oldValue, newValue);
    });
@patthiel
Contributor

Can't speak for Chrome, but these commands won't work in geckodriver per mozilla/geckodriver#159

@poorpaddy

@patthiel That's correct. They won't work in either Firefox or Chrome. Well technically they pass in both browsers but the 2nd moveToObject doesn't actually offset by the x/y coordinates. It just says they passed however I've done both a pause so I can see it and as you ca see above I log the coordinates and it doesn't move.

@patthiel
Contributor

@poorpaddy This isn't expected to work in Firefox per the ticket I linked as well as #1653. This issue is only applicable to Chrome.

Can you provide a reproduceable spec or project? I have a sandbox project here that you could fork and use: https://github.com/patthiel/wdio-test-playground

@poorpaddy

I do but unfortunately my work utilizes a self hosted enterprise version of GH additionally I can't publicly post the project because the feature I'm developing is unreleased as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment