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

Proposed by Leo Arias
Status: Merged
Approved by: Zsombor Egri
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
Tim Peeters Approve
Omer Akram (community) code Approve
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.
Revision history for this message
Omer Akram (om26er) wrote :

Looks good. waiting for CI results.

review: Approve (code)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1220. By Leo Arias

Merged with staging.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

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

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-08-20 20:22:45 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-09-08 17:06:37 +0000
@@ -14,7 +14,12 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17from autopilot import platform17import logging
18
19from autopilot import (
20 logging as autopilot_logging,
21 platform
22)
1823
19from ubuntuuitoolkit._custom_proxy_objects import (24from ubuntuuitoolkit._custom_proxy_objects import (
20 _common,25 _common,
@@ -22,6 +27,9 @@
22)27)
2328
2429
30logger = logging.getLogger(__name__)
31
32
25class TextField(_common.UbuntuUIToolkitCustomProxyObjectBase):33class TextField(_common.UbuntuUIToolkitCustomProxyObjectBase):
26 """TextField Autopilot custom proxy object."""34 """TextField Autopilot custom proxy object."""
2735
@@ -29,6 +37,7 @@
29 super(TextField, self).__init__(*args)37 super(TextField, self).__init__(*args)
30 self.keyboard = _common.get_keyboard()38 self.keyboard = _common.get_keyboard()
3139
40 @autopilot_logging.log_action(logger.info)
32 def write(self, text, clear=True):41 def write(self, text, clear=True):
33 """Write into the text field.42 """Write into the text field.
3443
@@ -47,6 +56,7 @@
47 self.keyboard.press_and_release('End')56 self.keyboard.press_and_release('End')
48 self.keyboard.type(text)57 self.keyboard.type(text)
4958
59 @autopilot_logging.log_action(logger.info)
50 def clear(self):60 def clear(self):
51 """Clear the text field."""61 """Clear the text field."""
52 if not self.is_empty():62 if not self.is_empty():
@@ -60,6 +70,7 @@
60 """Return True if the text field is empty. False otherwise."""70 """Return True if the text field is empty. False otherwise."""
61 return self.text == ''71 return self.text == ''
6272
73 @autopilot_logging.log_action(logger.debug)
63 def _click_clear_button(self):74 def _click_clear_button(self):
64 clear_button = self.select_single(75 clear_button = self.select_single(
65 'AbstractButton', objectName='clear_button')76 'AbstractButton', objectName='clear_button')
@@ -67,6 +78,7 @@
67 self.pointing_device.click_object(self)78 self.pointing_device.click_object(self)
68 self.pointing_device.click_object(clear_button)79 self.pointing_device.click_object(clear_button)
6980
81 @autopilot_logging.log_action(logger.debug)
70 def _clear_with_keys(self):82 def _clear_with_keys(self):
71 if platform.model() == 'Desktop':83 if platform.model() == 'Desktop':
72 self._select_all()84 self._select_all()
@@ -81,6 +93,7 @@
81 if not self.is_empty():93 if not self.is_empty():
82 raise _common.ToolkitException('Failed to clear the text field.')94 raise _common.ToolkitException('Failed to clear the text field.')
8395
96 @autopilot_logging.log_action(logger.debug)
84 def _select_all(self):97 def _select_all(self):
85 if not self._is_all_text_selected():98 if not self._is_all_text_selected():
86 # right click is needed99 # right click is needed
@@ -94,11 +107,13 @@
94 def _is_all_text_selected(self):107 def _is_all_text_selected(self):
95 return self.text == self.selectedText108 return self.text == self.selectedText
96109
110 @autopilot_logging.log_action(logger.debug)
97 def _go_to_end(self):111 def _go_to_end(self):
98 # XXX Here we are cheating because the on-screen keyboard doesn't have112 # XXX Here we are cheating because the on-screen keyboard doesn't have
99 # an END key. --elopio - 2014-08-20113 # an END key. --elopio - 2014-08-20
100 self.keyboard.press_and_release('End')114 self.keyboard.press_and_release('End')
101115
116 @autopilot_logging.log_action(logger.debug)
102 def _delete_one_character(self):117 def _delete_one_character(self):
103 original_text = self.text118 original_text = self.text
104 # We delete with backspace because the on-screen keyboard has119 # We delete with backspace because the on-screen keyboard has

Subscribers

People subscribed via source and target branches