@@ -56,6 +56,18 @@ Item {
5656
5757 function initTestCase() {
5858 swipeAwayGreeter();
59+
60+ // Ensure DashHome is loaded before continuing
61+ var dashContentList = findChild(shell, "dashContentList");
62+ waitForRendering(dashContentList);
63+ var homeLoader = findChild(dashContentList, "home.scope loader");
64+ verify(homeLoader);
65+ tryCompareFunction(function() {return homeLoader.item !== undefined;}, true);
66+
67+ // FIXME: Desperate measure to ensure Jenkins has the scene graph fully loaded
68+ // before it calls the test functions (otherwise findChild calls will fail).
69+ // The code above just didn't solve it.
70+ wait(2000);
5971 }
6072
6173 function cleanup() {
@@ -233,6 +245,62 @@ Item {
233245 tryCompare(dash, "visible", false);
234246 }
235247
248+ /*
249+ Regression test for bug https://bugs.launchpad.net/touch-preview-images/+bug/1193419
250+
251+ When the user minimizes an application (left-edge swipe) he should always end up in the "Running Apps"
252+ category of the "Applications" scope view.
253+
254+ Steps:
255+ - go to apps lens
256+ - scroll to the bottom
257+ - reveal launcher and launch an app
258+ - perform long left edge swipe to go minimize the app and go back to the dash.
259+
260+ Expected Results
261+ - apps lens shown and Running Apps visible on screen
262+ */
263+ function test_minimizingAppTakesToRunningApps() {
264+ var dashApps = findChild(shell, "DashApps");
265+
266+ swipeUntilScopeViewIsReached(dashApps);
267+
268+ // swipe finger up until the running/recent apps section (which we assume
269+ // it's the first one) is as far from view as possible.
270+ // We also assume that DashApps is tall enough that it's scrollable
271+ var appsCategoryListView = findChild(dashApps, "categoryListView");
272+ while (!appsCategoryListView.atYEnd) {
273+ swipeUpFromCenter();
274+ tryCompare(appsCategoryListView, "moving", false);
275+ }
276+
277+ // Switch away from the Applications scope.
278+ swipeRightFromCenter();
279+ waitUntilItemStopsMoving(dashApps);
280+ verify(!itemIsOnScreen(dashApps));
281+
282+ dragLauncherIntoView();
283+
284+ // Launch an app from the launcher
285+ tapOnAppIconInLauncher();
286+
287+ waitUntilApplicationWindowIsFullyVisible();
288+
289+ // Minimize the application we just launched
290+ swipeFromLeftEdge();
291+
292+ // Wait for the whole UI to settle down
293+ waitUntilApplicationWindowIsFullyHidden();
294+ waitUntilItemStopsMoving(dashApps);
295+ tryCompare(appsCategoryListView, "moving", false);
296+
297+ verify(itemIsOnScreen(dashApps));
298+
299+ var runningApplicationsGrid = findChild(appsCategoryListView, "recent");
300+ verify(runningApplicationsGrid);
301+ verify(itemIsOnScreen(runningApplicationsGrid));
302+ }
303+
236304 // Wait for the whole UI to settle down
237305 function waitForUIToSettle() {
238306 waitUntilApplicationWindowIsFullyHidden();