Thanks to visit codestin.com
Credit goes to github.com

Skip to content

android and ios treat touchaction coordinates differently (relative vs absolute) #7486

@TikhomirovSergey

Description

@TikhomirovSergey

The problem

The problem is that the swiping on Android still consumes absolute values instead of relative (like iOS).
However the moveTo action consumes relative values on both Android and iOS. So it makes inconvenience on client side.

Also there is some weird behaviour.
When user tries to perform the swiping twise (may be more times) per one TouchAction then it fails with error that says that point is out of screen.

Environment

  • Appium version 1.6.0, 1.6.1 and older:
  • Desktop OS/version used to run Appium: I was trying it on Windows 7/8
  • Node.js version (unless using Appium.app|exe): doesn't matter
  • Mobile platform/version under test: Android
  • Real device or emulator/simulator: Emulator

Details

I think the solution is to make the swiping accept relative coordinate values or to stop support it.

Link to Appium logs

Create a gist which is a paste of your full Appium logs, and link them here. Do not paste your full Appium logs here, as it will make this issue very long and hard to read! If you are reporting a bug, always include Appium logs!

Code To Reproduce Issue [ Good To Have ]

The client code

driver.findElementByAccessibilityId("Views").click();

AndroidElement chronometer = driver.findElementByAccessibilityId("Chronometer");
Point point1 = chronometer.getCenter();
int x1 = point1.getX();
int y1 = point1.getY();

AndroidElement focus = driver.findElementByAccessibilityId("Focus");
Point point2 = focus.getCenter();
int x2 = point2.getX();
int y2 = point2.getY();

TouchAction touchAction = new TouchAction(driver);
touchAction.press(x2, y2).waitAction(2000).moveTo(x1, y1).release()//swipe 1
           .press(x1, y1).waitAction(2000).moveTo(x2, y2).release() //swipe 2, seems it needs for relative values
           .perform();

server logs

However this code works

        driver.findElementByAccessibilityId("Views").click();

        AndroidElement chronometer = driver.findElementByAccessibilityId("Chronometer");
        Point point1 = chronometer.getCenter();
        int x1 = point1.getX();
        int y1 = point1.getY();

        AndroidElement focus = driver.findElementByAccessibilityId("Focus");
        Point point2 = focus.getCenter();
        int x2 = point2.getX();
        int y2 = point2.getY();

        TouchAction touchAction1 = new TouchAction(driver);
        touchAction1.press(x2, y2).waitAction(2000).moveTo(x1, y1).release().perform();

        TouchAction touchAction2 = new TouchAction(driver);
        touchAction2.press(x1, y1).waitAction(2000).moveTo(x2, y2).release()
                .perform();

image

server log

Metadata

Metadata

Labels

Androidrelated to Android-native driver(s)Buga problem that needs fixingP0

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions