Merge lp:~chris.gagnon/sudoku-app/autopilot-1.4-update into lp:sudoku-app
- autopilot-1.4-update
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Nicholas Skaggs |
Proposed branch: | lp:~chris.gagnon/sudoku-app/autopilot-1.4-update |
Merge into: | lp:sudoku-app |
Diff against target: |
643 lines (+136/-172) 4 files modified
debian/control (+1/-1) tests/autopilot/sudoku_app/emulators.py (+30/-69) tests/autopilot/sudoku_app/tests/__init__.py (+6/-3) tests/autopilot/sudoku_app/tests/test_sudoku.py (+99/-99) |
To merge this branch: | bzr merge lp:~chris.gagnon/sudoku-app/autopilot-1.4-update |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Needs Fixing | |
Christopher Lee (community) | Approve | ||
Sudoku Touch developers | Pending | ||
Review via email: mp+192774@code.launchpad.net |
Commit message
update to autopilot 1.4, do not approve this until builders are ready to build with autopilot 1.4
Description of the change
Do not merge this change in until builders are ready for autopilot 1.4
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
Christopher Lee (veebers) wrote : | # |
Generally LGTM, I will complain about the mixing of whitespace/pep8 changes with functional changes though :-)
Also I see a couple of instances of replacing select_single with wait_select_single outright.
Chris Gagnon (chris.gagnon) wrote : | # |
The outright changing of select_single with wait was due to failing test.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Christopher Lee (veebers) wrote : | # |
Hi Chris, where do we stand with this? Are we able to proceed any further?
Chris Gagnon (chris.gagnon) wrote : | # |
This was failing due to a ui-toolkit emulator bug, It should be fixed now
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Dinko Osmankovic (dinko-metalac) wrote : | # |
It's still failing. Because of this, no other MP's are going to get through. Now, only 4 tests are failing and all of them are related to tab selection in autopilot. Any idea?
Chris Gagnon (chris.gagnon) wrote : | # |
There are bugs in the ui-toolkit for the tab bar, which is why this is failing:
https:/
https:/
https:/
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Nicholas Skaggs (nskaggs) wrote : | # |
Unmerged revisions
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2013-09-26 18:51:49 +0000 |
3 | +++ debian/control 2013-11-04 22:38:14 +0000 |
4 | @@ -24,7 +24,7 @@ |
5 | |
6 | Package: sudoku-app-autopilot |
7 | Architecture: all |
8 | -Depends: libautopilot-qt, |
9 | +Depends: libautopilot-qt (>= 1.4), |
10 | libqt5test5, |
11 | ubuntu-ui-toolkit-autopilot, |
12 | sudoku-app (= ${source:Version}) |
13 | |
14 | === modified file 'tests/autopilot/sudoku_app/emulators.py' |
15 | --- tests/autopilot/sudoku_app/emulators.py 2013-09-26 22:30:52 +0000 |
16 | +++ tests/autopilot/sudoku_app/emulators.py 2013-11-04 22:38:14 +0000 |
17 | @@ -7,7 +7,6 @@ |
18 | |
19 | """Sudoku app autopilot emulators.""" |
20 | |
21 | -from autopilot.introspection.dbus import StateNotFoundError |
22 | from ubuntuuitoolkit import emulators as toolkit_emulators |
23 | |
24 | |
25 | @@ -24,26 +23,29 @@ |
26 | numberdialog = self.get_number_dialog() |
27 | |
28 | #SudokuDialogButton->QQuickText text = |
29 | - button = numberdialog.select_single("QQuickText",text=name) |
30 | + button = numberdialog.wait_select_single("QQuickText", text=name) |
31 | return button |
32 | |
33 | def get_number_dialog(self): |
34 | - return self.select_single("Dialog", objectName="picknumberscreen") |
35 | + return self.wait_select_single("Dialog", objectName="picknumberscreen") |
36 | |
37 | def get_hints_switch(self): |
38 | return self.select_single("CheckBox", objectName="hintsSwitch") |
39 | |
40 | - #clicking on this works instead on the previous one (get_hints_switch) it doesn't(but the previous |
41 | - #has the clicked property so I am using both |
42 | + #clicking on this works instead on the previous one (get_hints_switch) |
43 | + # it doesn't(but the previous has the clicked property so I am using both |
44 | def get_hints_switchClickable(self): |
45 | - return self.select_single("Standard", objectName="hintsSwitchClickable") |
46 | + return self.select_single("Standard", |
47 | + objectName="hintsSwitchClickable") |
48 | |
49 | def get_difficulty_selector(self): |
50 | - return self.select_single("ValueSelector", objectName="difficultySelector") |
51 | + return self.select_single("ValueSelector", |
52 | + objectName="difficultySelector") |
53 | |
54 | def get_difficulty_selector_labelvisual(self): |
55 | difficultylabelvisual = self.get_difficulty_selector() |
56 | - difficutlylabelvisualList = difficultylabelvisual.select_many("LabelVisual", visible="True") |
57 | + difficutlylabelvisualList = difficultylabelvisual.select_many( |
58 | + "LabelVisual", visible="True") |
59 | return difficutlylabelvisualList |
60 | |
61 | def get_theme_selector(self): |
62 | @@ -51,7 +53,8 @@ |
63 | |
64 | def get_theme_selector_labelvisual(self): |
65 | themelabelvisual = self.get_theme_selector() |
66 | - themelabelvisualList = themelabelvisual.select_many("LabelVisual", visible="True") |
67 | + themelabelvisualList = themelabelvisual.select_many("LabelVisual", |
68 | + visible="True") |
69 | return themelabelvisualList |
70 | |
71 | def get_current_profile(self): |
72 | @@ -67,88 +70,46 @@ |
73 | return self.select_single("SingleValue", objectName="Add profile") |
74 | |
75 | def get_add_profile_dialog(self): |
76 | - return self.select_single("Dialog", objectName="Add new profile") |
77 | + return self.select_single("Dialog", objectName="Add new profile") |
78 | |
79 | def get_add_profile_Lastname_field(self): |
80 | - return self.select_single("TextField", objectName = "Lastname") |
81 | + return self.select_single("TextField", objectName="Lastname") |
82 | |
83 | def get_add_profile_Firstname_field(self): |
84 | - return self.select_single("TextField", objectName = "Firstname") |
85 | + return self.select_single("TextField", objectName="Firstname") |
86 | |
87 | def get_add_profile_OKbutton(self): |
88 | - return self.select_single("SudokuDialogButton", objectName = "OKbutton") |
89 | + return self.select_single("SudokuDialogButton", objectName="OKbutton") |
90 | |
91 | def get_manage_profiles(self): |
92 | - return self.select_single("SingleValue", objectName = "Manage profiles") |
93 | + return self.select_single("SingleValue", objectName="Manage profiles") |
94 | |
95 | def get_Myfirstname_Mylastname_profile(self): |
96 | return self.select_single("Standard", text="Myfirstname Mylastname") |
97 | |
98 | def get_edit_profile_dialog(self): |
99 | - return self.select_single("Dialog", objectName="Edit profile") |
100 | + return self.select_single("Dialog", objectName="Edit profile") |
101 | |
102 | def get_edit_profile_delete_button(self): |
103 | - return self.select_single("SudokuDialogButton", objectName ="deleteButton") |
104 | + return self.select_single("SudokuDialogButton", |
105 | + objectName="deleteButton") |
106 | |
107 | def get_new_game_easy_button(self): |
108 | - return self.select_single("NewGameSelectionButton", objectName ="easyGameButton") |
109 | + return self.wait_select_single("NewGameSelectionButton", |
110 | + objectName="easyGameButton") |
111 | |
112 | def get_new_game_moderate_button(self): |
113 | - return self.select_single("NewGameSelectionButton", objectName ="moderateGameButton") |
114 | + return self.wait_select_single("NewGameSelectionButton", |
115 | + objectName="moderateGameButton") |
116 | |
117 | def get_new_game_hard_button(self): |
118 | - return self.select_single("NewGameSelectionButton", objectName ="hardGameButton") |
119 | + return self.wait_select_single("NewGameSelectionButton", |
120 | + objectName="hardGameButton") |
121 | |
122 | def get_new_game_ultrahard_button(self): |
123 | - return self.select_single("NewGameSelectionButton", objectName ="ultrahardGameButton") |
124 | + return self.wait_select_single("NewGameSelectionButton", |
125 | + objectName="ultrahardGameButton") |
126 | |
127 | def get_new_game_button(self, objectName): |
128 | - return self.select_single("NewGameSelectionButton", objectName = objectName) |
129 | - |
130 | - def try_OK_Button(self): |
131 | - try: |
132 | - return self.get_add_profile_OKbutton().buttonText |
133 | - except StateNotFoundError: |
134 | - return None |
135 | - |
136 | - def try_manage_profile(self): |
137 | - try: |
138 | - return self.get_manage_profiles().text |
139 | - except StateNotFoundError: |
140 | - return None |
141 | - |
142 | - def try_delete_Button(self): |
143 | - try: |
144 | - return self.get_edit_profile_delete_button().buttonText |
145 | - except StateNotFoundError: |
146 | - return None |
147 | - |
148 | - def try_new_game_easy_button(self): |
149 | - try: |
150 | - return self.get_new_game_easy_button().buttonText |
151 | - except StateNotFoundError: |
152 | - return None |
153 | - |
154 | - def try_new_game_moderate_button(self): |
155 | - try: |
156 | - return self.get_new_game_moderate_button().buttonText |
157 | - except StateNotFoundError: |
158 | - return None |
159 | - |
160 | - def try_new_game_hard_button(self): |
161 | - try: |
162 | - return self.get_new_game_hard_button().buttonText |
163 | - except StateNotFoundError: |
164 | - return None |
165 | - |
166 | - def try_new_game_ultrahard_button(self): |
167 | - try: |
168 | - return self.get_new_game_ultrahard_button().buttonText |
169 | - except StateNotFoundError: |
170 | - return None |
171 | - |
172 | - def try_my_profile(self): |
173 | - try: |
174 | - return self.get_Myfirstname_Mylastname_profile().text |
175 | - except StateNotFoundError: |
176 | - return None |
177 | + return self.wait_select_single("NewGameSelectionButton", |
178 | + objectName=objectName) |
179 | |
180 | === modified file 'tests/autopilot/sudoku_app/tests/__init__.py' |
181 | --- tests/autopilot/sudoku_app/tests/__init__.py 2013-10-09 19:44:20 +0000 |
182 | +++ tests/autopilot/sudoku_app/tests/__init__.py 2013-11-04 22:38:14 +0000 |
183 | @@ -16,7 +16,10 @@ |
184 | from autopilot.platform import model |
185 | from autopilot.testcase import AutopilotTestCase |
186 | |
187 | -from ubuntuuitoolkit import emulators as toolkit_emulators |
188 | +from ubuntuuitoolkit import ( |
189 | + base, |
190 | + emulators as toolkit_emulators, |
191 | +) |
192 | from sudoku_app import emulators |
193 | |
194 | logger = logging.getLogger(__name__) |
195 | @@ -55,14 +58,14 @@ |
196 | |
197 | def launch_test_local(self): |
198 | self.app = self.launch_test_application( |
199 | - "qmlscene", |
200 | + base.get_qmlscene_launch_command(), |
201 | self.local_location, |
202 | app_type='qt', |
203 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
204 | |
205 | def launch_test_installed(self): |
206 | self.app = self.launch_test_application( |
207 | - "qmlscene", |
208 | + base.get_qmlscene_launch_command(), |
209 | "/usr/share/sudoku-app/sudoku-app.qml", |
210 | "--desktop_file_hint=/usr/share/applications/sudoku-app.desktop", |
211 | app_type='qt', |
212 | |
213 | === modified file 'tests/autopilot/sudoku_app/tests/test_sudoku.py' |
214 | --- tests/autopilot/sudoku_app/tests/test_sudoku.py 2013-10-14 10:45:44 +0000 |
215 | +++ tests/autopilot/sudoku_app/tests/test_sudoku.py 2013-11-04 22:38:14 +0000 |
216 | @@ -8,13 +8,12 @@ |
217 | """Sudoku app autopilot tests.""" |
218 | |
219 | from __future__ import absolute_import |
220 | -import unittest |
221 | |
222 | from autopilot.matchers import Eventually |
223 | -from testtools.matchers import Equals, Contains, NotEquals, Not, Is |
224 | +from testtools.matchers import Equals, NotEquals |
225 | |
226 | from sudoku_app.tests import SudokuTestCase |
227 | -from time import sleep |
228 | + |
229 | |
230 | class TestMainWindow(SudokuTestCase): |
231 | |
232 | @@ -29,7 +28,8 @@ |
233 | gridButton = gridButtons[0] |
234 | |
235 | #create a value function to check later using id |
236 | - buttonValue = lambda: self.main_view.select_single("QQuickText",id=gridButton.id).text |
237 | + buttonValue = lambda: self.main_view.select_single( |
238 | + "QQuickText", id=gridButton.id).text |
239 | |
240 | #double check that it's blank |
241 | self.assertThat(buttonValue, Eventually(Equals(""))) |
242 | @@ -38,12 +38,10 @@ |
243 | self.pointing_device.click_object(gridButton) |
244 | |
245 | #assert that we can see the input screen |
246 | - inputScreen = lambda: self.main_view.get_number_dialog() |
247 | - self.assertThat(inputScreen, Eventually(NotEquals(None))) |
248 | + self.main_view.get_number_dialog() |
249 | |
250 | #set a value, choose 4 |
251 | dialogButton = self.main_view.get_dialog_button("4") |
252 | - self.assertThat(dialogButton, NotEquals(None)) |
253 | self.pointing_device.click_object(dialogButton) |
254 | |
255 | #check the value to ensure it worked |
256 | @@ -52,13 +50,11 @@ |
257 | #click the button |
258 | self.pointing_device.click_object(gridButton) |
259 | |
260 | - #assert that we can see the input screen |
261 | - inputScreen = lambda: self.main_view.get_number_dialog() |
262 | - self.assertThat(inputScreen, Eventually(NotEquals(None))) |
263 | + #make sure we can see the input screen |
264 | + self.main_view.get_number_dialog() |
265 | |
266 | #set a value, choose clear |
267 | dialogButton = self.main_view.get_dialog_button("Clear") |
268 | - self.assertThat(dialogButton, NotEquals(None)) |
269 | self.pointing_device.click_object(dialogButton) |
270 | |
271 | #check the value to ensure it worked |
272 | @@ -69,23 +65,27 @@ |
273 | self.main_view.switch_to_tab("highscoresTab") |
274 | |
275 | #make sure we are in the right place |
276 | - tabName = lambda: self.main_view.select_single("Tab", objectName="highscoresTab") |
277 | - self.assertThat(tabName, Eventually(NotEquals(None))) |
278 | + self.main_view.wait_select_single("Tab", objectName="highscoresTab") |
279 | |
280 | #click current user button |
281 | toolbar = self.main_view.open_toolbar() |
282 | toolbar.click_button("currentuserbutton") |
283 | |
284 | #check label |
285 | - label = lambda: self.main_view.select_single("Header", objectName="highscoreslabel").text |
286 | - self.assertThat(label, Eventually(NotEquals("<b>Best scores for all players</b>"))) |
287 | + label = lambda: self.main_view.wait_select_single( |
288 | + "Header", objectName="highscoreslabel").text |
289 | + self.assertThat( |
290 | + label, |
291 | + Eventually(NotEquals("<b>Best scores for all players</b>"))) |
292 | |
293 | #click all users button |
294 | toolbar = self.main_view.open_toolbar() |
295 | toolbar.click_button("allusersbutton") |
296 | |
297 | #check label again |
298 | - self.assertThat(label, Eventually(Equals("<b>Best scores for all players</b>"))) |
299 | + self.assertThat( |
300 | + label, |
301 | + Eventually(Equals("<b>Best scores for all players</b>"))) |
302 | |
303 | def test_enter_and_cancel(self): |
304 | #find the first button that has a blank value |
305 | @@ -93,7 +93,8 @@ |
306 | gridButton = gridButtons[0] |
307 | |
308 | #create a value function to check later using id |
309 | - buttonValue = lambda: self.main_view.select_single("QQuickText",id=gridButton.id).text |
310 | + buttonValue = lambda: self.main_view.select_single( |
311 | + "QQuickText", id=gridButton.id).text |
312 | |
313 | #double check that it's blank |
314 | self.assertThat(buttonValue, Eventually(Equals(""))) |
315 | @@ -101,13 +102,11 @@ |
316 | #click the button |
317 | self.pointing_device.click_object(gridButton) |
318 | |
319 | - #assert that we can see the input screen |
320 | - inputScreen = lambda: self.main_view.get_number_dialog() |
321 | - self.assertThat(inputScreen, Eventually(NotEquals(None))) |
322 | + #make that we can see the input screen |
323 | + self.main_view.get_number_dialog() |
324 | |
325 | #set a value, choose 4 |
326 | dialogButton = self.main_view.get_dialog_button("4") |
327 | - self.assertThat(dialogButton, NotEquals(None)) |
328 | self.pointing_device.click_object(dialogButton) |
329 | |
330 | #check the value to ensure it worked |
331 | @@ -116,13 +115,11 @@ |
332 | #click the button |
333 | self.pointing_device.click_object(gridButton) |
334 | |
335 | - #assert that we can see the input screen |
336 | - inputScreen = lambda: self.main_view.get_number_dialog() |
337 | - self.assertThat(inputScreen, Eventually(NotEquals(None))) |
338 | + #make sure that we can see the input screen |
339 | + self.main_view.get_number_dialog() |
340 | |
341 | #set a value, choose clear |
342 | dialogButton = self.main_view.get_dialog_button("Cancel") |
343 | - self.assertThat(dialogButton, NotEquals(None)) |
344 | self.pointing_device.click_object(dialogButton) |
345 | |
346 | #check the value to ensure it worked |
347 | @@ -130,7 +127,7 @@ |
348 | |
349 | def test_new_game_button(self): |
350 | #testing new game with moderate mode |
351 | - self._set_difficulty(3, "Moderate") |
352 | + self._set_difficulty(2, "Moderate") |
353 | self._verify_game_start() |
354 | |
355 | #testing new game with always ask |
356 | @@ -153,61 +150,64 @@ |
357 | self.main_view.switch_to_tab("aboutTab") |
358 | |
359 | #Check image loads |
360 | - aboutImage = lambda: self.main_view.select_single("QQuickImage", objectName="aboutImage").progress |
361 | + aboutImage = lambda: self.main_view.select_single( |
362 | + "QQuickImage", objectName="aboutImage").progress |
363 | self.assertThat(aboutImage, Eventually(Equals(1.0))) |
364 | |
365 | #Check the 'Author(s):' label is displayed |
366 | - aboutLabel = lambda: self.main_view.select_single("Label", objectName="authorLabel").text |
367 | + aboutLabel = lambda: self.main_view.select_single( |
368 | + "Label", objectName="authorLabel").text |
369 | self.assertThat(aboutLabel, Eventually(Equals("Author(s): "))) |
370 | |
371 | #Check the 'Contact:' label is displayed |
372 | - contactLabel = lambda: self.main_view.select_single("Label", objectName="contactLabel").text |
373 | + contactLabel = lambda: self.main_view.select_single( |
374 | + "Label", objectName="contactLabel").text |
375 | self.assertThat(contactLabel, Eventually(Equals("Contact: "))) |
376 | |
377 | #Check correct Launchpad URL: is displayed |
378 | - urlLabel = lambda: self.main_view.select_single("Label", objectName="urlLabel").text |
379 | + urlLabel = lambda: self.main_view.select_single( |
380 | + "Label", objectName="urlLabel").text |
381 | self.assertThat(urlLabel, Eventually(Equals( |
382 | - "<a href=\"https://launchpad.net/sudoku-app\">https://launchpad.net/sudoku-app</a>"))) |
383 | + '<a href="https://launchpad.net/sudoku-app">' |
384 | + 'https://launchpad.net/sudoku-app</a>'))) |
385 | |
386 | #Check the 'Version:' label is displayed |
387 | - versionLabel = lambda: self.main_view.select_single("Label", objectName="versionLabel").text |
388 | + versionLabel = lambda: self.main_view.select_single( |
389 | + "Label", objectName="versionLabel").text |
390 | self.assertThat(versionLabel, Eventually(Equals("Version: "))) |
391 | |
392 | #Check correct version is displayed |
393 | - version = lambda: self.main_view.select_single("Label", objectName="version").text |
394 | + version = lambda: self.main_view.select_single( |
395 | + "Label", objectName="version").text |
396 | self.assertThat(version, Eventually(Equals("1.0"))) |
397 | |
398 | #Check correct year is displayed |
399 | - yearLabel = lambda: self.main_view.select_single("Label", objectName="yearLabel").text |
400 | + yearLabel = lambda: self.main_view.select_single( |
401 | + "Label", objectName="yearLabel").text |
402 | self.assertThat(yearLabel, Eventually(Equals("2013"))) |
403 | |
404 | def test_hint_button(self): |
405 | #open settings tab |
406 | self.main_view.switch_to_tab("settingsTab") |
407 | |
408 | - #click on hints switch to enalbe hints toolbar button |
409 | - self.assertThat(self.main_view.get_hints_switchClickable, Eventually(Not(Is(None)))) |
410 | + #click on hints switch to enable hints toolbar button |
411 | hintsSwitchClickable = self.main_view.get_hints_switchClickable() |
412 | - self.assertThat(hintsSwitchClickable.text, Eventually(Equals("Hints"))) |
413 | |
414 | - #turn on (by clicking on it) hints switch if not already |
415 | - self.assertThat(self.main_view.get_hints_switch, Eventually(Not(Is(None)))) |
416 | - hintsSwitch = self.main_view.get_hints_switch() |
417 | - if hintsSwitch.checked == False: |
418 | - self.pointing_device.click_object(hintsSwitchClickable) |
419 | + self.pointing_device.click_object(hintsSwitchClickable) |
420 | |
421 | #verify hints switch is clicked |
422 | - self.assertThat(self.main_view.get_hints_switch().checked, Eventually(Equals(True))) |
423 | + self.assertThat(self.main_view.get_hints_switch().checked, |
424 | + Eventually(Equals(True))) |
425 | |
426 | # exit settings tab by clicking on sudoku tab |
427 | self.main_view.switch_to_tab("MainTab") |
428 | |
429 | - #click on hint button on tuolbar |
430 | + #click on hint button on toolbar |
431 | toolbar = self.main_view.open_toolbar() |
432 | toolbar.click_button("hintbutton") |
433 | - gridButtons = self.main_view.get_blank_inputs() |
434 | |
435 | - number_of_hints = lambda: self.main_view.select_single(objectName="blockgrid").numberOfHints |
436 | + number_of_hints = lambda: self.main_view.select_single( |
437 | + objectName="blockgrid").numberOfHints |
438 | self.assertThat(number_of_hints, Eventually(Equals(1))) |
439 | |
440 | def test_settings_tab(self): |
441 | @@ -216,116 +216,102 @@ |
442 | |
443 | #********check difficulty selector ******** |
444 | #click on difficulty selector |
445 | - self.assertThat(self.main_view.get_difficulty_selector, Eventually(Not(Is(None)))) |
446 | difficultySelector = self.main_view.get_difficulty_selector() |
447 | - self.assertThat(difficultySelector.text, Eventually(Equals("Default Difficulty"))) |
448 | + self.assertThat(difficultySelector.text, |
449 | + Eventually(Equals("Default Difficulty"))) |
450 | self.pointing_device.click_object(difficultySelector) |
451 | |
452 | #select "Moderate" choice of difficulty selector |
453 | - difficultyChoices = self.main_view.get_difficulty_selector_labelvisual() |
454 | - difficultyChoice = filter(lambda choice: choice.text == 'Moderate', difficultyChoices)[0] |
455 | - self.pointing_device.click_object(difficultyChoice) |
456 | - self.assertThat(lambda: self.main_view.get_difficulty_selector_labelvisual()[1].text, Eventually(Equals("Moderate"))) |
457 | + choices = self.main_view.get_difficulty_selector_labelvisual() |
458 | + choice_ = filter(lambda choice: choice.text == 'Moderate', choices)[0] |
459 | + self.pointing_device.click_object(choice_) |
460 | + self.assertThat( |
461 | + lambda: |
462 | + self.main_view.get_difficulty_selector_labelvisual()[0].text, |
463 | + Eventually(Equals("Moderate"))) |
464 | |
465 | #********check theme selector ******** |
466 | #click on theme selector |
467 | - self.assertThat(self.main_view.get_theme_selector, Eventually(Not(Is(None)))) |
468 | themeSelector = self.main_view.get_theme_selector() |
469 | self.assertThat(themeSelector.text, Eventually(Equals("Theme"))) |
470 | self.pointing_device.click_object(themeSelector) |
471 | |
472 | #select "Simple" choice of theme selector |
473 | - self.assertThat(self.main_view.get_theme_selector_labelvisual, Eventually(Not(Is(None)))) |
474 | themeChoices = self.main_view.get_theme_selector_labelvisual() |
475 | - themeChoice = filter(lambda choice: choice.text == 'Simple', themeChoices)[0] |
476 | + themeChoice = filter(lambda choice: choice.text == 'Simple', |
477 | + themeChoices)[0] |
478 | self.pointing_device.click_object(themeChoice) |
479 | - self.assertThat(lambda: self.main_view.get_theme_selector_labelvisual()[1].text, Eventually(Equals("Simple"))) |
480 | + self.assertThat( |
481 | + lambda: |
482 | + self.main_view.get_theme_selector_labelvisual()[1].text, |
483 | + Eventually(Equals("Simple"))) |
484 | |
485 | #******** check hint switch ******** |
486 | #select hints switch |
487 | - self.assertThat(self.main_view.get_hints_switchClickable, Eventually(Not(Is(None)))) |
488 | hintsSwitchClickable = self.main_view.get_hints_switchClickable() |
489 | self.assertThat(hintsSwitchClickable.text, Eventually(Equals("Hints"))) |
490 | - self.assertThat(self.main_view.get_hints_switch, Eventually(Not(Is(None)))) |
491 | hintsSwitch = self.main_view.get_hints_switch() |
492 | |
493 | #switch it on or off depending on it's state |
494 | - if hintsSwitch.checked == False: |
495 | - self.pointing_device.click_object(hintsSwitchClickable) |
496 | - self.assertThat(hintsSwitch.checked, Eventually(Equals(True))) |
497 | - else: |
498 | - self.pointing_device.click_object(hintsSwitchClickable) |
499 | - self.assertThat(hintsSwitch.checked, Eventually(Equals(False))) |
500 | + self.pointing_device.click_object(hintsSwitchClickable) |
501 | + self.assertThat(hintsSwitch.checked, Eventually(Equals(True))) |
502 | |
503 | #******** check profile settings ******** |
504 | #select current profile |
505 | - self.assertThat(self.main_view.get_current_profile, Eventually(Not(Is(None)))) |
506 | currentProfile = self.main_view.get_current_profile() |
507 | self.pointing_device.click_object(currentProfile) |
508 | |
509 | #let's change profile |
510 | #select "sudoku user" profile |
511 | - self.assertThat(self.main_view.get_sudoku_user_profile, Eventually(Not(Is(None)))) |
512 | sudokuUserProfile = self.main_view.get_sudoku_user_profile() |
513 | self.pointing_device.click_object(sudokuUserProfile) |
514 | |
515 | #verify changed profile |
516 | - self.assertThat(self.main_view.get_current_profile, Eventually(Not(Is(None)))) |
517 | currentProfile = self.main_view.get_current_profile() |
518 | self.assertThat(currentProfile.value, Equals("Sudoku User")) |
519 | |
520 | #let's add a user profile |
521 | #verify add profile page opens |
522 | - self.assertThat(self.main_view.get_add_profile, Eventually(Not(Is(None)))) |
523 | sudokuAddProfile = self.main_view.get_add_profile() |
524 | self.pointing_device.click_object(sudokuAddProfile) |
525 | |
526 | #insert Lastname |
527 | - self.assertThat(self.main_view.get_add_profile_Lastname_field, Eventually(Not(Is(None)))) |
528 | lastName = self.main_view.get_add_profile_Lastname_field() |
529 | self.pointing_device.click_object(lastName) |
530 | - self.assertThat(lastName.placeholderText, Eventually(Equals("Lastname"))) |
531 | + self.assertThat(lastName.placeholderText, |
532 | + Eventually(Equals("Lastname"))) |
533 | self.keyboard.type("Mylastname") |
534 | self.assertThat(lastName.text, Eventually(Equals("Mylastname"))) |
535 | |
536 | #insert Firstname |
537 | - self.assertThat(self.main_view.get_add_profile_Firstname_field, Eventually(Not(Is(None)))) |
538 | firstName = self.main_view.get_add_profile_Firstname_field() |
539 | self.pointing_device.click_object(firstName) |
540 | - self.assertThat(firstName.placeholderText, Eventually(Equals("Firstname"))) |
541 | + self.assertThat(firstName.placeholderText, |
542 | + Eventually(Equals("Firstname"))) |
543 | self.keyboard.type("Myfirstname") |
544 | self.assertThat(firstName.text, Eventually(Equals("Myfirstname"))) |
545 | |
546 | #click OK button |
547 | OKButton = self.main_view.get_add_profile_OKbutton() |
548 | - self.main_view.try_OK_Button() |
549 | self.assertThat(OKButton.buttonText, Eventually(Equals("OK"))) |
550 | self.pointing_device.click_object(OKButton) |
551 | |
552 | #******** check manage profiles ******** |
553 | #select manage profile |
554 | - self.assertThat(self.main_view.get_manage_profiles, Eventually(Not(Is(None)))) |
555 | manageProfile = self.main_view.get_manage_profiles() |
556 | - self.main_view.try_manage_profile() |
557 | self.pointing_device.click_object(manageProfile) |
558 | |
559 | #click on the new profile just added |
560 | - timeout = 0 |
561 | - myProfile = self.main_view.get_Myfirstname_Mylastname_profile() |
562 | - while myProfile == None and timeout < 10: |
563 | - timeout += 1 |
564 | - manageProfile = self.main_view.get_manage_profiles() |
565 | - self.main_view.try_manage_profile() |
566 | - self.pointing_device.click_object(manageProfile) |
567 | + manageProfile = self.main_view.get_manage_profiles() |
568 | + self.pointing_device.click_object(manageProfile) |
569 | |
570 | - #self.assertThat(self.main_view.get_Myfirstname_Mylastname_profile, Eventually(Not(Is(None)))) |
571 | myProfile = self.main_view.get_Myfirstname_Mylastname_profile() |
572 | - self.assertThat(myProfile.text, Eventually(Equals("Myfirstname Mylastname"))) |
573 | + self.assertThat(myProfile.text, |
574 | + Eventually(Equals("Myfirstname Mylastname"))) |
575 | self.pointing_device.click_object(myProfile) |
576 | |
577 | #click on delete |
578 | deleteButton = self.main_view.get_edit_profile_delete_button() |
579 | - self.main_view.try_delete_Button() |
580 | self.assertThat(deleteButton.buttonText, Eventually(Equals("Delete"))) |
581 | self.pointing_device.click_object(deleteButton) |
582 | |
583 | @@ -336,12 +322,12 @@ |
584 | self.main_view.switch_to_tab("settingsTab") |
585 | difficultySelector = self.main_view.get_difficulty_selector() |
586 | self.pointing_device.click_object(difficultySelector) |
587 | - difficultyChoices = self.main_view.get_difficulty_selector_labelvisual() |
588 | - difficultyChoice = difficultyChoices[selection] |
589 | - self.assertThat(difficultyChoice.text, Eventually(Equals(label))) |
590 | - self.pointing_device.click_object(difficultyChoice) |
591 | + choices = self.main_view.get_difficulty_selector_labelvisual() |
592 | + self.pointing_device.click_object(choices[selection]) |
593 | + self.assertThat(choices[selection].text, |
594 | + Eventually(Equals(label))) |
595 | |
596 | - def _verify_game_start(self, askmode = False, button = None): |
597 | + def _verify_game_start(self, askmode=False, button=None): |
598 | #check the game starts properly (according to difficulty) |
599 | self.main_view.switch_to_tab("MainTab") |
600 | toolbar = self.main_view.open_toolbar() |
601 | @@ -350,19 +336,33 @@ |
602 | #if we're in ask mode, make sure we can grab all the buttons |
603 | #and click the proper button |
604 | if askmode: |
605 | - self.assertThat(self.main_view.get_new_game_easy_button().buttonText, Eventually(Equals("Easy"))) |
606 | - self.assertThat(self.main_view.get_new_game_moderate_button().buttonText, Eventually(Equals("Moderate"))) |
607 | - self.assertThat(self.main_view.get_new_game_hard_button().buttonText, Eventually(Equals("Hard"))) |
608 | - self.assertThat(self.main_view.get_new_game_ultrahard_button().buttonText, Eventually(Equals("Ultra\nHard"))) |
609 | - self.pointing_device.click_object(self.main_view.get_new_game_button(button)) |
610 | + self.assertThat( |
611 | + self.main_view.get_new_game_easy_button().buttonText, |
612 | + Eventually(Equals("Easy"))) |
613 | + self.assertThat( |
614 | + self.main_view.get_new_game_moderate_button().buttonText, |
615 | + Eventually(Equals("Moderate"))) |
616 | + self.assertThat( |
617 | + self.main_view.get_new_game_hard_button().buttonText, |
618 | + Eventually(Equals("Hard"))) |
619 | + self.assertThat( |
620 | + self.main_view.get_new_game_ultrahard_button().buttonText, |
621 | + Eventually(Equals("Ultra\nHard"))) |
622 | + self.pointing_device.click_object( |
623 | + self.main_view.get_new_game_button(button)) |
624 | |
625 | - number_of_hints = lambda: self.main_view.select_single(objectName="blockgrid").numberOfHints |
626 | - number_of_actions = lambda: self.main_view.select_single(objectName="blockgrid").numberOfActions |
627 | + number_of_hints = lambda: self.main_view.select_single( |
628 | + objectName="blockgrid").numberOfHints |
629 | + number_of_actions = lambda: self.main_view.select_single( |
630 | + objectName="blockgrid").numberOfActions |
631 | |
632 | self.assertThat(number_of_hints, Eventually(Equals(0))) |
633 | self.assertThat(number_of_actions, Eventually(Equals(0))) |
634 | |
635 | #verify clock is moving |
636 | - game_seconds = self.main_view.select_single(objectName="blockgrid").gameSeconds |
637 | - self.assertThat(self.main_view.select_single(objectName="blockgrid").gameSeconds, Eventually(NotEquals(game_seconds))) |
638 | + game_seconds = self.main_view.select_single( |
639 | + objectName="blockgrid").gameSeconds |
640 | + self.assertThat( |
641 | + self.main_view.select_single(objectName="blockgrid").gameSeconds, |
642 | + Eventually(NotEquals(game_seconds))) |
643 | self.main_view.close_toolbar() |
LGTM, but I'm a bit concerned that we're just calling wait_select_single everywhere now. I think we ought to only use this when the Qmlm tree is actually changing.