Converting even more tests to TAPL

Bug: 131116002
Bug: 115582915
Change-Id: Id36fca232b5aff5f6692142ce4a0c937d0531f4e
This commit is contained in:
vadimt
2019-06-26 13:40:42 -07:00
committed by Vadim Tryshev
parent 7926791fdb
commit 0b20a11d66
9 changed files with 62 additions and 202 deletions

View File

@@ -27,20 +27,18 @@ import android.view.View;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherAppWidgetProviderInfo;
import com.android.launcher3.Workspace;
import com.android.launcher3.tapl.Widgets;
import com.android.launcher3.testcomponent.WidgetConfigActivity;
import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.ui.TestViewHelpers;
import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.ShellCommandRule;
import com.android.launcher3.widget.WidgetCell;
import org.junit.Before;
import org.junit.Ignore;
@@ -71,7 +69,6 @@ public class AddConfigWidgetTest extends AbstractLauncherUiTest {
}
@Test
// Convert test to TAPL b/131116002
public void testWidgetConfig() throws Throwable {
runTest(false, true);
}
@@ -83,7 +80,6 @@ public class AddConfigWidgetTest extends AbstractLauncherUiTest {
}
@Test
// Convert test to TAPL b/131116002
public void testConfigCancelled() throws Throwable {
runTest(false, false);
}
@@ -104,15 +100,13 @@ public class AddConfigWidgetTest extends AbstractLauncherUiTest {
clearHomescreen();
mActivityMonitor.startLauncher();
// Open widget tray and wait for load complete.
final UiObject2 widgetContainer = TestViewHelpers.openWidgetsTray();
Wait.atMost(null, Condition.minChildCount(widgetContainer, 2), DEFAULT_UI_TIMEOUT);
final Widgets widgets = mLauncher.getWorkspace().openAllWidgets();
// Drag widget to homescreen
WidgetConfigStartupMonitor monitor = new WidgetConfigStartupMonitor();
UiObject2 widget = scrollAndFind(widgetContainer, By.clazz(WidgetCell.class)
.hasDescendant(By.text(mWidgetInfo.getLabel(mTargetContext.getPackageManager()))));
TestViewHelpers.dragToWorkspace(widget, false);
widgets.
getWidget(mWidgetInfo.getLabel(mTargetContext.getPackageManager())).
dragToWorkspace();
// Widget id for which the config activity was opened
mWidgetId = monitor.getWidgetId();