@@ -256,14 +256,6 @@ PanelTest {
256256
257257 PanelState.title = ""
258258
259− panel.indicators.hide();
260− // Wait for animation to complete
261− tryCompare(panel.indicators.hideAnimation, "running", false);
262−
263− panel.applicationMenus.hide();
264− // Wait for animation to complete
265− tryCompare(panel.applicationMenus.hideAnimation, "running", false);
266−
267259 // Wait for the indicators to get into position.
268260 // (switches between normal and fullscreen modes are animated)
269261 var panelArea = findChild(panel, "panelArea");
@@ -275,6 +267,12 @@ PanelTest {
275267 compare(windowControlButtonsSpy.valid, true);
276268 }
277269
270+ function cleanup() {
271+ panel.indicators.hide();
272+ panel.applicationMenus.hide();
273+ waitForAllAnimationToComplete("initial");
274+ }
275+
278276 function get_indicator_item(index) {
279277 var indicatorItem = findChild(panel, root.originalModelData[index]["identifier"]+"-panelItem");
280278 verify(indicatorItem !== null);
@@ -282,6 +280,25 @@ PanelTest {
282280 return indicatorItem;
283281 }
284282
283+ function waitForAllAnimationToComplete(state) {
284+
285+ tryCompare(panel.indicators.hideAnimation, "running", false);
286+ tryCompare(panel.indicators .showAnimation, "running", false);
287+ tryCompare(panel.indicators, "state", state);
288+
289+ for (var i = 0; i < root.originalModelData.length; i++) {
290+ var indicatorItem = get_indicator_item(i);
291+
292+ var itemState = findInvisibleChild(indicatorItem, "indicatorItemState");
293+ verify(itemState !== null);
294+
295+ waitUntilTransitionsEnd(itemState);
296+ }
297+
298+ tryCompare(panel.applicationMenus.hideAnimation, "running", false);
299+ tryCompare(panel.applicationMenus, "state", state);
300+ }
301+
285302 function pullDownIndicatorsMenu() {
286303 var showDragHandle = findChild(panel.indicators, "showDragHandle");
287304 touchFlick(showDragHandle,
@@ -340,7 +357,7 @@ PanelTest {
340357 touchFlick(panel,
341358 startXPosition, 0,
342359 startXPosition, panel.height,
343− true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
360+ true /* beginTouch */, false /* endTouch */, 1, 15);
344361
345362 // Indicators height should follow the drag, and therefore increase accordingly.
346363 // They should be at least half-way through the screen
@@ -355,8 +372,7 @@ PanelTest {
355372
356373 // init for next indicatorItem
357374 panel.indicators.hide();
358− tryCompare(panel.indicators.hideAnimation, "running", false);
359− tryCompare(panel.indicators, "state", "initial");
375+ waitForAllAnimationToComplete("initial");
360376 }
361377 }
362378