Move tests from tests/app/ to tests/unit/
- second round, move all remaining items - removed SoundSettingsIntegrationTest and DashboardAdapterTest as they are obsolete. Fixes: 62103184 Test: make SettingsUnitTests Change-Id: Idc2eeb285acd209ef2d00c5451fff697002e1734
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package com.android.settings.notification;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.support.test.uiautomator.UiDevice;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class ZenModeSettingsIntegrationTest {
|
||||
private static final String WM_DISMISS_KEYGUARD_COMMAND = "wm dismiss-keyguard";
|
||||
|
||||
private Context mContext;
|
||||
private UiDevice mUiDevice;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mContext = InstrumentationRegistry.getTargetContext();
|
||||
mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
|
||||
mUiDevice.wakeUp();
|
||||
mUiDevice.executeShellCommand(WM_DISMISS_KEYGUARD_COMMAND);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutomaticRulesAppear() {
|
||||
launchZenSettings();
|
||||
onView(withText("Automatic rules")).check(matches(isDisplayed()));
|
||||
onView(withText("Weekend")).check(matches(isDisplayed()));
|
||||
onView(withText("Add more")).check(matches(isDisplayed())).perform(click());
|
||||
onView(withText("Choose rule type")).check(matches(isDisplayed()));
|
||||
}
|
||||
|
||||
private void launchZenSettings() {
|
||||
Intent settingsIntent = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS)
|
||||
.setPackage(mContext.getPackageName())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(settingsIntent);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user