on xenial help sign in
Better check for the Drawer's readiness

The Drawer tests were able to continue running before they had fully extended the Drawer. Use the Drawer's fullyOpen property to make sure that doesn't happen.

commitf5b4abd1d4b690ade791d779ee6acd6adeab929d authorDalton Durst <dalton@ubports.com> dateMon 27 May 2019, 10:12 (7 years ago) parent08b0e83
1 file changed+13−23
tests/qmltests/Launcher/tst_Drawer.qml+13−23
tests/qmltests/Launcher/tst_Drawer.qml+13−23
@@ -109,17 +109,10 @@ StyledItem {
109109 tryCompareFunction( function(){ return drawer.x === 0; }, true );
110110 tryCompare(launcher, "state", "drawer");
111111 tryCompare(launcher, "drawerShown", true);
112+ tryCompare(drawer, "fullyOpen", true);
112113 return drawer;
113114 }
114115
115− function openDrawerAndWait() {
116− // Open the drawer by directly calling on the Launcher, then wait for it to animate in
117− launcher.toggleDrawer(true);
118− waitForRendering(launcher);
119− waitUntilTransitionsEnd(launcher);
120− return findChild(launcher, "drawer");
121− }
122−
123116 function revealByEdgePush() {
124117 // Place the mouse against the window/screen edge and push beyond the barrier threshold
125118 // If the mouse did not move between two revealByEdgePush(), we need it to move out the
@@ -247,7 +240,7 @@ StyledItem {
247240 typeString("cam");
248241 keyClick(Qt.Key_Enter);
249242
250− compare(launcher.lastSelectedApplication, "camera-app");
243+ tryCompare(launcher, "lastSelectedApplication", "camera-app");
251244 waitForRendering(launcher);
252245 tryCompare(launcher, "drawerShown", false);
253246 }
@@ -281,25 +274,22 @@ StyledItem {
281274 tryCompareFunction(function() { return !!searchField }, true);
282275 tryCompare(searchField, "selectedText", searchField.displayText);
283276 typeString("cam");
284− tryCompareFunction(function() { return searchField.displayText }, "cam");
277+ tryCompare(searchField, "displayText", "cam");
285278
286279 // Try again to make sure it cleaned and everything
287280 keyClick(Qt.Key_Escape);
288− waitForRendering(launcher);
289− waitUntilTransitionsEnd(launcher);
290− launcher.toggleDrawer(true);
291− waitForRendering(launcher);
292− waitUntilTransitionsEnd(launcher);
281+ tryCompare(drawer, "fullyClosed", true);
282+ dragDrawerIntoView();
293283
294− tryCompare(searchField, "selectedText", searchField.displayText);
284+ tryCompare(searchField, "displayText", "");
295285 typeString("terminal");
296− tryCompareFunction(function() { return searchField.displayText }, "terminal");
286+ tryCompare(searchField, "displayText", "terminal");
297287
298288 }
299289
300290 function test_kbdSearch() {
301291 // Try out the keyboard navigation for the search field
302− var drawer = openDrawerAndWait();
292+ var drawer = dragDrawerIntoView();
303293 var searchField = findChild(drawer, "searchField");
304294
305295 tryCompare(searchField, "focus", false);
@@ -309,13 +299,13 @@ StyledItem {
309299 tryCompare(searchField, "focus", false);
310300
311301 // Make sure the focus doesn't get put back when reopening
312− openDrawerAndWait();
302+ dragDrawerIntoView();
313303 tryCompare(searchField, "focus", false);
314304 }
315305
316306 function test_kbdGrid() {
317307 // Try out the keyboard navigation around the grid
318− var drawer = openDrawerAndWait();
308+ var drawer = dragDrawerIntoView();
319309 var searchField = findChild(drawer, "searchField");
320310 var appList = findChild(drawer, "drawerAppList");
321311
@@ -337,7 +327,7 @@ StyledItem {
337327
338328 function test_kbdFocusMoves() {
339329 // Make sure keyboard focus can move between the search field and grid
340− var drawer = openDrawerAndWait();
330+ var drawer = dragDrawerIntoView();
341331 var searchField = findChild(drawer, "searchField");
342332 var appList = findChild(drawer, "drawerAppList");
343333
@@ -354,7 +344,7 @@ StyledItem {
354344 }
355345
356346 function test_focusAppFromLauncherWhileDrawerIsOpen() {
357− openDrawerAndWait();
347+ dragDrawerIntoView();
358348 var appIcon = findChild(launcher, "launcherDelegate4")
359349
360350 mouseMove(appIcon, appIcon.width / 2, appIcon.height / 2);
@@ -385,7 +375,7 @@ StyledItem {
385375 }
386376
387377 function test_closeWhileDragging() {
388− var drawer = openDrawerAndWait();
378+ var drawer = dragDrawerIntoView();
389379 var handle = findChild(drawer, "drawerHandle");
390380 tryCompare(drawer.anchors, "rightMargin", -drawer.width);
391381