Closed Bug 897543 Opened 11 years ago Closed 9 years ago

Create mutt tests for Touch Events (for Metro)

Categories

(Testing Graveyard :: Mozmill, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: andrei, Unassigned)

Details

Support for touch events has been implemented in bug 880426

EventUtils does not have support for touch expected events (a similar implementation to synthesizeMouseExpectEvent would be welcomed).

Best case scenario would be to have the expect event method implemented in EventUtils
(we use a patched version from http://mxr.mozilla.org/mozilla-central/source/testing/mochitest/tests/SimpleTest/EventUtils.js) and really test that the events we trigger are executed.

Another (more complex and cumbersome) approach would be to test the effects of the required events.

***

Events that need a mutt test are:
- longpress
- touchstart
- touchmove
- touchend


If the EventUtils receive the desired update, we might also update the existing tests (tap, doubleTap, waitThenTap)
Hey,

I'd like to help out with the development of these tests if possible.

-Karan
Karan, that sounds great. I would like to connect you to Andrei, who implemented the touch events support for Mozmill. He will guide you through the process to get started.
Whiteboard: [mentor=andrei_eftimie][lang=js][good first bug]
Hey Andrei,

Would you mind giving me some tips on how to get started with this bug?

Thanks!
Hi Karan,

It is still debatable *how* we should approach this.
For most events we use a synthetic method of checking that they were indeed triggered, but we lack that for touch events.

To still have some coverage we reverted to using UI actions and check their outcome.
For these 4 remaining events this has proven more difficult.

Let me check if there has been an update to EventUtils.js that lets us synthetically test these events. That would be the most safe and easy approach.
(In reply to Andrei Eftimie from comment #4)
> Let me check if there has been an update to EventUtils.js that lets us
> synthetically test these events. That would be the most safe and easy
> approach.

Even if we don't have the expectedEvent parameter for those events, we should go ahead and implement those tests. We should make a comment to revisit later.
New stuff in EventUtils:
- support for contextmenu in sendMouseEvent // might help us in Metro
- synthesizeKey support for DOM_VK_RETURN and DOM_VK_SPACE
- imporvements in synthesizeText
- new synthesizeSelectionSet event

I don't see this as enough reason to update it now.

I would still like to have this properly tested, and, if possible, without explicit UI interactions. To get the same mechanism as for mouse events in would be fairly trivial.
On the long tail, I'll talk to the devs that work on this to see if I can patch it.

Untill then Karan, the only way to really test these events would be to trigger them and test their outcome. Do you have a touch enabled device available? We need to find some UI interactions for these events.

My initial thoughts were:
- for longpress to check that a contextmenu is opened (not sure if we should or should not differentiate between regular firefox and metro firefox for this)
- with the other 3 events touchstart, touchmove, touchend I was thinking to test them with a drag operation
A small update: a longpress will open the context menu in regular (desktop) Firefox and it will make a selection under Metro Firefox
I don't have a touch enabled device currently, but I should have one in the next few weeks. Is there anything I can do until then?
You can still work on this.

Take an example from mutt/mutt/tests/js/metro/testTouchEvents/ 
For longpress you might issue the event on a particular word then check that the word has been selected.

For the others we might need a more elaborate testcase... I am not sure if this will work, we might try to drag an element over another, which might be similar to mutt/mutt/tests/js/testController/testDndContent.js (check the `dragToElement` method from src/mozmill/mozmill/extension/resource/driver/mozelement.js).
I think I need to wait to have a touch device, as of now I can't seem to get longpress() to do anything on my desktop, though the other actions work.

Do you know where I can find more information on the API available to me? I.e the type of actions I can 
call on an element, how I can find certain types of elements on a page, etc.

Thanks,
Make sure to open Firefox in Metro mode.

You don't *need* a touch enabled device, but you'll need Windows 8, have Firefox set up as the default browser then open Firefox from the Metro interface.
Whiteboard: [mentor=andrei_eftimie][lang=js][good first bug] → [mentor=whimboo][lang=js][good first bug]
Mentor: hskupin
Whiteboard: [mentor=whimboo][lang=js][good first bug] → [lang=js][good first bug]
:whimboo is this still valid as we don't support metro
Flags: needinfo?(hskupin)
I would forward this question to Andrei. It might still be that we need those tests for other devices. I believe Metro was just an example.
Flags: needinfo?(hskupin) → needinfo?(andrei.eftimie)
Since we have the functionality we should also have tests for that.
But this should probably be deferred for when we'll need it again.

Most touch event actually delegate work to regular click events ATM (or at least at the time we added support for them in Mozmill). That's why testing most of them was proven difficult as we couldn't 'expect' a native touch event since under the hood a click event would eventually trigger, so to test them we would have to resort to non-synthetical tests (eg. trigger the event in a real world scenario and test UI results, which is non optimal for a unit test).

TL;DR: we still want this, but defer it until we'll actually need & use touch events. These are ATM not used.
Flags: needinfo?(andrei.eftimie)
Mentor: hskupin
Whiteboard: [lang=js][good first bug]
Mozmill will reach its end of life soon. We are currently working on getting all the tests for Firefox ported to Marionette. For status updates please see bug 1080766.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.