Pinch action does not work in Browser app



5 years ago
a year ago


(Reporter: njpark, Unassigned)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [affects=webqa])


(6 attachments)



5 years ago
Following code zooms in/out images in Gallery app, but does not work in a Browser page:

    def test_UI_Actions(self):
        gallery = Gallery(self.marionette)

         # Tap first image to open full screen view.
        image = gallery.tap_first_gallery_item()

        action = Actions(self.marionette)
        screen = self.marionette.find_element(*self._current_image_locator)


        pinch = MultiActions(self.marionette)
        current_image_mid_x = screen.size['width'] / 2
        current_image_mid_y = screen.size['height'] / 2

        index_finger = Actions(self.marionette)
        thumb = Actions(self.marionette),current_image_mid_x+10,current_image_mid_y-10).wait(0.15).move_by_offset(current_image_mid_x, -current_image_mid_y).release(),current_image_mid_x-10,current_image_mid_y+10).wait(0.15).move_by_offset(-current_image_mid_x, current_image_mid_y).wait().release()

Also tried a flick-like method, and while it does scroll the browser page, it still does not pinch zoom when combined together in a MultiActions object:

from gaiatest import GaiaTestCase
from marionette.marionette import Actions
from marionette.marionette import MultiActions
import sys,time
from import By
from import Browser

class TestUIActions(GaiaTestCase):

    _browser_frame_locator = (By.CSS_SELECTOR, 'iframe.browser-tab')
    _main_screen_locator = (By.ID, 'main-screen')

    def setUp(self):


    def test_UI_Actions(self):
        browser = Browser(self.marionette)

        screen = self.marionette.find_element(*browser._browser_frame_locator)

        pinch = MultiActions(self.marionette)
        current_image_mid_x = screen.size['width'] / 2
        current_image_mid_y = screen.size['height'] / 2

        index_finger = Actions(self.marionette)
        thumb = Actions(self.marionette)
        x = 0
        while x < 100:
            index_finger.move_by_offset(-5, -5)
            x += 1
        y = 0
        while y < 100:
            thumb.move_by_offset(5, 5)
            y += 1

Comment 1

5 years ago
It looks to me Browser's response to UI action is either slow, or requires something different from other apps.

Badly worded comment above: for the second code above, if I perform the actions individually, it does scroll up and down, but when combined as above, there was no UI action shown.
Whiteboard: [affects=webqa]

Comment 2

4 years ago
mdas actually didn't get around fixing this issue, wondering whether there is any chance this can be fixed?  if so we can automate a lot of use case scenarios.  ni?ing :automatedtester for comments.
Flags: needinfo?(dburns)
Unfortunately the A-Team doesn't have bandwidth for this for some time. I think you would be better asking the FXOS Automation Team if they can do it. I am happy to do reviews.
Flags: needinfo?(dburns) → needinfo?(jlal)
This is unlikely to happen this quarter.... Are there any known workarounds?
Flags: needinfo?(jlal)

Comment 5

4 years ago
CC'ing FXOS automation team
Created attachment 8663574 [details] [diff] [review]

I tried to get the current pinch action to work, which is currently used here:

But I couldn't get it working. I don't think what's in the tree currently, is working either.
Created attachment 8663608 [details]

I tried something like this based on comment 0, but that doesn't work either.
What I noticed with using print( is that MultiActions takes only 0.015s, where it should take at least 1.15s, because of th wait() calls in the Actions().
Attachment #8663608 - Attachment mime type: text/x-python-script → text/plain
The tests that are supposed to test this behavior in Marionette unit tests are disabled because of bug 1060060.
Created attachment 8663686 [details]

This is something that works.
Attachment #8663686 - Attachment mime type: text/x-python-script → text/plain
Created attachment 8663687 [details]

I tried the same in a browser zoom test, but there, it doesn't work for some reason.
Created attachment 8663727 [details]

Using sendNativeTouchPoint like this works. This also works for the gallery app.

Thanks to :kats on irc who explained this to me.
In gaia browser, pinch zooming is handled by apz, in that case you need to use sendNativeTouchPoint. In the gallery app, pinch zooming is handled by the gallery app itself, so that's why sendTouchEvent works there as well:!msg/
Created attachment 8664914 [details]

This was my last attempt that points to a page that shows the various touch events. This is not zooming in the page on pinch zoom.
I noticed that when clientY is negative for the 2nd touch, then the page gets indeed zoomed in suddenly. This is what happened with the previous test that I attached.
Blocks: 1196432
closing as b2g related and new actions work has been done
Last Resolved: a year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.