Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pointerUp doesn't work in iOS devices #924

Open
alvarolaserna opened this issue Jul 28, 2024 · 7 comments
Open

pointerUp doesn't work in iOS devices #924

alvarolaserna opened this issue Jul 28, 2024 · 7 comments

Comments

@alvarolaserna
Copy link

I've been trying to create a test that has multiple swipes (to scroll down) within the same BuiltAction, but it seems that pointerUp doesnt do anything at all:

        actions = ActionBuilder(
            testui_driver,
            mouse=PointerInput(interaction.POINTER_TOUCH, "touch"),
            duration=100
        )
        actions.pointer_action.move_to_location(x=300, y=500)
        actions.pointer_action.pointer_down()
        actions.pointer_action.move_to_location(x=300, y=400)
        actions.pointer_action.pointer_up()
        actions.pointer_action.move_to_location(x=300, y=500)
        actions.pointer_action.pointer_down()
        actions.pointer_action.move_to_location(x=300, y=400)
        actions.perform()

This action slides up and down without the releasing the pointer as started in the pointerUp. Also here the logs from appium:

[ba36ed17][XCUITestDriver@6240] Proxying [POST /actions] to [POST http://127.0.0.1:8100/session/A3DC7E9A-FDEC-494F-B501-8A4AD18BE45D/actions] with body: {"actions":[{"type":"pointer","parameters":{"pointerType":"touch"},"id":"touch","actions":[{"type":"pointerMove","duration":100,"x":300,"y":500,"origin":"viewport"},{"type":"pointerDown","duration":0,"button":0},{"type":"pointerMove","duration":100,"x":300,"y":400,"origin":"viewport"},{"type":"pointerUp","duration":0,"button":0},{"type":"pointerMove","duration":100,"x":300,"y":500,"origin":"viewport"},{"type":"pointerDown","duration":0,"button":0},{"type":"pointerMove","duration":100,"x":300,"y":400,"origin":"viewport"}]}]}
[ba36ed17][XCUITestDriver@6240] Got response with status 200: {"value":null,"sessionId":"A3DC7E9A-FDEC-494F-B501-8A4AD18BE45D"}
@alvarolaserna
Copy link
Author

The main purpose of this is to do faster scrolls, and after further investigations I have found a quick fix/hack

for /WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.m comment line 66:

//  [self fb_waitUntilStableWithTimeout:FBConfiguration.animationCoolOffTimeout];

This will at least make the next perform() not wait for the scroll down to finish the animation, and will perform the next action right away, improving the speed for scrolling/swiping consecutively.

Not sure if this is desirable, but it would be nice to have it as a property that can be changed from Appium side, something like waitUntilStableAnimation: False/True.

This modification DOESNT fix the main issue described above, but it at least solves the problem that lead me to create the ticket in the first place.

This is my first time looking deep into the code, so there might be other options that are more reasonable. So Im open to suggestions. Thanks!

@mykola-mokhnach
Copy link

The animation timeout could be set to zero via setitngs.

Regarding the actions above - make sure there are appropriate pauses between actions. No real gesture happens instantly, there will be always some pauses between actions.

You may also want to check https://github.com/appium/appium-xcuitest-driver/blob/master/docs/guides/gestures.md

@alvarolaserna
Copy link
Author

The animation timeout could be set to zero via setitngs.

Regarding the actions above - make sure there are appropriate pauses between actions. No real gesture happens instantly, there will be always some pauses between actions.

You may also want to check https://github.com/appium/appium-xcuitest-driver/blob/master/docs/guides/gestures.md

Thanks! yes that worked too, but Im still concern about not being able to liftUp the pointer, do you have any idea about that?

@mykola-mokhnach
Copy link

Im still concern about not being able to liftUp the pointer, do you have any idea about that?

I'm afraid the XCTest API does not support such scenario.

@alvarolaserna
Copy link
Author

Im still concern about not being able to liftUp the pointer, do you have any idea about that?

I'm afraid the XCTest API does not support such scenario.

It looks like it, but it is pretty strange that they have this pointer event in their API:

- (void)liftUpAtOffset:(double)arg1;

but if it doesnt work, or at least it doesnt work on the implementation of WebDriverAgent, I feel like a warn event, or some documentation within driver in regards to this would be helpful.

@mykola-mokhnach
Copy link

Unfortunately the API itself is a private one, it contains zero official documentation. Maybe there is still something that we don't know about...

Nevertheless, feel free to improve existing documents and/or add important details you may find out while experimenting with it.

@alvarolaserna
Copy link
Author

Unfortunately the API itself is a private one, it contains zero official documentation. Maybe there is still something that we don't know about...

Nevertheless, feel free to improve existing documents and/or add important details you may find out while experimenting with it.

Yeah, I have also tried to navigate it and it's very bad... really appreaciate your efforts and answers. I will keep looking into it and if I can help I will keep this updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants