@@ -211,6 +211,7 @@ Item {
211211 unlockAllModemsSpy.clear()
212212 LightDM.Greeter.authenticate(""); // reset greeter
213213 Wizard.System.wizardEnabled = false;
214+ AccountsService.demoEdges = false;
214215
215216 // reload our test subject to get it in a fresh state once again
216217 startShell();
@@ -751,6 +752,35 @@ Item {
751752 compare(unlockAllModemsSpy.count, 1);
752753 }
753754
755+ function test_wizardEarlyExit() {
756+ Wizard.System.wizardEnabled = true;
757+ AccountsService.demoEdges = true;
758+ var wizard = findChild(shell, "wizard");
759+ var tutorial = findChild(shell, "tutorial");
760+ tryCompare(wizard, "active", true);
761+ tryCompare(tutorial, "running", true);
762+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
763+
764+ // Make sure we stay running when nothing focused (can happen for
765+ // a moment when we restart the dash after switching language)
766+ ApplicationManager.stopApplication("unity8-dash");
767+ tryCompare(ApplicationManager, "focusedApplicationId", "");
768+ compare(wizard.shown, true);
769+ compare(tutorial.running, true);
770+
771+ // And make sure we stay running when dash focused again
772+ ApplicationManager.startApplication("unity8-dash");
773+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
774+ compare(wizard.shown, true);
775+ compare(tutorial.running, true);
776+
777+ // And make sure we stop when something else is focused
778+ ApplicationManager.startApplication("gallery-app");
779+ tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
780+ compare(wizard.shown, false);
781+ compare(tutorial.running, false);
782+ }
783+
754784 function test_tapOnRightEdgeReachesApplicationSurface() {
755785 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
756786 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;