Merge lp:~nuclearbob/ubiquity/ubiquity-testing into lp:ubiquity
- ubiquity-testing
- Merge into trunk
Proposed by
Max Brustkern
Status: | Merged |
---|---|
Merged at revision: | 6477 |
Proposed branch: | lp:~nuclearbob/ubiquity/ubiquity-testing |
Merge into: | lp:ubiquity |
Diff against target: |
288 lines (+52/-35) 2 files modified
autopilot/ubiquity_autopilot_tests/emulators/gtkcontrols.py (+5/-2) autopilot/ubiquity_autopilot_tests/tests/__init__.py (+47/-33) |
To merge this branch: | bzr merge lp:~nuclearbob/ubiquity/ubiquity-testing |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Installer Team | Pending | ||
Review via email: mp+302594@code.launchpad.net |
Commit message
Pass custom proxy classes directly instead of locating them by name.
Description of the change
This branch passes many custom proxy classes directly instead of attempting to locate them by name.
To post a comment you must log in.
- 6482. By Max Brustkern
-
Removed debug assert
Revision history for this message
Max Brustkern (nuclearbob) wrote : | # |
Revision history for this message
Max Brustkern (nuclearbob) wrote : | # |
I think we'll want these changes in at least xenial, and possibly older versions as well.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'autopilot/ubiquity_autopilot_tests/emulators/gtkcontrols.py' |
2 | --- autopilot/ubiquity_autopilot_tests/emulators/gtkcontrols.py 2016-06-09 13:50:52 +0000 |
3 | +++ autopilot/ubiquity_autopilot_tests/emulators/gtkcontrols.py 2016-08-10 20:53:14 +0000 |
4 | @@ -16,7 +16,10 @@ |
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 | from autopilot.input import Pointer, Mouse, Keyboard |
8 | -from ubiquity_autopilot_tests.emulators import AutopilotGtkEmulatorBase |
9 | +from ubiquity_autopilot_tests.emulators import ( |
10 | + AutopilotGtkEmulatorBase, |
11 | + gtkaccessible, |
12 | +) |
13 | from ubiquity_autopilot_tests.tools.compare import expectThat |
14 | import logging |
15 | import re |
16 | @@ -356,7 +359,7 @@ |
17 | treeviews = [] |
18 | # This is going to be slow! but what more can we do? we can't put |
19 | # an in range arg on the select_many call :-( |
20 | - for tree in root.select_many('GtkTreeViewAccessible'): |
21 | + for tree in root.select_many(gtkaccessible.GtkTreeViewAccessible): |
22 | # There will be some tree's that don't have a globalRect property |
23 | # no idea why but we can just ignore them as we can be sure |
24 | # this isn't the one we want. |
25 | |
26 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/__init__.py' |
27 | --- autopilot/ubiquity_autopilot_tests/tests/__init__.py 2016-06-09 13:50:52 +0000 |
28 | +++ autopilot/ubiquity_autopilot_tests/tests/__init__.py 2016-08-10 20:53:14 +0000 |
29 | @@ -34,6 +34,20 @@ |
30 | Pointer |
31 | ) |
32 | from ubiquity_autopilot_tests.emulators import AutopilotGtkEmulatorBase |
33 | +from ubiquity_autopilot_tests.emulators.gtkcontainers import ( |
34 | + GtkAlignment, |
35 | + GtkBox, |
36 | +) |
37 | +from ubiquity_autopilot_tests.emulators.gtkcontrols import ( |
38 | + GtkButton, |
39 | + GtkCheckButton, |
40 | + GtkLabel, |
41 | + GtkProgressBar, |
42 | + GtkTreeView, |
43 | +) |
44 | +from ubiquity_autopilot_tests.emulators.gtktoplevel import ( |
45 | + GtkWindow, |
46 | +) |
47 | from ubiquity_autopilot_tests.testcase import UbiquityTestCase |
48 | from ubiquity_autopilot_tests.configs import english_label_conf |
49 | from ubiquity_autopilot_tests.configs.partconfig import ( |
50 | @@ -92,7 +106,7 @@ |
51 | |
52 | @property |
53 | def main_window(self, ): |
54 | - return self.app.select_single('GtkWindow', name='live_installer') |
55 | + return self.app.select_single(GtkWindow, name='live_installer') |
56 | |
57 | def go_to_next_page(self, wait=False): |
58 | """ Goes to the next page of Ubiquity installer |
59 | @@ -107,7 +121,7 @@ |
60 | |
61 | """ |
62 | logger.debug('go_to_next_page(wait={0})'.format(wait)) |
63 | - nxt_button = self.main_window.select_single('GtkButton', name='next') |
64 | + nxt_button = self.main_window.select_single(GtkButton, name='next') |
65 | nxt_button.click() |
66 | |
67 | if wait: |
68 | @@ -142,7 +156,7 @@ |
69 | Eventually(Equals(True), timeout=1200)) |
70 | |
71 | page_title = self.main_window.select_single( |
72 | - 'GtkLabel', name='page_title') |
73 | + GtkLabel, name='page_title') |
74 | self.assertThat(page_title.label, |
75 | Eventually(NotEquals(self.current_page_title), |
76 | timeout=240)) |
77 | @@ -155,7 +169,7 @@ |
78 | checks. |
79 | |
80 | """ |
81 | - nxt_button = self.main_window.select_single('GtkButton', name='next') |
82 | + nxt_button = self.main_window.select_single(GtkButton, name='next') |
83 | nxt_button.click() |
84 | |
85 | def welcome_page_tests(self, lang=None): |
86 | @@ -176,8 +190,8 @@ |
87 | # selecting an install language |
88 | logger.debug("Selecting stepLanguage page object") |
89 | welcome_page = self.main_window.select_single( |
90 | - 'GtkBox', name='stepLanguage') |
91 | - treeview = welcome_page.select_single('GtkTreeView') |
92 | + GtkBox, name='stepLanguage') |
93 | + treeview = welcome_page.select_single(GtkTreeView) |
94 | # lets get all items |
95 | treeview_items = treeview.get_all_items() |
96 | # first lets check all the items are non-empty unicode strings |
97 | @@ -248,7 +262,7 @@ |
98 | logger.debug("run_preparing_page_tests()") |
99 | logger.debug("selecting stepPrepare page") |
100 | preparing_page = self.main_window.select_single( |
101 | - 'GtkAlignment', BuilderName='stepPrepare') |
102 | + GtkAlignment, BuilderName='stepPrepare') |
103 | |
104 | objList = [ |
105 | 'prepare_foss_disclaimer_license', |
106 | @@ -260,13 +274,13 @@ |
107 | if updates: |
108 | logger.debug("Selecting install updates") |
109 | update_checkbutton = preparing_page.select_single( |
110 | - 'GtkCheckButton', BuilderName='prepare_download_updates') |
111 | + GtkCheckButton, BuilderName='prepare_download_updates') |
112 | self.pointing_device.click_object(update_checkbutton) |
113 | |
114 | if thirdParty: |
115 | logger.debug("Selecting install thirdparty software") |
116 | thrdprty_checkbutton = preparing_page.select_single( |
117 | - 'GtkCheckButton', BuilderName='prepare_nonfree_software') |
118 | + GtkCheckButton, BuilderName='prepare_nonfree_software') |
119 | self.pointing_device.click_object(thrdprty_checkbutton) |
120 | |
121 | self._check_page_titles() |
122 | @@ -360,7 +374,7 @@ |
123 | self.check_visible_object_with_label(config.visible_options) |
124 | self.check_hidden_object_with_label(config.hidden_options) |
125 | install_type_page = self.main_window.select_single( |
126 | - 'GtkAlignment', BuilderName='stepPartAsk') |
127 | + GtkAlignment, BuilderName='stepPartAsk') |
128 | if option_name: |
129 | obj = install_type_page.select_single(BuilderName=option_name) |
130 | self.pointing_device.click_object(obj) |
131 | @@ -383,7 +397,7 @@ |
132 | .format(crypto_password)) |
133 | logger.debug('Selecting stepPartCrypto page object') |
134 | crypto_page = self.main_window.select_single( |
135 | - 'GtkAlignment', BuilderName='stepPartCrypto') |
136 | + GtkAlignment, BuilderName='stepPartCrypto') |
137 | |
138 | items = ['verified_crypto_label', 'crypto_label', 'crypto_description', |
139 | 'crypto_warning', 'crypto_extra_label', 'crypto_extra_time', |
140 | @@ -412,8 +426,8 @@ |
141 | logger.debug("run_custom_partition_page_tests()") |
142 | logger.debug("Selecting the stepPartAdvanced page object") |
143 | custom_page = self.main_window.select_single( |
144 | - 'GtkAlignment', BuilderName='stepPartAdvanced') |
145 | - treeview = custom_page.select_single('GtkTreeView') |
146 | + GtkAlignment, BuilderName='stepPartAdvanced') |
147 | + treeview = custom_page.select_single(GtkTreeView) |
148 | self.expectThat(treeview.visible, Equals(True), |
149 | "[Page:'{0}'] Partition tree view was not visible") |
150 | obj_list = ['partition_button_new', 'partition_button_delete', |
151 | @@ -461,7 +475,7 @@ |
152 | partition_dialog.set_file_system_type(elem['FileSystemType']) |
153 | partition_dialog.set_mount_point(elem['MountPoint']) |
154 | ok_button = partition_dialog.select_single( |
155 | - 'GtkButton', BuilderName='partition_dialog_okbutton') |
156 | + GtkButton, BuilderName='partition_dialog_okbutton') |
157 | self.pointing_device.click_object(ok_button) |
158 | self.assertThat(partition_dialog.visible, |
159 | Eventually(Equals(False)), |
160 | @@ -486,7 +500,7 @@ |
161 | |
162 | logger.debug("Selecting stepLocation page object") |
163 | location_page = self.main_window.select_single( |
164 | - 'GtkBox', BuilderName='stepLocation') |
165 | + GtkBox, BuilderName='stepLocation') |
166 | location_map = location_page.select_single('CcTimezoneMap') |
167 | self.assertThat(location_map.visible, Equals(True), |
168 | "Expected location map to be visible but it wasn't") |
169 | @@ -513,9 +527,9 @@ |
170 | |
171 | logger.debug("Selecting the stepKeyboardCOnf page object") |
172 | keyboard_page = self.main_window.select_single( |
173 | - 'GtkAlignment', |
174 | + GtkAlignment, |
175 | BuilderName='stepKeyboardConf') |
176 | - treeviews = keyboard_page.select_many('GtkTreeView') |
177 | + treeviews = keyboard_page.select_many(GtkTreeView) |
178 | # lets check all the keyboard tree items for the selected language |
179 | # TODO: we should probably test at some point try changing the keyboard |
180 | # layout to a different language/locale/layout and see if |
181 | @@ -582,7 +596,7 @@ |
182 | self._update_page_titles() |
183 | logger.debug("Selecting stepUserInfo page") |
184 | user_info_page = self.main_window.select_single( |
185 | - 'GtkBox', |
186 | + GtkBox, |
187 | BuilderName='stepUserInfo') |
188 | |
189 | objects = ['hostname_label', 'username_label', 'password_label', |
190 | @@ -626,7 +640,7 @@ |
191 | # self.expectThat(webkitwindow.visible, Equals(True)) |
192 | # print("Webkit window found and is visible") |
193 | print("Selecting Progress bar") |
194 | - progress_bar = self.main_window.select_single('GtkProgressBar', |
195 | + progress_bar = self.main_window.select_single(GtkProgressBar, |
196 | name='install_progress') |
197 | |
198 | # Copying files progress bar |
199 | @@ -721,7 +735,7 @@ |
200 | logger.debug("_track_install_progress_bar()") |
201 | print("_track_install_progress()") |
202 | print("selecting progress bar") |
203 | - progress_bar = self.main_window.select_single('GtkProgressBar', |
204 | + progress_bar = self.main_window.select_single(GtkProgressBar, |
205 | name='install_progress') |
206 | progress = 0.0 |
207 | while progress < 1.0: |
208 | @@ -789,7 +803,7 @@ |
209 | pass |
210 | |
211 | def _get_dialog_message(self, dlg_object): |
212 | - dialog_labels = dlg_object.select_many('GtkLabel') |
213 | + dialog_labels = dlg_object.select_many(GtkLabel) |
214 | message = '' |
215 | for gtklabel in dialog_labels: |
216 | # only add labels longer than 'Continue' so we avoid button labels |
217 | @@ -802,9 +816,9 @@ |
218 | """ adds a new partition """ |
219 | logger.debug("_add_new_partition()") |
220 | custom_page = self.main_window.select_single( |
221 | - 'GtkAlignment', |
222 | + GtkAlignment, |
223 | BuilderName='stepPartAdvanced') |
224 | - tree_view = custom_page.select_single('GtkTreeView') |
225 | + tree_view = custom_page.select_single(GtkTreeView) |
226 | item = tree_view.select_item(u' free space') |
227 | self.pointing_device.click_object(item) |
228 | self.assertThat(item.selected, Equals(True), |
229 | @@ -822,9 +836,9 @@ |
230 | """ |
231 | logger.debug("Checking partition was created.....") |
232 | custom_page = self.main_window.select_single( |
233 | - 'GtkAlignment', |
234 | + GtkAlignment, |
235 | BuilderName='stepPartAdvanced') |
236 | - tree_view = custom_page.select_single('GtkTreeView') |
237 | + tree_view = custom_page.select_single(GtkTreeView) |
238 | # assert a new row has been added to the partition table |
239 | total_rows = self._update_table_row_count(config) |
240 | logger.debug("TOTAL NUMBER OF ROWS: {0}".format(self.part_table_rows)) |
241 | @@ -897,16 +911,16 @@ |
242 | logger.debug("check_window_constants({0}, {1}, {2}, {3})".format( |
243 | continue_button, back_button, quit_button, skip_button)) |
244 | |
245 | - con_button = self.main_window.select_single('GtkButton', name='next') |
246 | + con_button = self.main_window.select_single(GtkButton, name='next') |
247 | self.assertThat(con_button.visible, Equals(continue_button)) |
248 | |
249 | - bk_button = self.main_window.select_single('GtkButton', name='back') |
250 | + bk_button = self.main_window.select_single(GtkButton, name='back') |
251 | self.assertThat(bk_button.visible, Equals(back_button)) |
252 | |
253 | - qt_button = self.main_window.select_single('GtkButton', name='quit') |
254 | + qt_button = self.main_window.select_single(GtkButton, name='quit') |
255 | self.assertThat(qt_button.visible, Equals(quit_button)) |
256 | |
257 | - skp_button = self.main_window.select_single('GtkButton', name='skip') |
258 | + skp_button = self.main_window.select_single(GtkButton, name='skip') |
259 | self.assertThat(skp_button.visible, Equals(skip_button)) |
260 | |
261 | def _update_current_step(self, name): |
262 | @@ -920,9 +934,9 @@ |
263 | " Returns number of rows in table" |
264 | |
265 | custom_page = self.main_window.select_single( |
266 | - 'GtkAlignment', |
267 | + GtkAlignment, |
268 | BuilderName='stepPartAdvanced') |
269 | - tree_view = custom_page.select_single('GtkTreeView') |
270 | + tree_view = custom_page.select_single(GtkTreeView) |
271 | num = tree_view.get_number_of_rows() |
272 | if num == self.total_number_partitions: |
273 | # TODO: assert 'free space' changes to a partition |
274 | @@ -953,12 +967,12 @@ |
275 | def _update_page_titles(self, ): |
276 | self.previous_page_title = self.current_page_title |
277 | self.current_page_title = self.main_window.select_single( |
278 | - 'GtkLabel', |
279 | + GtkLabel, |
280 | BuilderName='page_title').label |
281 | |
282 | def _check_page_titles(self, ): |
283 | current_page_title = self.main_window.select_single( |
284 | - 'GtkLabel', |
285 | + GtkLabel, |
286 | BuilderName='page_title') |
287 | if self.current_step in self.english_config: |
288 | if self.english_install and ( |
Can I get a review on this? We need some updates or all the tests will continue failing on this, blocking us from seeing any actual potential test failures.