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
1=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py'
2--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py 2014-07-26 00:10:22 +0000
3+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py 2014-08-21 13:32:36 +0000
4@@ -25,3 +25,9 @@
5 if not self.is_empty():
6 self._clear_with_keys()
7 self.text.wait_for('')
8+
9+ def _go_to_end(self):
10+ # We override this because the text areas can have more than one line.
11+ # XXX Here we are cheating because the on-screen keyboard doesn't have
12+ # CTRL nor END keys. --elopio - 2014-08-20
13+ self.keyboard.press_and_release('Ctrl+End')
14
15=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py'
16--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-08-20 06:45:28 +0000
17+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-08-21 13:32:36 +0000
18@@ -70,15 +70,16 @@
19 def _clear_with_keys(self):
20 if platform.model() == 'Desktop':
21 self._select_all()
22+ self.keyboard.press_and_release('BackSpace')
23 else:
24 # Touch tap currently doesn't have a press_duration parameter, so
25- # we can't show the popover. Reported as bug http://pad.lv/1268782
26- # --elopio - 2014-01-13
27- self.keyboard.press_and_release('End')
28- while not self.is_empty():
29- # We delete with backspace because the on-screen keyboard has that
30- # key.
31- self.keyboard.press_and_release('BackSpace')
32+ # we can't select all the text.
33+ # Reported as bug http://pad.lv/1268782 --elopio - 2014-01-13
34+ self._go_to_end()
35+ while self.cursorPosition != 0:
36+ self._delete_one_character()
37+ if not self.is_empty():
38+ raise _common.ToolkitException('Failed to clear the text field.')
39
40 def _select_all(self):
41 if not self._is_all_text_selected():
42@@ -92,3 +93,16 @@
43
44 def _is_all_text_selected(self):
45 return self.text == self.selectedText
46+
47+ def _go_to_end(self):
48+ # XXX Here we are cheating because the on-screen keyboard doesn't have
49+ # an END key. --elopio - 2014-08-20
50+ self.keyboard.press_and_release('End')
51+
52+ def _delete_one_character(self):
53+ original_text = self.text
54+ # We delete with backspace because the on-screen keyboard has
55+ # that key.
56+ self.keyboard.press_and_release('BackSpace')
57+ if len(self.text) != len(original_text) - 1:
58+ raise _common.ToolkitException('Failed to delete one character.')
59
60=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py'
61--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 2014-07-28 16:23:01 +0000
62+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 2014-08-21 13:32:36 +0000
63@@ -14,6 +14,14 @@
64 # You should have received a copy of the GNU Lesser General Public License
65 # along with this program. If not, see <http://www.gnu.org/licenses/>.
66
67+try:
68+ from unittest import mock
69+except ImportError:
70+ import mock
71+
72+from autopilot import platform
73+from testtools.matchers import GreaterThan
74+
75 import ubuntuuitoolkit
76 from ubuntuuitoolkit import tests
77
78@@ -45,7 +53,22 @@
79 self.assertTrue(
80 issubclass(ubuntuuitoolkit.TextArea, ubuntuuitoolkit.TextField))
81
82- def test_clear(self):
83+ def test_clear_with_single_line(self):
84 self.simple_text_area.write('test')
85 self.simple_text_area.clear()
86 self.assertEqual(self.simple_text_area.text, '')
87+
88+ def test_clear_with_multiple_lines_on_touch(self):
89+ # This is a regrestion test for http://pad.lv/1359167
90+ self.simple_text_area.write(
91+ 'Long text that will make it wrap into multiple lines.')
92+ self.assertThat(self.simple_text_area.lineCount, GreaterThan(1))
93+ self.simple_text_area.keyboard.press_and_release('Ctrl+Home')
94+ if platform.model() == 'Desktop':
95+ # Use a touch mock.
96+ patcher = mock.patch('autopilot.platform.model')
97+ mock_model = patcher.start()
98+ self.addCleanup(patcher.stop)
99+ mock_model.return_value = 'not desktop'
100+ self.simple_text_area.clear()
101+ self.assertEqual(self.simple_text_area.text, '')

Subscribers

People subscribed via source and target branches