Files
Flexera-Launcher/tests/src/com/android/launcher3/ui/AllAppsAppLaunchTest.java
T
Sunny Goyal 6d02c7a033 Adding some UI tests
> Launcher app from all-apps
> Drag icon to all-apps and launch it
> Add widget from widget tray

Change-Id: I6bd6128a7b560a23a887d1fb40bfcda25b9b02e7
2016-05-26 17:20:22 -07:00

53 lines
1.7 KiB
Java

package com.android.launcher3.ui;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
import android.test.suitebuilder.annotation.LargeTest;
import com.android.launcher3.compat.LauncherActivityInfoCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.UserHandleCompat;
import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait;
/**
* Test for verifying apps is launched from all-apps
*/
@LargeTest
public class AllAppsAppLaunchTest extends LauncherInstrumentationTestCase {
private LauncherActivityInfoCompat mSettingsApp;
@Override
protected void setUp() throws Exception {
super.setUp();
mSettingsApp = LauncherAppsCompat.getInstance(mTargetContext)
.getActivityList("com.android.settings", UserHandleCompat.myUserHandle()).get(0);
}
public void testAppLauncher_portrait() throws Exception {
lockRotation(true);
performTest();
}
public void testAppLauncher_landscape() throws Exception {
lockRotation(false);
performTest();
}
private void performTest() throws Exception {
startLauncher();
// Open all apps and wait for load complete
final UiObject2 appsContainer = openAllApps();
assertTrue(Wait.atMost(Condition.minChildCount(appsContainer, 2), DEFAULT_UI_TIMEOUT));
// Open settings app and verify app launched
scrollAndFind(appsContainer, By.text(mSettingsApp.getLabel().toString())).click();
assertTrue(mDevice.wait(Until.hasObject(By.pkg(
mSettingsApp.getComponentName().getPackageName()).depth(0)), DEFAULT_UI_TIMEOUT));
}
}