on xenial help sign in
fix test flakiness
0db7ccbMichael Zanetti
qml/Stage/Stage.qml+6
@@ -264,6 +264,12 @@ FocusScope {
264
264
265 for (var i = 0; i < appRepeater.count && (!choseMainStage || !choseSideStage); ++i) {
265 for (var i = 0; i < appRepeater.count && (!choseMainStage || !choseSideStage); ++i) {
266 var appDelegate = appRepeater.itemAt(i);
266 var appDelegate = appRepeater.itemAt(i);
267+ if (!appDelegate) {
268+ // This might happen during startup phase... If the delegate appears and claims focus
269+ // things are updated and appRepeater.itemAt(x) still returns null while appRepeater.count >= x
270+ // Lets just skip it, on startup it will be generated at a later point too...
271+ continue;
272+ }
267 if (sideStage.shown && appDelegate.stage == ApplicationInfoInterface.SideStage
273 if (sideStage.shown && appDelegate.stage == ApplicationInfoInterface.SideStage
268 && !choseSideStage) {
274 && !choseSideStage) {
269 priv.sideStageDelegate = appDelegate
275 priv.sideStageDelegate = appDelegate
tests/qmltests/Stage/tst_PhoneStage.qml+5
@@ -156,6 +156,11 @@ Item {
156 true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
156 true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
157
157
158 tryCompare(stage, "state", "spread");
158 tryCompare(stage, "state", "spread");
159+ // Make sure all the transitions have finished
160+ var appRepeater = findChild(stage, "appRepeater");
161+ for (var i = 0; i < appRepeater.count; i++) {
162+ waitUntilTransitionsEnd(appRepeater.itemAt(i));
163+ }
159 waitForRendering(stage);
164 waitForRendering(stage);
160 }
165 }
161
166
tests/qmltests/Stage/tst_TabletStage.qml+6−3
@@ -581,7 +581,6 @@ Rectangle {
581
581
582 function test_loadSideStageByDraggingFromMainStage() {
582 function test_loadSideStageByDraggingFromMainStage() {
583 sideStage.showNow();
583 sideStage.showNow();
584− print("sidestage now shown. launching browser")
585 var webbrowserSurfaceId = topSurfaceList.nextId;
584 var webbrowserSurfaceId = topSurfaceList.nextId;
586 webbrowserCheckBox.checked = true;
585 webbrowserCheckBox.checked = true;
587 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
586 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -589,7 +588,7 @@ Rectangle {
589 var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
588 var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
590 verify(appDelegate);
589 verify(appDelegate);
591 waitForRendering(stage);
590 waitForRendering(stage);
592− compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
591+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
593
592
594 dragToSideStage(webbrowserSurfaceId);
593 dragToSideStage(webbrowserSurfaceId);
595
594
@@ -599,6 +598,10 @@ Rectangle {
599 function test_unloadSideStageByDraggingFromSideStage() {
598 function test_unloadSideStageByDraggingFromSideStage() {
600 sideStage.showNow();
599 sideStage.showNow();
601 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
600 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);
602 var webbrowserSurfaceId = topSurfaceList.nextId;
605 var webbrowserSurfaceId = topSurfaceList.nextId;
603 webbrowserCheckBox.checked = true;
606 webbrowserCheckBox.checked = true;
604 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
607 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -606,7 +609,7 @@ Rectangle {
606 var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
609 var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
607 verify(appDelegate);
610 verify(appDelegate);
608 waitForRendering(stage);
611 waitForRendering(stage);
609− compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
612+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
610
613
611 dragToMainStage(webbrowserSurfaceId);
614 dragToMainStage(webbrowserSurfaceId);
612
615