Closed Bug 833007 Opened 11 years ago Closed 11 years ago

Gaia UI tests fail against desktop Firefox OS builds due to tap interaction

Categories

(Remote Protocol :: Marionette, defect)

All
Gonk (Firefox OS)
defect
Not set
major

Tracking

(firefox21 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 fixed)

RESOLVED FIXED
mozilla21
Tracking Status
firefox21 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- fixed

People

(Reporter: davehunt, Assigned: davehunt)

Details

Attachments

(1 file, 1 obsolete file)

When running the Gaia UI tests against a desktop build many tests are failing when calling the marionette.tap method.

Here is an example traceback:

Traceback (most recent call last):
  File "/Users/dhunt/workspace/gaia-ui-tests/gaiatest/tests/contacts/test_add_new_contact.py", line 47, in test_add_new_contact
    self.marionette.tap(add_new_contact)
  File "/Users/dhunt/workspace/mozilla-central/testing/marionette/client/marionette/marionette_touch.py", line 24, in tap
    self.execute_script("%s.tap(arguments[0], null, null, null, null, arguments[1]);" % self.library_name, [element, send_all])
  File "/Users/dhunt/workspace/mozilla-central/testing/marionette/client/marionette/marionette.py", line 483, in execute_script
    specialPowers=special_powers)
  File "/Users/dhunt/workspace/mozilla-central/testing/marionette/client/marionette/marionette.py", line 243, in _send_message
    self._handle_error(response)
  File "/Users/dhunt/workspace/mozilla-central/testing/marionette/client/marionette/marionette.py", line 278, in _handle_error
    raise JavascriptException(message=message, status=status, stacktrace=stacktrace)
JavascriptException: TypeError: doc.createTouch is not a function
stacktrace:
	touch@chrome://marionette/content/marionette-listener.js:564
	tap@chrome://marionette/content/marionette-listener.js:717
	__marionetteFunc@chrome://marionette/content/marionette-listener.js:1860
TEST-UNEXPECTED-FAIL | test_add_new_contact.py TestContacts.test_add_new_contact | 	@chrome://marionette/content/marionette-listener.js:1860
Interesting, this means that the b2g desktop device is not recognised as a touch environment, so all the methods we use in the background to generate touch events on the page, like createTouch (https://developer.mozilla.org/en-US/docs/DOM/DocumentTouch.createTouch), are not available.

This breaks the standard "we should always send and expect touch event" model we've adopted. Bah.

I can suggest a work around in the marionette framework side. We can check if the document has these touch methods, and if so, send touch events. If not, we should send mouse events. We have similar logic with the tap() command. It will enable the test writers to write tests without having to care which environment they will run it.

Considering how the b2g desktop environment doesn't have touch events enabled, I don't think it will be useful for tests that will require pinch/zoom calls in the future, or any other multi-touch actions. This also seems like it will come with its own set of bugs, unique to it and not other environments that are touch enabled like emulator and device.
(In reply to Malini Das [:mdas] from comment #1)
> I can suggest a work around in the marionette framework side. We can check
> if the document has these touch methods, and if so, send touch events. If
> not, we should send mouse events. We have similar logic with the tap()
> command. It will enable the test writers to write tests without having to
> care which environment they will run it.
> 
> Considering how the b2g desktop environment doesn't have touch events
> enabled, I don't think it will be useful for tests that will require
> pinch/zoom calls in the future, or any other multi-touch actions. This also
> seems like it will come with its own set of bugs, unique to it and not other
> environments that are touch enabled like emulator and device.

This sounds reasonable enough to me. I would suggest a multi-touch manifest attribute to filter out such tests when running against desktop builds.
Attached patch Working patch for tap (obsolete) — Splinter Review
The attached patch allows the tap to send the appropriate events for desktop builds. I'm unsure why the sendClick was previously false, so requesting feedback.
Attachment #707037 - Flags: feedback?(mdas)
Comment on attachment 707037 [details] [diff] [review]
Working patch for tap

Review of attachment 707037 [details] [diff] [review]:
-----------------------------------------------------------------

Memory fails me as to why I didn't add sendClick, but I just tested it out with your patch and the existing tests pass. Since that's the case, and this patch makes the desktop b2g tests pass, I see no harm in adding it!
Attachment #707037 - Flags: feedback?(mdas) → feedback+
No changes since feedback was granted, but requesting review before landing.
Assignee: nobody → dave.hunt
Attachment #707037 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #708088 - Flags: review?(mdas)
Attachment #708088 - Flags: review?(mdas) → review+
https://hg.mozilla.org/mozilla-central/rev/0988737f4382
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: