Merge lp:~elopio/ubuntu-ui-toolkit/fix1274240-gallery-textfield_helper into lp:ubuntu-ui-toolkit
- fix1274240-gallery-textfield_helper
- Merge into trunk
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Cris Dywan | ||||||||
Approved revision: | 936 | ||||||||
Merged at revision: | 932 | ||||||||
Proposed branch: | lp:~elopio/ubuntu-ui-toolkit/fix1274240-gallery-textfield_helper | ||||||||
Merge into: | lp:ubuntu-ui-toolkit | ||||||||
Prerequisite: | lp:~zsombi/ubuntu-ui-toolkit/dateUtilsTestFix | ||||||||
Diff against target: |
179 lines (+81/-50) 3 files modified
tests/autopilot/ubuntuuitoolkit/emulators.py (+1/-0) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py (+50/-50) tests/unit_x11/tst_components/tst_textfield.qml (+30/-0) |
||||||||
To merge this branch: | bzr merge lp:~elopio/ubuntu-ui-toolkit/fix1274240-gallery-textfield_helper | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Cris Dywan | Approve | ||
Richard Huddie | Pending | ||
Javier Collado | Pending | ||
VĂctor R. Ruiz | Pending | ||
Review via email: mp+203831@code.launchpad.net |
This proposal supersedes a proposal from 2014-01-29.
Commit message
Use the autopilot text field helper in the gallery test cases
Description of the change
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:931
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:932
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Leo Arias (elopio) wrote : | # |
Test is failing because of https:/
Leo Arias (elopio) wrote : | # |
Ahh, wrong link. https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:932
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Francis Ginther (fginther) wrote : | # |
A rerun of just the mako test passed:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:933
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:934
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Cris Dywan (kalikiana) wrote : | # |
This fails on mako in ERROR: ubuntuuitoolkit
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:935
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:936
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Cris Dywan (kalikiana) wrote : | # |
So why doesn't write work here? Is that a bug?
Leo Arias (elopio) wrote : | # |
Because I added a focus.wait_
I thought that's ok, as we should never write on disabled textfields, and if we do it should fail anyway.
So, for this test on the disabled text field, we need to go one level lower than write, and call type so we avoid the focus.wait_
Let me know what you think about it.
Thanks for reviewing.
Cris Dywan (kalikiana) wrote : | # |
It wasn't clear from the code, but the reasoning is sound.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Leo Arias (elopio) wrote : | # |
Thanks for the review!
All tests failed again in jenkins, I wonder what's going on there. Still, not related to this branch.
Now, after this branch lands, please let me know if you see any text fields misbehaving. The logs should provide more useful information and clues to what we can try next.
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py' |
2 | --- tests/autopilot/ubuntuuitoolkit/emulators.py 2014-01-13 23:38:20 +0000 |
3 | +++ tests/autopilot/ubuntuuitoolkit/emulators.py 2014-02-04 17:25:32 +0000 |
4 | @@ -472,6 +472,7 @@ |
5 | |
6 | """ |
7 | with self.keyboard.focused_type(self): |
8 | + self.focus.wait_for(True) |
9 | if clear: |
10 | self.clear() |
11 | else: |
12 | |
13 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py' |
14 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2013-12-12 09:56:16 +0000 |
15 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2014-02-04 17:25:32 +0000 |
16 | @@ -1,6 +1,6 @@ |
17 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
18 | # |
19 | -# Copyright (C) 2012, 2013 Canonical Ltd. |
20 | +# Copyright (C) 2012, 2013, 2014 Canonical Ltd. |
21 | # |
22 | # This program is free software; you can redistribute it and/or modify |
23 | # it under the terms of the GNU Lesser General Public License as published by |
24 | @@ -16,59 +16,59 @@ |
25 | |
26 | """Tests for the Ubuntu UI Toolkit Gallery - TextInput components""" |
27 | |
28 | -from autopilot.matchers import Eventually |
29 | -from testtools.matchers import Equals |
30 | +from ubuntuuitoolkit import emulators |
31 | from ubuntuuitoolkit.tests.gallery import GalleryTestCase |
32 | |
33 | |
34 | -class TextInputTests(GalleryTestCase): |
35 | - """Generic tests for the Gallery""" |
36 | - |
37 | - def test_textfield_standard(self): |
38 | - item = "Text Field" |
39 | - self.loadItem(item) |
40 | - self.checkPageHeader(item) |
41 | - textfield_standard = self.getObject('textfield_standard') |
42 | - self.pointing_device.click_object(textfield_standard) |
43 | - self.assertThat(textfield_standard.focus, Eventually(Equals(True))) |
44 | - self.type_string('Hello World') |
45 | - self.assertThat(textfield_standard.text, |
46 | - Eventually(Equals('Hello World'))) |
47 | - |
48 | - def test_textfield_password(self): |
49 | - item = "Text Field" |
50 | - self.loadItem(item) |
51 | - self.checkPageHeader(item) |
52 | - textfield_password = self.getObject('textfield_password') |
53 | - self.pointing_device.click_object(textfield_password) |
54 | - self.assertThat(textfield_password.text, Equals('password')) |
55 | - |
56 | - self.tap_clearButton('textfield_password') |
57 | - self.assertThat(textfield_password.text, Eventually(Equals(''))) |
58 | - |
59 | - self.type_string('abcdefgh123') |
60 | - self.assertThat(textfield_password.text, |
61 | - Eventually(Equals('abcdefgh123'))) |
62 | - |
63 | - def test_textfield_numbers(self): |
64 | - item = "Text Field" |
65 | - self.loadItem(item) |
66 | - self.checkPageHeader(item) |
67 | - textfield_numbers = self.getObject('textfield_numbers') |
68 | - self.assertThat(textfield_numbers.text, Eventually(Equals('123'))) |
69 | - |
70 | - self.tap_clearButton('textfield_numbers') |
71 | - self.assertThat(textfield_numbers.text, Eventually(Equals(''))) |
72 | - #try typing decimal value when text filed is int only. |
73 | - self.type_string('-100.123') |
74 | - self.assertThat(textfield_numbers.text, Eventually(Equals('-100123'))) |
75 | +class WriteAndClearTextInputTestCase(GalleryTestCase): |
76 | + |
77 | + scenarios = [ |
78 | + ('standard textfield', dict( |
79 | + objectName='textfield_standard', text_to_write='Hello World', |
80 | + expected_text='Hello World')), |
81 | + ('password textfield', dict( |
82 | + objectName='textfield_password', text_to_write='Test password', |
83 | + expected_text='Test password')), |
84 | + ('only integers textfield', dict( |
85 | + objectName='textfield_numbers', text_to_write='-100.123', |
86 | + expected_text='-100123')) |
87 | + ] |
88 | + |
89 | + def setUp(self): |
90 | + super(WriteAndClearTextInputTestCase, self).setUp() |
91 | + item = 'Text Field' |
92 | + self.loadItem(item) |
93 | + self.checkPageHeader(item) |
94 | + |
95 | + def test_write_on_textfield_must_update_text(self): |
96 | + textfield = self.main_view.select_single( |
97 | + emulators.TextField, objectName=self.objectName) |
98 | + |
99 | + textfield.write(self.text_to_write) |
100 | + self.assertEqual(self.expected_text, textfield.text) |
101 | + |
102 | + def test_clear_textfield_must_remove_text(self): |
103 | + textfield = self.main_view.select_single( |
104 | + emulators.TextField, objectName=self.objectName) |
105 | + textfield.write(self.text_to_write) |
106 | + |
107 | + textfield.clear() |
108 | + self.assertEqual('', textfield.text) |
109 | + |
110 | + |
111 | +class DisabledTextInputTestCase(GalleryTestCase): |
112 | + |
113 | + def setUp(self): |
114 | + super(DisabledTextInputTestCase, self).setUp() |
115 | + item = 'Text Field' |
116 | + self.loadItem(item) |
117 | + self.checkPageHeader(item) |
118 | |
119 | def test_textfield_disabled(self): |
120 | - item = "Text Field" |
121 | - self.loadItem(item) |
122 | - self.checkPageHeader(item) |
123 | - textfield_disabled = self.getObject('textfield_disabled') |
124 | + textfield_disabled = self.main_view.select_single( |
125 | + emulators.TextField, objectName='textfield_disabled') |
126 | self.assertFalse(textfield_disabled.enabled) |
127 | - #try tapping a disabled field and verify that focus is false. |
128 | + |
129 | self.pointing_device.click_object(textfield_disabled) |
130 | - self.assertFalse(textfield_disabled.focus) |
131 | + textfield_disabled.keyboard.type('This should not be writen') |
132 | + self.assertEqual('', textfield_disabled.text) |
133 | |
134 | === modified file 'tests/unit_x11/tst_components/tst_textfield.qml' |
135 | --- tests/unit_x11/tst_components/tst_textfield.qml 2013-10-22 17:15:24 +0000 |
136 | +++ tests/unit_x11/tst_components/tst_textfield.qml 2014-02-04 17:25:32 +0000 |
137 | @@ -64,6 +64,16 @@ |
138 | } |
139 | } |
140 | |
141 | + TextField { |
142 | + id: enabledTextField |
143 | + enabled: true |
144 | + } |
145 | + |
146 | + TextField { |
147 | + id: disabledTextField |
148 | + enabled: false |
149 | + } |
150 | + |
151 | TestCase { |
152 | name: "TextFieldAPI" |
153 | when: windowShown |
154 | @@ -451,5 +461,25 @@ |
155 | id: regExpValidator |
156 | regExp: /[a-z]*/ |
157 | } |
158 | + |
159 | + function test_click_enabled_textfield_must_give_focus() { |
160 | + textField.forceActiveFocus(); |
161 | + compare( |
162 | + enabledTextField.focus, false, |
163 | + 'enabledTextField is not focused'); |
164 | + mouseClick( |
165 | + enabledTextField, enabledTextField.width/2, |
166 | + enabledTextField.height/2) |
167 | + compare( |
168 | + enabledTextField.focus, true, 'enabledTextField is focused') |
169 | + } |
170 | + |
171 | + function test_click_disabled_textfield_must_not_give_focus() { |
172 | + mouseClick( |
173 | + disabledTextField, disabledTextField.width/2, |
174 | + disabledTextField.height/2) |
175 | + compare( |
176 | + textField.focus, false, 'disabledTextField is not focused'); |
177 | + } |
178 | } |
179 | } |
FAILED: Continuous integration, rev:929 jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- ci/1648/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty/ 2717/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty- touch/2483/ console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- trusty- amd64-ci/ 596/console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- trusty- armhf-ci/ 596/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/2719/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/2484/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- ui-toolkit- ci/1648/ rebuild
http://