[Toaster] [PATCH 4/4] toaster-tests: make helper click on input before entering text

Elliot Smith elliot.smith at intel.com
Mon Apr 11 04:27:27 PDT 2016


The Selenium helper's enter_text() method doesn't cause
keyup events to trigger unless the element where text is
being entered has been clicked.

Prefix all text entry with a click() on the element to ensure
that keyup events fire.

Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
 bitbake/lib/toaster/tests/browser/selenium_helpers.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/toaster/tests/browser/selenium_helpers.py b/bitbake/lib/toaster/tests/browser/selenium_helpers.py
index d3ab3ca..56dbe2b 100644
--- a/bitbake/lib/toaster/tests/browser/selenium_helpers.py
+++ b/bitbake/lib/toaster/tests/browser/selenium_helpers.py
@@ -185,7 +185,11 @@ class SeleniumTestCase(StaticLiveServerTestCase):
 
     def enter_text(self, selector, value):
         """ Insert text into element matching selector """
-        field = self.wait_until_present(selector)
+        # note that keyup events don't occur until the element is clicked
+        # (in the case of <input type="text"...>, for example), so simulate
+        # user clicking the element before inserting text into it
+        field = self.click(selector)
+
         field.send_keys(value)
         return field
 
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the toaster mailing list