Merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/fix1361750-textfield_logs into lp:ubuntu-ui-toolkit/staging

Proposed by Leo Arias on 2014-08-26
Status: Merged
Approved by: Zsombor Egri on 2014-09-21
Approved revision: 1220
Merged at revision: 1262
Proposed branch: lp:~canonical-platform-qa/ubuntu-ui-toolkit/fix1361750-textfield_logs
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 81 lines (+16/-1)
1 file modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py (+16/-1)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/fix1361750-textfield_logs
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2014-09-21
Tim Peeters 2014-08-26 Approve on 2014-09-08
Omer Akram (community) code 2014-08-26 Approve on 2014-08-26
Review via email: mp+232262@code.launchpad.net

Commit message

Add logging to the textfield autopilot helpers.

To post a comment you must log in.
Omer Akram (om26er) wrote :

Looks good. waiting for CI results.

review: Approve (code)
1220. By Leo Arias on 2014-09-08

Merged with staging.

Tim Peeters (tpeeters) wrote :

Thanks. Let's fix the failing CI test first.

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py'
2--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-08-20 20:22:45 +0000
3+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-09-08 17:06:37 +0000
4@@ -14,7 +14,12 @@
5 # You should have received a copy of the GNU Lesser General Public License
6 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7
8-from autopilot import platform
9+import logging
10+
11+from autopilot import (
12+ logging as autopilot_logging,
13+ platform
14+)
15
16 from ubuntuuitoolkit._custom_proxy_objects import (
17 _common,
18@@ -22,6 +27,9 @@
19 )
20
21
22+logger = logging.getLogger(__name__)
23+
24+
25 class TextField(_common.UbuntuUIToolkitCustomProxyObjectBase):
26 """TextField Autopilot custom proxy object."""
27
28@@ -29,6 +37,7 @@
29 super(TextField, self).__init__(*args)
30 self.keyboard = _common.get_keyboard()
31
32+ @autopilot_logging.log_action(logger.info)
33 def write(self, text, clear=True):
34 """Write into the text field.
35
36@@ -47,6 +56,7 @@
37 self.keyboard.press_and_release('End')
38 self.keyboard.type(text)
39
40+ @autopilot_logging.log_action(logger.info)
41 def clear(self):
42 """Clear the text field."""
43 if not self.is_empty():
44@@ -60,6 +70,7 @@
45 """Return True if the text field is empty. False otherwise."""
46 return self.text == ''
47
48+ @autopilot_logging.log_action(logger.debug)
49 def _click_clear_button(self):
50 clear_button = self.select_single(
51 'AbstractButton', objectName='clear_button')
52@@ -67,6 +78,7 @@
53 self.pointing_device.click_object(self)
54 self.pointing_device.click_object(clear_button)
55
56+ @autopilot_logging.log_action(logger.debug)
57 def _clear_with_keys(self):
58 if platform.model() == 'Desktop':
59 self._select_all()
60@@ -81,6 +93,7 @@
61 if not self.is_empty():
62 raise _common.ToolkitException('Failed to clear the text field.')
63
64+ @autopilot_logging.log_action(logger.debug)
65 def _select_all(self):
66 if not self._is_all_text_selected():
67 # right click is needed
68@@ -94,11 +107,13 @@
69 def _is_all_text_selected(self):
70 return self.text == self.selectedText
71
72+ @autopilot_logging.log_action(logger.debug)
73 def _go_to_end(self):
74 # XXX Here we are cheating because the on-screen keyboard doesn't have
75 # an END key. --elopio - 2014-08-20
76 self.keyboard.press_and_release('End')
77
78+ @autopilot_logging.log_action(logger.debug)
79 def _delete_one_character(self):
80 original_text = self.text
81 # We delete with backspace because the on-screen keyboard has

Subscribers

People subscribed via source and target branches