@@ -553,7 +553,6 @@ Rectangle {
553553 when: windowShown
554554
555555 property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
556− property QtObject topLevelSurfaceList: null
557556
558557 function init() {
559558 if (shellLoader.active) {
@@ -592,10 +591,10 @@ Rectangle {
592591
593592 waitForGreeterToStabilize();
594593
594+ // from StageTestCase
595595 topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
596596 verify(topLevelSurfaceList);
597−
598− stage = findChild(shell, "stage"); // from StageTestCase
597+ stage = findChild(shell, "stage");
599598
600599 // wait until unity8-dash is fully loaded
601600 tryCompare(topLevelSurfaceList, "count", 1);
@@ -715,12 +714,9 @@ Rectangle {
715714 loadShell("phone");
716715 swipeAwayGreeter();
717716 var notifications = findChild(shell, "notificationList");
718− var appSurfaceId = topLevelSurfaceList.nextId;
719− var app = ApplicationManager.startApplication("camera-app");
720− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
721− var stage = findChild(shell, "stage")
717+ var appDelegate = startApplication("camera-app");
722718
723− var appSurface = app.surfaceList.get(0);
719+ var appSurface = appDelegate.surface;
724720 verify(appSurface);
725721
726722 tryCompare(appSurface, "activeFocus", true);
@@ -1047,10 +1043,8 @@ Rectangle {
10471043 function test_surfaceLosesActiveFocusWhilePanelIsOpen() {
10481044 loadShell("phone");
10491045 swipeAwayGreeter();
1050− var appSurfaceId = topLevelSurfaceList.nextId;
1051− var app = ApplicationManager.startApplication("dialer-app");
1052− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1053− var appSurface = app.surfaceList.get(0);
1046+ var appDelegate = startApplication("dialer-app");
1047+ var appSurface = appDelegate.surface;
10541048 verify(appSurface);
10551049
10561050 tryCompare(appSurface, "activeFocus", true);
@@ -1093,15 +1087,9 @@ Rectangle {
10931087 shell.usageScenario = data.usageScenario;
10941088 swipeAwayGreeter();
10951089
1096− var webAppSurfaceId = topLevelSurfaceList.nextId;
1097− var webApp = ApplicationManager.startApplication("webbrowser-app");
1098− verify(webApp);
1099− waitUntilAppWindowIsFullyLoaded(webAppSurfaceId);
1090+ var appDelegate = startApplication("webbrowser-app");
11001091
1101− var webAppSurface = webApp.surfaceList.get(topLevelSurfaceList.indexForId(webAppSurfaceId));
1102− verify(webAppSurface);
1103−
1104− tryCompare(webAppSurface, "activeFocus", true);
1092+ tryCompare(appDelegate.surface, "activeFocus", true);
11051093 }
11061094
11071095 function test_launchedAppKeepsActiveFocusOnUsageModeChange() {