New FlickerTests: Start app warm and cold at both 0 and 90 degrees

Test: atest OpenAppColdTest OpenAppWarmTest
Change-Id: I1ea7377a07938b583c537b3db2da7bd5a3fc0ae1
This commit is contained in:
Nataniel Borges
2019-09-23 17:34:14 +02:00
parent 4bfe816030
commit d051c3b767
4 changed files with 50 additions and 98 deletions

View File

@@ -74,13 +74,16 @@ class CommonTransitions {
} }
static TransitionBuilder openAppWarm(IAppHelper testApp, UiDevice static TransitionBuilder openAppWarm(IAppHelper testApp, UiDevice
device) { device, int beginRotation) {
return TransitionRunner.newBuilder() return TransitionRunner.newBuilder()
.withTag("OpenAppWarm_" + testApp.getLauncherName()) .withTag("OpenAppWarm_" + testApp.getLauncherName()
+ rotationToString(beginRotation))
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBeforeAll(() -> setRotation(device, beginRotation))
.runBeforeAll(testApp::open) .runBeforeAll(testApp::open)
.runBefore(device::pressHome) .runBefore(device::pressHome)
.runBefore(device::waitForIdle) .runBefore(device::waitForIdle)
.runBefore(() -> setRotation(device, beginRotation))
.run(testApp::open) .run(testApp::open)
.runAfterAll(testApp::exit) .runAfterAll(testApp::exit)
.runAfterAll(AutomationUtils::setDefaultWait) .runAfterAll(AutomationUtils::setDefaultWait)
@@ -115,16 +118,19 @@ class CommonTransitions {
.repeat(ITERATIONS); .repeat(ITERATIONS);
} }
static TransitionBuilder getOpenAppCold(IAppHelper testApp, static TransitionBuilder openAppCold(IAppHelper testApp,
UiDevice device) { UiDevice device, int beginRotation) {
return TransitionRunner.newBuilder() return TransitionRunner.newBuilder()
.withTag("OpenAppCold_" + testApp.getLauncherName()) .withTag("OpenAppCold_" + testApp.getLauncherName()
+ rotationToString(beginRotation))
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome) .runBefore(device::pressHome)
.runBeforeAll(() -> setRotation(device, beginRotation))
.runBefore(testApp::exit) .runBefore(testApp::exit)
.runBefore(device::waitForIdle) .runBefore(device::waitForIdle)
.run(testApp::open) .run(testApp::open)
.runAfterAll(testApp::exit) .runAfterAll(testApp::exit)
.runAfterAll(() -> setRotation(device, Surface.ROTATION_0))
.repeat(ITERATIONS); .repeat(ITERATIONS);
} }

View File

@@ -47,23 +47,25 @@ public class DebugTest {
private UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); private UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
/** /**
* atest FlickerTest:DebugTests#openAppCold * atest FlickerTests:DebugTest#openAppCold
*/ */
@Test @Test
public void openAppCold() { public void openAppCold() {
CommonTransitions.getOpenAppCold(testApp, uiDevice).recordAllRuns().build().run(); CommonTransitions.openAppCold(testApp, uiDevice, Surface.ROTATION_0)
.recordAllRuns().build().run();
} }
/** /**
* atest FlickerTest:DebugTests#openAppWarm * atest FlickerTests:DebugTest#openAppWarm
*/ */
@Test @Test
public void openAppWarm() { public void openAppWarm() {
CommonTransitions.openAppWarm(testApp, uiDevice).recordAllRuns().build().run(); CommonTransitions.openAppWarm(testApp, uiDevice, Surface.ROTATION_0)
.recordAllRuns().build().run();
} }
/** /**
* atest FlickerTest:DebugTests#changeOrientationFromNaturalToLeft * atest FlickerTests:DebugTest#changeOrientationFromNaturalToLeft
*/ */
@Test @Test
public void changeOrientationFromNaturalToLeft() { public void changeOrientationFromNaturalToLeft() {
@@ -72,7 +74,7 @@ public class DebugTest {
} }
/** /**
* atest FlickerTest:DebugTests#closeAppWithBackKey * atest FlickerTests:DebugTest#closeAppWithBackKey
*/ */
@Test @Test
public void closeAppWithBackKey() { public void closeAppWithBackKey() {
@@ -80,7 +82,7 @@ public class DebugTest {
} }
/** /**
* atest FlickerTest:DebugTests#closeAppWithHomeKey * atest FlickerTests:DebugTest#closeAppWithHomeKey
*/ */
@Test @Test
public void closeAppWithHomeKey() { public void closeAppWithHomeKey() {
@@ -88,7 +90,7 @@ public class DebugTest {
} }
/** /**
* atest FlickerTest:DebugTests#openAppToSplitScreen * atest FlickerTests:DebugTest#openAppToSplitScreen
*/ */
@Test @Test
public void openAppToSplitScreen() { public void openAppToSplitScreen() {
@@ -97,7 +99,7 @@ public class DebugTest {
} }
/** /**
* atest FlickerTest:DebugTests#splitScreenToLauncher * atest FlickerTests:DebugTest#splitScreenToLauncher
*/ */
@Test @Test
public void splitScreenToLauncher() { public void splitScreenToLauncher() {
@@ -107,7 +109,7 @@ public class DebugTest {
} }
/** /**
* atest FlickerTest:DebugTests#resizeSplitScreen * atest FlickerTests:DebugTest#resizeSplitScreen
*/ */
@Test @Test
public void resizeSplitScreen() { public void resizeSplitScreen() {
@@ -120,7 +122,7 @@ public class DebugTest {
// IME tests // IME tests
/** /**
* atest FlickerTest:DebugTests#editTextSetFocus * atest FlickerTests:DebugTest#editTextSetFocus
*/ */
@Test @Test
public void editTextSetFocus() { public void editTextSetFocus() {
@@ -131,7 +133,7 @@ public class DebugTest {
} }
/** /**
* atest FlickerTest:DebugTests#editTextLoseFocusToHome * atest FlickerTests:DebugTest#editTextLoseFocusToHome
*/ */
@Test @Test
public void editTextLoseFocusToHome() { public void editTextLoseFocusToHome() {
@@ -142,7 +144,7 @@ public class DebugTest {
} }
/** /**
* atest FlickerTest:DebugTests#editTextLoseFocusToApp * atest FlickerTests:DebugTest#editTextLoseFocusToApp
*/ */
@Test @Test
public void editTextLoseFocusToApp() { public void editTextLoseFocusToApp() {
@@ -155,7 +157,7 @@ public class DebugTest {
// PIP tests // PIP tests
/** /**
* atest FlickerTest:DebugTests#enterPipMode * atest FlickerTests:DebugTest#enterPipMode
*/ */
@Test @Test
public void enterPipMode() { public void enterPipMode() {
@@ -165,7 +167,7 @@ public class DebugTest {
} }
/** /**
* atest FlickerTest:DebugTests#exitPipModeToHome * atest FlickerTests:DebugTest#exitPipModeToHome
*/ */
@Test @Test
public void exitPipModeToHome() { public void exitPipModeToHome() {
@@ -175,7 +177,7 @@ public class DebugTest {
} }
/** /**
* atest FlickerTest:DebugTests#exitPipModeToApp * atest FlickerTests:DebugTest#exitPipModeToApp
*/ */
@Test @Test
public void exitPipModeToApp() { public void exitPipModeToApp() {

View File

@@ -16,14 +16,12 @@
package com.android.server.wm.flicker; package com.android.server.wm.flicker;
import static com.android.server.wm.flicker.CommonTransitions.getOpenAppCold; import static com.android.server.wm.flicker.CommonTransitions.openAppCold;
import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
import static com.android.server.wm.flicker.WmTraceSubject.assertThat; import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
import androidx.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry;
import androidx.test.filters.FlakyTest; import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest; import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Before; import org.junit.Before;
import org.junit.FixMethodOrder; import org.junit.FixMethodOrder;
@@ -31,36 +29,28 @@ import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters; import org.junit.runners.MethodSorters;
import org.junit.runners.Parameterized;
/** /**
* Test cold launch app from launcher. * Test cold launch app from launcher.
* To run this test: {@code atest FlickerTests:OpenAppColdTest} * To run this test: {@code atest FlickerTests:OpenAppColdTest}
*/ */
@LargeTest @LargeTest
@RunWith(AndroidJUnit4.class) @RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class OpenAppColdTest extends FlickerTestBase { public class OpenAppColdTest extends NonRotationTestBase {
public OpenAppColdTest(String beginRotationName, int beginRotation) {
super(beginRotationName, beginRotation);
public OpenAppColdTest() {
this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
"com.android.server.wm.flicker.testapp", "SimpleApp"); "com.android.server.wm.flicker.testapp", "SimpleApp");
} }
@Before @Before
public void runTransition() { public void runTransition() {
super.runTransition(getOpenAppCold(mTestApp, mUiDevice).build()); run(openAppCold(mTestApp, mUiDevice, mBeginRotation)
} .includeJankyRuns().build());
@Test
public void checkVisibility_navBarWindowIsAlwaysVisible() {
checkResults(result -> assertThat(result)
.showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
}
@Test
public void checkVisibility_statusBarWindowIsAlwaysVisible() {
checkResults(result -> assertThat(result)
.showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries());
} }
@Test @Test
@@ -72,6 +62,8 @@ public class OpenAppColdTest extends FlickerTestBase {
.forAllEntries()); .forAllEntries());
} }
@FlakyTest(bugId = 140855415)
@Ignore("Waiting bug feedback")
@Test @Test
public void checkZOrder_appWindowReplacesLauncherAsTopWindow() { public void checkZOrder_appWindowReplacesLauncherAsTopWindow() {
checkResults(result -> assertThat(result) checkResults(result -> assertThat(result)
@@ -82,26 +74,6 @@ public class OpenAppColdTest extends FlickerTestBase {
.forAllEntries()); .forAllEntries());
} }
@Test
@FlakyTest(bugId = 141235985)
@Ignore("Waiting bug feedback")
public void checkCoveredRegion_noUncoveredRegions() {
checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
getDisplayBounds()).forAllEntries());
}
@Test
public void checkVisibility_navBarLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
.showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
}
@Test
public void checkVisibility_statusBarLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
.showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries());
}
@Test @Test
public void checkVisibility_wallpaperLayerBecomesInvisible() { public void checkVisibility_wallpaperLayerBecomesInvisible() {
checkResults(result -> LayersTraceSubject.assertThat(result) checkResults(result -> LayersTraceSubject.assertThat(result)

View File

@@ -17,13 +17,11 @@
package com.android.server.wm.flicker; package com.android.server.wm.flicker;
import static com.android.server.wm.flicker.CommonTransitions.openAppWarm; import static com.android.server.wm.flicker.CommonTransitions.openAppWarm;
import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
import static com.android.server.wm.flicker.WmTraceSubject.assertThat; import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
import androidx.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry;
import androidx.test.filters.FlakyTest; import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest; import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Before; import org.junit.Before;
import org.junit.FixMethodOrder; import org.junit.FixMethodOrder;
@@ -31,36 +29,28 @@ import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters; import org.junit.runners.MethodSorters;
import org.junit.runners.Parameterized;
/** /**
* Test warm launch app. * Test warm launch app.
* To run this test: {@code atest FlickerTests:OpenAppWarmTest} * To run this test: {@code atest FlickerTests:OpenAppWarmTest}
*/ */
@LargeTest @LargeTest
@RunWith(AndroidJUnit4.class) @RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class OpenAppWarmTest extends FlickerTestBase { public class OpenAppWarmTest extends NonRotationTestBase {
public OpenAppWarmTest(String beginRotationName, int beginRotation) {
super(beginRotationName, beginRotation);
public OpenAppWarmTest() {
this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
"com.android.server.wm.flicker.testapp", "SimpleApp"); "com.android.server.wm.flicker.testapp", "SimpleApp");
} }
@Before @Before
public void runTransition() { public void runTransition() {
super.runTransition(openAppWarm(mTestApp, mUiDevice).includeJankyRuns().build()); super.runTransition(openAppWarm(mTestApp, mUiDevice, mBeginRotation)
} .includeJankyRuns().build());
@Test
public void checkVisibility_navBarIsAlwaysVisible() {
checkResults(result -> assertThat(result)
.showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
}
@Test
public void checkVisibility_statusBarIsAlwaysVisible() {
checkResults(result -> assertThat(result)
.showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries());
} }
@Test @Test
@@ -72,6 +62,8 @@ public class OpenAppWarmTest extends FlickerTestBase {
.forAllEntries()); .forAllEntries());
} }
@FlakyTest(bugId = 140855415)
@Ignore("Waiting bug feedback")
@Test @Test
public void checkZOrder_appWindowReplacesLauncherAsTopWindow() { public void checkZOrder_appWindowReplacesLauncherAsTopWindow() {
checkResults(result -> assertThat(result) checkResults(result -> assertThat(result)
@@ -82,26 +74,6 @@ public class OpenAppWarmTest extends FlickerTestBase {
.forAllEntries()); .forAllEntries());
} }
@FlakyTest(bugId = 141235985)
@Ignore("Waiting bug feedback")
@Test
public void checkCoveredRegion_noUncoveredRegions() {
checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
getDisplayBounds()).forAllEntries());
}
@Test
public void checkVisibility_navBarLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
.showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
}
@Test
public void checkVisibility_statusBarLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
.showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries());
}
@Test @Test
public void checkVisibility_wallpaperLayerBecomesInvisible() { public void checkVisibility_wallpaperLayerBecomesInvisible() {
checkResults(result -> LayersTraceSubject.assertThat(result) checkResults(result -> LayersTraceSubject.assertThat(result)