@@ -21,6 +21,7 @@ import MeeGo.QOfono 0.2
21import QMenuModel 0.1
21import QMenuModel 0.1
22import Ubuntu.Components 1.3
22import Ubuntu.Components 1.3
23import Ubuntu.SystemSettings.SecurityPrivacy 1.0
23import Ubuntu.SystemSettings.SecurityPrivacy 1.0
24+import Ubuntu.SystemSettings.TimeDate 1.0
24import Unity.Test 0.1 as UT
25import Unity.Test 0.1 as UT
25import Wizard 0.1
26import Wizard 0.1
26import "../../../qml/Wizard"
27import "../../../qml/Wizard"
@@ -39,7 +40,6 @@ Item {
40 id: wizard
41 id: wizard
41 anchors.fill: parent
42 anchors.fill: parent
42− background: Qt.resolvedUrl("../../../qml/graphics/phone_background.jpg")
44 Component.onDestruction: {
44 Component.onDestruction: {
45 wizardLoader.itemDestroyed = true;
45 wizardLoader.itemDestroyed = true;
@@ -51,7 +51,7 @@ Item {
51 SignalSpy {
51 SignalSpy {
52 id: updateSessionLanguageSpy
52 id: updateSessionLanguageSpy
53 target: System
53 target: System
54− signalName: "updateSessionLanguageCalled"
54+ signalName: "updateSessionLocaleCalled"
57 SignalSpy {
57 SignalSpy {
@@ -69,6 +69,11 @@ Item {
69 signalName: "activated"
69 signalName: "activated"
74+ signalName: "timeZoneChangedCalled"
72 function setup() {
77 function setup() {
73 AccountsService.hereEnabled = false;
78 AccountsService.hereEnabled = false;
74 AccountsService.hereLicensePath = Qt.resolvedUrl("licenses");
79 AccountsService.hereLicensePath = Qt.resolvedUrl("licenses");
@@ -82,6 +87,7 @@ Item {
82 setSecuritySpy.clear();
87 setSecuritySpy.clear();
83 activateLocationSpy.clear();
88 activateLocationSpy.clear();
84 activateGPSSpy.clear();
89 activateGPSSpy.clear();
86 ActionData.data = {
92 ActionData.data = {
87 "location-detection-enabled": {
93 "location-detection-enabled": {
@@ -96,7 +102,6 @@ Item {
98 Component.onCompleted: {
104 Component.onCompleted: {
99− theme.name = "Ubuntu.Components.Themes.SuruDark";
@@ -180,11 +185,6 @@ Item {
180 tap(findChild(page, "forwardButton"));
185 tap(findChild(page, "forwardButton"));
183− page = waitForPage("passwdPage");
184− if (name === page.objectName) return page;
185− tap(findChild(page, "passwdDelegate0"));
186− tap(findChild(page, "forwardButton"));
188 page = waitForPage("wifiPage");
188 page = waitForPage("wifiPage");
189 if (name === page.objectName) return page;
189 if (name === page.objectName) return page;
190 tap(findChild(page, "forwardButton"));
190 tap(findChild(page, "forwardButton"));
@@ -195,6 +195,24 @@ Item {
195 tap(findChild(page, "forwardButton"));
195 tap(findChild(page, "forwardButton"));
198+ page = waitForPage("tzPage");
199+ if (name === page.objectName) return page;
200+ var tzList = findChild(page, "tzList");
202+ waitForRendering(tzList);
203+ page.selectedTimeZone = "Pacific/Honolulu";
204+ tap(findChild(page, "forwardButton"));
206+ page = waitForPage("accountPage");
207+ if (name === page.objectName) return page;
208+ tap(findChild(page, "nameInput"));
209+ typeString("foobar");
210+ tap(findChild(page, "forwardButton"));
212+ page = waitForPage("passwdPage");
213+ if (name === page.objectName) return page;
214+ tap(findChild(page, "forwardButton"));
198 if (!skipReporting) {
216 if (!skipReporting) {
199 page = waitForPage("reportingPage");
217 page = waitForPage("reportingPage");
200 if (name === page.objectName) return page;
218 if (name === page.objectName) return page;
@@ -203,7 +221,8 @@ Item {
204 page = waitForPage("finishedPage");
222 page = waitForPage("finishedPage");
205 if (name === page.objectName) return page;
223 if (name === page.objectName) return page;
224+ waitUntilTransitionsEnd(page);
206− tap(findChild(page, "forwardButton"));
225+ tap(findChild(page, "finishButton"));
208 tryCompare(wizard, "shown", false);
227 tryCompare(wizard, "shown", false);
209 compare(name, null);
228 compare(name, null);
@@ -212,100 +231,43 @@ Item {
213 function test_languageChange() {
232 function test_languageChange() {
214 var page = goToPage("languagePage");
233 var page = goToPage("languagePage");
215− tap(findChild(page, "languageCombo"));
234+ tap(findChild(page, "languageDelegate1")); // should invoke "fr" lang
216− waitForRendering(findChild(page, "languageDelegate1"));
235+
218− // For some reason, the delegate *sometimes* (like 1 in 10 maybe)
219− // needs more time before it can process a tap() call. I can't
220− // find a rhyme or reason, its properties all seem the same in
221− // cases where it works and does not. This failure to receive a
222− // tap() call below does *not* happen when running in xvfb, so
223− // jenkins is unaffected (and we don't have to worry about 100 not
224− // being enough time in its slow environment). This wait() call is
225− // just to help local runs not trip up.
227− tap(findChild(page, "languageDelegate1"));
229− tryCompare(i18n, "language", "fr");
236+ tryCompare(i18n, "language", "fr_FR");
230 tap(findChild(page, "forwardButton"));
237 tap(findChild(page, "forwardButton"));
231 tryCompare(updateSessionLanguageSpy, "count", 1);
238 tryCompare(updateSessionLanguageSpy, "count", 1);
232− compare(updateSessionLanguageSpy.signalArguments[0][0], "fr");
239+ compare(updateSessionLanguageSpy.signalArguments[0][0], "fr_FR");
235 function test_languageNoChange() {
242 function test_languageNoChange() {
236− goToPage("simPage"); // one past language page
243+ var page = goToPage("languagePage");
244+ tap(findChild(page, "forwardButton"));
237 compare(updateSessionLanguageSpy.count, 0);
245 compare(updateSessionLanguageSpy.count, 0);
240 function test_simUnavailableSkip() {
248 function test_simUnavailableSkip() {
241 MockQOfono.available = false;
249 MockQOfono.available = false;
242− goToPage("passwdPage", true);
250+ goToPage("wifiPage", true);
245 function test_simNoModemsSkip() {
253 function test_simNoModemsSkip() {
246 MockQOfono.setModems([], [], []);
254 MockQOfono.setModems([], [], []);
247− goToPage("passwdPage", true);
255+ goToPage("wifiPage", true);
250 function test_simFirstSkip() {
258 function test_simFirstSkip() {
251 MockQOfono.setModems(["a", "b"], [true, false], []);
259 MockQOfono.setModems(["a", "b"], [true, false], []);
252− goToPage("passwdPage", true);
260+ goToPage("wifiPage", true);
255 function test_simSecondSkip() {
263 function test_simSecondSkip() {
256 MockQOfono.setModems(["a", "b"], [false, true], []);
264 MockQOfono.setModems(["a", "b"], [false, true], []);
257− goToPage("passwdPage", true);
265+ goToPage("wifiPage", true);
260 function test_simBothSkip() {
268 function test_simBothSkip() {
261 MockQOfono.setModems(["a", "b"], [true, true], []);
269 MockQOfono.setModems(["a", "b"], [true, true], []);
262− goToPage("passwdPage", true);
270+ goToPage("wifiPage", true);
265− function test_simWaitOnManagerAsync() {
266− MockQOfono.ready = false;
267− MockQOfono.setModems(["a"], [false], []);
269− // Go to SIM page, which will be waiting for skip to be valid
270− var page = goToPage("languagePage");
271− tap(findChild(page, "forwardButton"));
272− verifyPageIsBlocked("simPage");
274− // Now release QOfono from blocking the page
275− MockQOfono.ready = true;
277− waitForPage("simPage");
280− function test_simWaitOnCardAsync() {
281− MockQOfono.setModems(["a"], [false], [false]);
283− // Go to SIM page, which will be waiting for skip to be valid
284− var page = goToPage("languagePage");
285− tap(findChild(page, "forwardButton"));
286− verifyPageIsBlocked("simPage");
288− // Now release QOfono from blocking the page
289− MockQOfono.setModems(["a"], [false], [true]);
291− waitForPage("simPage");
294− function test_simWaitTimeout() {
295− MockQOfono.setModems(["a"], [false], [false]);
297− // Go to SIM page, which will be waiting for skip to be valid
298− var page = goToPage("languagePage");
299− tap(findChild(page, "forwardButton"));
300− verifyPageIsBlocked("simPage");
302− var timeout = findInvisibleChild(wizard, "timeout");
303− timeout.interval = 100; // reduce our delay
305− // Now just wait for timeout
306− compare(timeout.running, true);
307− waitForPage("passwdPage");
308− compare(timeout.running, false);
311 function enterPasscode(passcode) {
273 function enterPasscode(passcode) {
@@ -330,35 +292,44 @@ Item {
330 waitForPage("wifiPage"); // thus skipping passwdPage
292 waitForPage("wifiPage"); // thus skipping passwdPage
295+ function verifyAnimationsNotRunning(page) {
296+ var contentAnimation = findInvisibleChild(page, "contentAnimation");
297+ var secondaryAnimation = findInvisibleChild(page, "secondaryAnimation");
298+ tryCompare(contentAnimation, "running", false);
299+ tryCompare(secondaryAnimation, "running", false);
333 function test_passwdPasscode() {
302 function test_passwdPasscode() {
334 var page = goToPage("passwdPage");
303 var page = goToPage("passwdPage");
335−
304+ tap(findChild(page, "passwdDelegate1")); // passcode option
336 tap(findChild(page, "forwardButton"));
305 tap(findChild(page, "forwardButton"));
337− page = waitForPage("passwdSetPage");
306+ page = waitForPage("passcodeSetPage");
307+ verifyAnimationsNotRunning(page);
339 enterPasscode("1111");
309 enterPasscode("1111");
340− page = waitForPage("passwdConfirmPage");
310+ page = waitForPage("passcodeConfirmPage");
311+ verifyAnimationsNotRunning(page);
342− // make sure we go back to 'set' page not 'type' page
343 tap(findChild(page, "backButton"));
313 tap(findChild(page, "backButton"));
344− page = waitForPage("passwdSetPage");
314+ page = waitForPage("passcodeSetPage");
315+ verifyAnimationsNotRunning(page);
346 enterPasscode("1111");
317 enterPasscode("1111");
347− page = waitForPage("passwdConfirmPage");
318+ page = waitForPage("passcodeConfirmPage");
319+ verifyAnimationsNotRunning(page);
349 enterPasscode("1112");
321 enterPasscode("1112");
350 var error = findChild(page, "wrongNoticeLabel");
322 var error = findChild(page, "wrongNoticeLabel");
351 tryCompareFunction(function() { return error.text !== ""; }, true);
323 tryCompareFunction(function() { return error.text !== ""; }, true);
353 enterPasscode("1111");
325 enterPasscode("1111");
354− page = waitForPage("wifiPage");
356 // now finish up
327 // now finish up
357− tap(findChild(page, "forwardButton"));
358− page = waitForPage("locationPage");
328+ page = waitForPage("reportingPage");
359 tap(findChild(page, "forwardButton"));
329 tap(findChild(page, "forwardButton"));
360 page = waitForPage("finishedPage");
330 page = waitForPage("finishedPage");
331+ waitUntilTransitionsEnd(page);
361− tap(findChild(page, "forwardButton"));
332+ tap(findChild(page, "finishButton"));
363 tryCompare(setSecuritySpy, "count", 1);
334 tryCompare(setSecuritySpy, "count", 1);
364 compare(setSecuritySpy.signalArguments[0][0], "");
335 compare(setSecuritySpy.signalArguments[0][0], "");
@@ -368,96 +339,64 @@ Item {
369 function test_passwdPassphrase() {
340 function test_passwdPassphrase() {
370 var page = goToPage("passwdPage");
341 var page = goToPage("passwdPage");
371− tap(findChild(page, "passwdDelegate2"));
342+ tap(findChild(page, "passwdDelegate0")); // password option
373 tap(findChild(page, "forwardButton"));
343 tap(findChild(page, "forwardButton"));
374 page = waitForPage("passwdSetPage");
344 page = waitForPage("passwdSetPage");
346+ var passwdField = findChild(page, "passwordField");
347+ verify(passwdField);
349+ waitUntilTransitionsEnd(passwdField);
376 typeString("aaa");
350 typeString("aaa");
377 var continueButton = findChild(page, "forwardButton");
351 var continueButton = findChild(page, "forwardButton");
378− tryCompare(continueButton.item, "enabled", false);
352+ tryCompare(page, "passwordsMatching", false);
379− keyClick(Qt.Key_Enter);
353+
355+ waitUntilTransitionsEnd(passwdField);
356+ passwdField.selectAll(); // overwrite the text
357+ typeString("12345678");
358+ tryCompare(page, "passwordsMatching", false);
380− var error = findChild(page, "wrongNoticeLabel");
360+ var passwd2Field = findChild(page, "password2Field");
381− tryCompareFunction(function() { return error.text !== ""; }, true);
361+ tap(passwd2Field);
382−
362+ waitUntilTransitionsEnd(passwd2Field);
383− typeString("aaaa");
363+ typeString("12345678");
364+ tryCompare(continueButton, "enabled", true);
384 tap(continueButton);
365 tap(continueButton);
385− page = waitForPage("passwdConfirmPage");
387− // make sure we go back to 'set' page not 'type' page
388− var back = findChild(page, "backButton");
390− page = waitForPage("passwdSetPage");
393− keyClick(Qt.Key_Enter);
394− page = waitForPage("passwdConfirmPage");
396− continueButton = findChild(page, "forwardButton");
398− tryCompare(continueButton.item, "enabled", false);
399− keyClick(Qt.Key_Enter);
400− var error = findChild(page, "wrongNoticeLabel");
401− tryCompareFunction(function() { return error.text !== ""; }, true);
404− tap(continueButton);
405− page = waitForPage("wifiPage");
407 // now finish up
367 // now finish up
408− tap(findChild(page, "forwardButton"));
409− page = waitForPage("locationPage");
368+ page = waitForPage("reportingPage");
410 tap(findChild(page, "forwardButton"));
369 tap(findChild(page, "forwardButton"));
411 page = waitForPage("finishedPage");
370 page = waitForPage("finishedPage");
371+ waitUntilTransitionsEnd(page);
412− tap(findChild(page, "forwardButton"));
372+ tap(findChild(page, "finishButton"));
414 tryCompare(setSecuritySpy, "count", 1);
374 tryCompare(setSecuritySpy, "count", 1);
415 compare(setSecuritySpy.signalArguments[0][0], "");
375 compare(setSecuritySpy.signalArguments[0][0], "");
416− compare(setSecuritySpy.signalArguments[0][1], "aaaa");
376+ compare(setSecuritySpy.signalArguments[0][1], "12345678");
417 compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Passphrase);
377 compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Passphrase);
420 function test_passwdSwipe() {
380 function test_passwdSwipe() {
421− goToPage(null, false, false, true);
381+ var page = goToPage("passwdPage");
422−
382+ tap(findChild(page, "passwdDelegate2")); // swipe option
423− tryCompare(setSecuritySpy, "count", 1);
424− compare(setSecuritySpy.signalArguments[0][0], "");
425− compare(setSecuritySpy.signalArguments[0][1], "");
426− compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Swipe);
429− function test_locationSkipNoPath() {
430− AccountsService.hereLicensePath = "";
431− goToPage("finishedPage", false, true, true);
434− function test_locationSkipNoFiles() {
435− AccountsService.hereLicensePath = Qt.resolvedUrl("nolicenses");
436− goToPage("finishedPage", false, true, true);
439− function test_locationWaitOnPath() {
440− AccountsService.hereLicensePath = " "; // means we're still getting the path from dbus
442− var page = goToPage("wifiPage");
444− var pages = findChild(wizard, "wizardPages");
384+ // now finish up
445− var stack = findChild(pages, "pageStack");
446 tap(findChild(page, "forwardButton"));
385 tap(findChild(page, "forwardButton"));
447− // don't simply call tryCompare here, because stack.currentPage will be swapped out itself
386+ page = waitForPage("reportingPage");
448− tryCompareFunction(function() { return stack.currentPage.objectName; }, "locationPage");
387+ tap(findChild(page, "forwardButton"));
449− compare(stack.currentPage.enabled, false);
388+ page = waitForPage("finishedPage");
450− compare(stack.currentPage.skipValid, false);
389+ waitUntilTransitionsEnd(page);
390+ tap(findChild(page, "finishButton"));
452− AccountsService.hereLicensePath = "";
392+ tryCompare(setSecuritySpy, "count", 0); // not called for swipe method
453− waitForPage("finishedPage", false, false, true);
456 function test_locationGpsOnly() {
395 function test_locationGpsOnly() {
457 var page = goToPage("locationPage");
396 var page = goToPage("locationPage");
458− var gpsCheck = findChild(page, "gpsCheck");
397+ var gpsCheck = findChild(page, "gpsCheckLabel");
459− var hereCheck = findChild(page, "hereCheck");
398+ var hereCheck = findChild(page, "hereCheckLabel");
460− var nopeCheck = findChild(page, "nopeCheck");
399+ var nopeCheck = findChild(page, "nopeCheckLabel");
462 var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
401 var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
463 activateLocationSpy.target = locationActionGroup.location;
402 activateLocationSpy.target = locationActionGroup.location;
@@ -476,9 +415,9 @@ Item {
477 function test_locationNope() {
416 function test_locationNope() {
478 var page = goToPage("locationPage");
417 var page = goToPage("locationPage");
479− var gpsCheck = findChild(page, "gpsCheck");
418+ var gpsCheck = findChild(page, "gpsCheckLabel");
480− var hereCheck = findChild(page, "hereCheck");
419+ var hereCheck = findChild(page, "hereCheckLabel");
481− var nopeCheck = findChild(page, "nopeCheck");
420+ var nopeCheck = findChild(page, "nopeCheckLabel");
483 var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
422 var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
484 activateLocationSpy.target = locationActionGroup.location;
423 activateLocationSpy.target = locationActionGroup.location;
@@ -491,15 +430,15 @@ Item {
492 tap(findChild(page, "forwardButton"));
431 tap(findChild(page, "forwardButton"));
493 tryCompare(AccountsService, "hereEnabled", false);
432 tryCompare(AccountsService, "hereEnabled", false);
494− tryCompare(activateLocationSpy, "count", 0)
433+ tryCompare(activateLocationSpy, "count", 0);
495− tryCompare(activateGPSSpy, "count", 0)
434+ tryCompare(activateGPSSpy, "count", 0);
498 function test_locationHere() {
437 function test_locationHere() {
499 var page = goToPage("locationPage");
438 var page = goToPage("locationPage");
500− var gpsCheck = findChild(page, "gpsCheck");
439+ var gpsCheck = findChild(page, "gpsCheckLabel");
501− var hereCheck = findChild(page, "hereCheck");
440+ var hereCheck = findChild(page, "hereCheckLabel");
502− var nopeCheck = findChild(page, "nopeCheck");
441+ var nopeCheck = findChild(page, "nopeCheckLabel");
504 var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
443 var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
505 activateLocationSpy.target = locationActionGroup.location;
444 activateLocationSpy.target = locationActionGroup.location;
@@ -512,68 +451,41 @@ Item {
513 tap(findChild(page, "forwardButton"));
452 tap(findChild(page, "forwardButton"));
514 tryCompare(AccountsService, "hereEnabled", true);
453 tryCompare(AccountsService, "hereEnabled", true);
515− tryCompare(activateLocationSpy, "count", 1)
454+ tryCompare(activateLocationSpy, "count", 1);
516− tryCompare(activateGPSSpy, "count", 1)
455+ tryCompare(activateGPSSpy, "count", 1);
519− function test_locationHereTerms() {
458+ function test_timezonePage() {
520− var page = goToPage("locationPage");
459+ var page = goToPage("tzPage");
522− var link = findChild(page, "hereTermsLink");
461+ timezoneSpy.target = page.tdModule;
524− // Test our language lookup code a bit
463+ var tzFilter = findChild(page, "tzFilter");
466+ typeString("London");
526− i18n.language = "fr_FR.UTF-8";
468+ var tzList = findChild(page, "tzList");
527− link.linkActivated("not-used");
469+ verify(tzList);
528− page = waitForPage("hereTermsPage");
529− tryCompare(findChild(page, "termsLabel"), "text", "fr_FR\n");
530− tap(findChild(page, "backButton"));
531− waitForPage("locationPage");
533− i18n.language = "fr_CA";
534− link.linkActivated("not-used");
535− page = waitForPage("hereTermsPage");
536− tryCompare(findChild(page, "termsLabel"), "text", "fr_CA\n");
537− tap(findChild(page, "backButton"));
538− waitForPage("locationPage");
540− i18n.language = "fr_US";
541− link.linkActivated("not-used");
542− page = waitForPage("hereTermsPage");
543− tryCompare(findChild(page, "termsLabel"), "text", "fr_FR\n");
544− tap(findChild(page, "backButton"));
545− waitForPage("locationPage");
547− i18n.language = "fr.utf8";
548− link.linkActivated("not-used");
549− page = waitForPage("hereTermsPage");
550− tryCompare(findChild(page, "termsLabel"), "text", "fr_FR\n");
551− tap(findChild(page, "backButton"));
552− waitForPage("locationPage");
554− i18n.language = "es"; // will not be found
555− link.linkActivated("not-used");
556− page = waitForPage("hereTermsPage");
557− tryCompare(findChild(page, "termsLabel"), "text", "en_US\n");
559− // OK, done with languages, back to actual page
471+ // test filtering works and returns some results
472+ tryCompareFunction(function() { return tzList.count > 0; }, true);
474+ // just tap the first one
561− var label = findChild(page, "termsLabel");
475+ tap(findChild(page, "tz0"));
562− label.linkActivated(Qt.resolvedUrl("licenses/en_US.html"));
563− tryCompare(label, "visible", false);
477+ // go next and verify the (mock) signal got fired
565− var webview = findChild(page, "webview");
478+ tap(findChild(page, "forwardButton"));
566− tryCompare(webview, "visible", true);
479+ tryCompare(timezoneSpy, "count", 1);
567− tryCompare(webview, "url", Qt.resolvedUrl("licenses/en_US.html"));
480+ tryCompare(page.tdModule, "timeZone", timezoneSpy.signalArguments[0][0]);
568− tryCompare(webview, "loadProgress", 100);
481+ }
570− tap(findChild(page, "backButton"));
483+ function test_accountPage() {
571− waitForPage("hereTermsPage"); // confirm we're on same page
484+ var page = goToPage("accountPage");
572− tryCompare(webview, "visible", false);
485+ var forwardButton = findChild(page, "forwardButton");
573− tryCompare(label, "visible", true);
575− tap(findChild(page, "backButton"));
487+ tap(findChild(page, "nameInput"));
576− waitForPage("locationPage");
488+ typeString("foobar");