@@ -581,7 +581,6 @@ Rectangle {
581581
582582 function test_loadSideStageByDraggingFromMainStage() {
583583 sideStage.showNow();
584− print("sidestage now shown. launching browser")
585584 var webbrowserSurfaceId = topSurfaceList.nextId;
586585 webbrowserCheckBox.checked = true;
587586 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -589,7 +588,7 @@ Rectangle {
589588 var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
590589 verify(appDelegate);
591590 waitForRendering(stage);
592− compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
591+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
593592
594593 dragToSideStage(webbrowserSurfaceId);
595594
@@ -599,6 +598,10 @@ Rectangle {
599598 function test_unloadSideStageByDraggingFromSideStage() {
600599 sideStage.showNow();
601600 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
601+ // WindowStateStorage is async... Lets wait for it to be fully processed...
602+ tryCompareFunction(function() {
603+ return WindowStateStorage.getStage(webbrowserCheckBox.appId, ApplicationInfoInterface.MainStage) === ApplicationInfoInterface.SideStage
604+ }, true);
602605 var webbrowserSurfaceId = topSurfaceList.nextId;
603606 webbrowserCheckBox.checked = true;
604607 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -606,7 +609,7 @@ Rectangle {
606609 var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
607610 verify(appDelegate);
608611 waitForRendering(stage);
609− compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
612+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
610613
611614 dragToMainStage(webbrowserSurfaceId);
612615