testing/marionette/client/marionette/tests/unit/test_press_release.py
author Yiming Yang <yiyang@mozilla.com>
Wed, 06 Feb 2013 11:58:14 -0800
changeset 130930 b3e63d9ea7acd9c52f92d6a4674ad959edf4c0e9
child 134362 7561dc42ece92b799c1a21afe4fc8ba6c113c793
permissions -rw-r--r--
Bug 836375 - Add press() and release() tap gestures on elements, r=mdas

# 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
import time
from marionette_test import MarionetteTestCase

class testPressRelease(MarionetteTestCase):
    def test_coordinates(self):
        testTouch = self.marionette.absolute_url("testTouch.html")
        self.marionette.navigate(testTouch)
        button = self.marionette.find_element("id", "mozLink")
        new_id = button.press(0, 300)
        button.release(new_id, 0, 300)
        time.sleep(10)
        self.assertEqual("Clicked", self.marionette.execute_script("return document.getElementById('mozLinkPos').innerHTML;"))
        new_id2 = button.press(0, 0)
        button.release(new_id2, 0, 0)
        time.sleep(10)
        self.assertEqual("Clicked", self.marionette.execute_script("return document.getElementById('mozLink').innerHTML;"))

    def test_no_coordinates(self):
      testTouch = self.marionette.absolute_url("testTouch.html")
      self.marionette.navigate(testTouch)
      ele = self.marionette.find_element("id", "scroll")
      scroll_id = ele.press()
      ele.release(scroll_id)
      time.sleep(10)
      self.assertEqual("Clicked", self.marionette.execute_script("return document.getElementById('scroll').innerHTML;"))