Skip to content

Instantly share code, notes, and snippets.

@gnarf
Created October 28, 2013 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnarf/0e19c99af5f81476167b to your computer and use it in GitHub Desktop.
Save gnarf/0e19c99af5f81476167b to your computer and use it in GitHub Desktop.
From 70b74cbcf2f68b8cf853ac629f94a50892760ec2 Mon Sep 17 00:00:00 2001
From: Corey Frang <gnarf37@gmail.com>
Date: Sun, 27 Oct 2013 23:06:46 -0400
Subject: [PATCH] Fix gaia-ui-test fails
---
tests/python/gaia-ui-tests/gaiatest/apps/keyboard/app.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/python/gaia-ui-tests/gaiatest/apps/keyboard/app.py b/tests/python/gaia-ui-tests/gaiatest/apps/keyboard/app.py
index 07937de..e307872 100644
--- a/tests/python/gaia-ui-tests/gaiatest/apps/keyboard/app.py
+++ b/tests/python/gaia-ui-tests/gaiatest/apps/keyboard/app.py
@@ -84,16 +84,17 @@ class Keyboard(Base):
input_type = self.marionette.execute_script('return window.wrappedJSObject.currentInputType;')
layout_page = self.marionette.execute_script('return window.wrappedJSObject.layoutPage;')
if val.isalpha():
is_upper_case = self.marionette.execute_script('return window.wrappedJSObject.isUpperCase;')
if not layout_page == 'Default':
self._tap(self._alpha_key)
if not val.isupper() == is_upper_case:
self._tap(self._upper_case_key)
+ Actions(self.marionette).wait(0.2).perform();
# numbers and symbols are in another keyboard
else:
if not input_type == 'number' and layout_page == 'Default':
self._tap(self._numeric_sign_key)
self.wait_for_condition(lambda m: m.find_element(*self._key_locator(self._alpha_key)).is_displayed())
if not self.is_element_present(*self._key_locator(val)):
self._tap(self._alt_key)
@@ -114,18 +115,18 @@ class Keyboard(Base):
def _key_locator(self, val):
if len(val) == 1:
val = ord(val)
return (self._button_locator[0], self._button_locator[1] % val)
# this is to tap on desired key on keyboard
def _tap(self, val):
try:
+ self.wait_for_condition(lambda m: m.find_element(*self._key_locator(val)).is_displayed)
key = self.marionette.find_element(*self._key_locator(val))
- self.wait_for_condition(lambda m: key.is_displayed)
Actions(self.marionette).press(key).wait(0.1).release().perform()
except (NoSuchElementException, ElementNotVisibleException):
self.marionette.log('Key %s not found on the keyboard' % val)
raise
# This is for selecting special characters after long pressing
# "selection" is the nth special element you want to select (n>=1)
def choose_extended_character(self, long_press_key, selection, movement=True):
--
1.7.12.4 (Apple Git-37)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment