Merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/fix1359167-empty_multiline_textarea into lp:ubuntu-ui-toolkit/staging

Proposed by Leo Arias
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1207
Merged at revision: 1204
Proposed branch: lp:~canonical-platform-qa/ubuntu-ui-toolkit/fix1359167-empty_multiline_textarea
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 101 lines (+51/-8)
3 files modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py (+6/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py (+21/-7)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py (+24/-1)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/fix1359167-empty_multiline_textarea
Reviewer Review Type Date Requested Status
Zsombor Egri Approve
PS Jenkins bot continuous-integration Approve
Nicholas Skaggs (community) Approve
Canonical Platform QA Team Pending
Review via email: mp+231626@code.launchpad.net

This proposal supersedes a proposal from 2014-08-20.

Commit message

On autopilot helpers, take into account that text areas can have multiple lines when deleting the text.

To post a comment you must log in.
1202. By Leo Arias

Fixed typo.

1203. By Leo Arias

Fixed the import.

1204. By Leo Arias

Typo.

1205. By Leo Arias

Avoid another possible infinite loop.

1206. By Leo Arias

Reorder.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Confirming this does indeed properly account for textareas. All infinite loops should be account for now.

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

FAILED: Continuous integration, rev:1204
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/862/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3865
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2973
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/694
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/694
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/694/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/694
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3722
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5112
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5112/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11843
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2415
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3257
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3257/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/862/rebuild

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

FAILED: Continuous integration, rev:1206
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/863/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3873
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2983
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/695
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/695
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/695/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/695
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3731
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5120
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5120/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11857
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2425
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3267
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3267/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/863/rebuild

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

FAILED: Continuous integration, rev:1206
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/864/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3880
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2991
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/696
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/696
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/696/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/696
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3738
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5127
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5127/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11871
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2432
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3275
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3275/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/864/rebuild

review: Needs Fixing (continuous-integration)
1207. By Leo Arias

Merged with staging.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1207
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/873/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3915
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/3012/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/705
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/705
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/705/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/705
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3768
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5162
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/5162/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11912
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2452/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3297
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3297/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/873/rebuild

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

Yup, looks good, thanks!!

review: Approve

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/_textarea.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py 2014-07-26 00:10:22 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py 2014-08-21 13:32:36 +0000
@@ -25,3 +25,9 @@
25 if not self.is_empty():25 if not self.is_empty():
26 self._clear_with_keys()26 self._clear_with_keys()
27 self.text.wait_for('')27 self.text.wait_for('')
28
29 def _go_to_end(self):
30 # We override this because the text areas can have more than one line.
31 # XXX Here we are cheating because the on-screen keyboard doesn't have
32 # CTRL nor END keys. --elopio - 2014-08-20
33 self.keyboard.press_and_release('Ctrl+End')
2834
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-08-20 06:45:28 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-08-21 13:32:36 +0000
@@ -70,15 +70,16 @@
70 def _clear_with_keys(self):70 def _clear_with_keys(self):
71 if platform.model() == 'Desktop':71 if platform.model() == 'Desktop':
72 self._select_all()72 self._select_all()
73 self.keyboard.press_and_release('BackSpace')
73 else:74 else:
74 # Touch tap currently doesn't have a press_duration parameter, so75 # Touch tap currently doesn't have a press_duration parameter, so
75 # we can't show the popover. Reported as bug http://pad.lv/126878276 # we can't select all the text.
76 # --elopio - 2014-01-1377 # Reported as bug http://pad.lv/1268782 --elopio - 2014-01-13
77 self.keyboard.press_and_release('End')78 self._go_to_end()
78 while not self.is_empty():79 while self.cursorPosition != 0:
79 # We delete with backspace because the on-screen keyboard has that80 self._delete_one_character()
80 # key.81 if not self.is_empty():
81 self.keyboard.press_and_release('BackSpace')82 raise _common.ToolkitException('Failed to clear the text field.')
8283
83 def _select_all(self):84 def _select_all(self):
84 if not self._is_all_text_selected():85 if not self._is_all_text_selected():
@@ -92,3 +93,16 @@
9293
93 def _is_all_text_selected(self):94 def _is_all_text_selected(self):
94 return self.text == self.selectedText95 return self.text == self.selectedText
96
97 def _go_to_end(self):
98 # XXX Here we are cheating because the on-screen keyboard doesn't have
99 # an END key. --elopio - 2014-08-20
100 self.keyboard.press_and_release('End')
101
102 def _delete_one_character(self):
103 original_text = self.text
104 # We delete with backspace because the on-screen keyboard has
105 # that key.
106 self.keyboard.press_and_release('BackSpace')
107 if len(self.text) != len(original_text) - 1:
108 raise _common.ToolkitException('Failed to delete one character.')
95109
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 2014-07-28 16:23:01 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 2014-08-21 13:32:36 +0000
@@ -14,6 +14,14 @@
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
17try:
18 from unittest import mock
19except ImportError:
20 import mock
21
22from autopilot import platform
23from testtools.matchers import GreaterThan
24
17import ubuntuuitoolkit25import ubuntuuitoolkit
18from ubuntuuitoolkit import tests26from ubuntuuitoolkit import tests
1927
@@ -45,7 +53,22 @@
45 self.assertTrue(53 self.assertTrue(
46 issubclass(ubuntuuitoolkit.TextArea, ubuntuuitoolkit.TextField))54 issubclass(ubuntuuitoolkit.TextArea, ubuntuuitoolkit.TextField))
4755
48 def test_clear(self):56 def test_clear_with_single_line(self):
49 self.simple_text_area.write('test')57 self.simple_text_area.write('test')
50 self.simple_text_area.clear()58 self.simple_text_area.clear()
51 self.assertEqual(self.simple_text_area.text, '')59 self.assertEqual(self.simple_text_area.text, '')
60
61 def test_clear_with_multiple_lines_on_touch(self):
62 # This is a regrestion test for http://pad.lv/1359167
63 self.simple_text_area.write(
64 'Long text that will make it wrap into multiple lines.')
65 self.assertThat(self.simple_text_area.lineCount, GreaterThan(1))
66 self.simple_text_area.keyboard.press_and_release('Ctrl+Home')
67 if platform.model() == 'Desktop':
68 # Use a touch mock.
69 patcher = mock.patch('autopilot.platform.model')
70 mock_model = patcher.start()
71 self.addCleanup(patcher.stop)
72 mock_model.return_value = 'not desktop'
73 self.simple_text_area.clear()
74 self.assertEqual(self.simple_text_area.text, '')

Subscribers

People subscribed via source and target branches