author | Malini Das <mdas@mozilla.com> |
Wed, 01 May 2013 11:41:57 -0400 | |
changeset 141420 | 9c106165889d8a965e79df9b8d077bc35c4db1b8 |
parent 141419 | 343120d265be014cc947b906b73b22730f5dd6ab |
child 141421 | 90b8801cd9a942df577872af64ca0725ade2e250 |
push id | 2579 |
push user | akeybl@mozilla.com |
push date | Mon, 24 Jun 2013 18:52:47 +0000 |
treeherder | mozilla-beta@b69b7de8a05a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dburns |
bugs | 867573 |
milestone | 23.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/testing/marionette/client/marionette/marionette_touch.py +++ b/testing/marionette/client/marionette/marionette_touch.py @@ -1,16 +1,16 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os from errors import ElementNotVisibleException from marionette import Actions -from gestures import pinch +import gestures """ Adds touch support in Marionette """ class MarionetteTouchMixin(object): """ Set up the touch layer. Can specify another library with a path and the name of the library. """ @@ -31,14 +31,14 @@ class MarionetteTouchMixin(object): self.execute_script("%s.tap(arguments[0], null, null, null, null, arguments[1]);" % self.library_name, [element, send_all]) def double_tap(self, element): self.check_element(element) self.execute_script("%s.dbltap(arguments[0]);" % self.library_name, [element]) def flick(self, element, x1, y1, x2, y2, duration=200): self.check_element(element) - action = Actions(self.marionette) + action = Actions(self) action.flick(element, x1, y1, x2, y2, duration).perform() def pinch(self, element, x1, y1, x2, y2, x3, y3, x4, y4, duration = 200): self.check_element(element) - pinch(element, x1, y1, x2, y2, x3, y3, x4, y4, duration) + gestures.pinch(self, element, x1, y1, x2, y2, x3, y3, x4, y4, duration)
new file mode 100644 --- /dev/null +++ b/testing/marionette/client/marionette/tests/unit/test_marionette_touch.py @@ -0,0 +1,40 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import time +from marionette_test import MarionetteTestCase +from marionette import Marionette +from marionette_touch import MarionetteTouchMixin + +class TestTouchMixin(MarionetteTestCase): + + def setUp(self): + super(TestTouchMixin, self).setUp() + self.marionette.__class__ = type('Marionette', (Marionette, MarionetteTouchMixin), {}) + self.marionette.setup_touch() + + def test_tap(self): + testTouch = self.marionette.absolute_url("testAction.html") + self.marionette.navigate(testTouch) + button = self.marionette.find_element("id", "mozLinkCopy") + self.marionette.tap(button) + time.sleep(10) + self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkCopy').innerHTML;")) + + def test_dbtap(self): + testTouch = self.marionette.absolute_url("testAction.html") + self.marionette.navigate(testTouch) + button = self.marionette.find_element("id", "mozMouse") + self.marionette.double_tap(button) + time.sleep(10) + self.assertEqual("TouchEnd2", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;")) + + def test_flick(self): + testTouch = self.marionette.absolute_url("testAction.html") + self.marionette.navigate(testTouch) + button = self.marionette.find_element("id", "mozLinkScrollStart") + self.marionette.flick(button, 0, 0, 0, -250) + time.sleep(15) + self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkScroll').innerHTML;")) + self.assertEqual("Start", self.marionette.execute_script("return document.getElementById('mozLinkScrollStart').innerHTML;"))
--- a/testing/marionette/client/marionette/tests/unit/unit-tests.ini +++ b/testing/marionette/client/marionette/tests/unit/unit-tests.ini @@ -50,16 +50,20 @@ b2g = false b2g = true browser = false [test_gesture.py] b2g = true browser = false unagi = true +[test_marionette_touch.py] +b2g = true +browser = false + [test_single_finger.py] b2g = true browser = false [test_multi_finger.py] b2g = true browser = false
--- a/testing/marionette/client/setup.py +++ b/testing/marionette/client/setup.py @@ -1,12 +1,12 @@ import os from setuptools import setup, find_packages -version = '0.5.26' +version = '0.5.27' # get documentation from the README try: here = os.path.dirname(os.path.abspath(__file__)) description = file(os.path.join(here, 'README.md')).read() except (OSError, IOError): description = ''