nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.79k stars 1.31k forks source link

Inconsistent "moveToElement" behaviour on Android 11/Chrome 105/Appium 1.22/NW 1.17.13 after tab switch #3408

Open tootsweet opened 2 years ago

tootsweet commented 2 years ago

Description of the bug/issue

Hello,

I'm running a series of 7 tests using the BDD syntax (one "describe" then seven "it"). The tests all consist in scratching a scratch card. This is done by sending swipe gestures using the "moveToElement" function. Tests 1 (00:00 in the video) and 2 (00:44 in the video) run flawlessly. Test 3 (01:20 in the video) opens a second tab at some point. Before the second tab is opened, the swipe gestures are executed correctly. After the second tab is opened, and we go back to our original tab using the switchWindow function, the gestures are misinterpreted. This happens every time.

Here's a video of the issue: https://youtu.be/1x8HNhSgb-k

Device : Google Pixel 4 emulator with Android 11 Google Chrome version : 105.0.5195.79 Nightwatch version : 1.7.13 Appium version : 1.22.0

Thanks in advance for your help.

Steps to reproduce

it's all in the video

Sample test

it's all in the video

Command to run

it's all in the video

Verbose Output

it's all in the video

Nightwatch Configuration

No response

Nightwatch.js Version

1.7.13

Node Version

17.9.1

Browser

Chrome for Android 105.0.5195.79

Operating System

Android 11

Additional Information

No response

swrdfish commented 1 year ago

Was able to reproduce on web also, using nightwatch v2.3.9

describe('test gesture', ()=> {

  test('should draw line', async function(browser) {
    await browser.url('https://sketch.io/sketchpad/')
      .waitForElementVisible('body > dialog > alertify-dialog > p > div > alert-close-link')
      .click('body > dialog > alertify-dialog > p > div > alert-close-link');

    const element =  await browser.findElements('body > sketchpad > sketchpad-viewport > sketch-doc > sketch-doc-scrollarea');
    browser.moveTo(element[0].getId(), 20, 20)
      .mouseButtonDown(0)
      .moveTo(element[0].getId(), -200, 40)
      .moveTo(element[0].getId(), 200, 60)
      .moveTo(element[0].getId(), -200, 80)
      .moveTo(element[0].getId(), 200, 100)
      .mouseButtonUp()
      .openNewWindow('window', function(result) {
        console.log('window opened');
      });

    browser.windowHandles(function(result) {
      browser.switchWindow(result.value[1]);
      browser.closeWindow();
      browser.switchWindow(result.value[0]);
    });

    browser.moveTo(element[0].getId(), -300, -300)
      .mouseButtonDown()
      .moveTo(element[0].getId(), -400, 40)
      .moveTo(element[0].getId(), 0, 60)
      .moveTo(element[0].getId(), -400, 80)
      .moveTo(element[0].getId(), 0, 100)
      .mouseButtonUp()
      .pause(3000);

    browser.end();
  });
});
gravityvi commented 1 year ago

@swrdfish Is this the case for nightwatch v1.7 or is it reproducible in v2 as well?

swrdfish commented 1 year ago

Yes it is reproducible in v2 as well. And @pujagani tried to reproduce this in selenium with java, but the problem was not reproducible in selenium. It is most probably related to nightwatch or the selenium javascript library.