1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settings.fuelgauge; 18 19 import static android.support.test.espresso.Espresso.onView; 20 import static android.support.test.espresso.action.ViewActions.click; 21 import static android.support.test.espresso.matcher.ViewMatchers.withText; 22 23 import android.app.Instrumentation; 24 import android.content.Intent; 25 import android.support.test.InstrumentationRegistry; 26 import android.support.test.filters.SmallTest; 27 import android.support.test.runner.AndroidJUnit4; 28 29 import com.android.settings.R; 30 31 import org.junit.Before; 32 import org.junit.Test; 33 import org.junit.runner.RunWith; 34 35 @RunWith(AndroidJUnit4.class) 36 @SmallTest 37 public class PowerUsageSummaryUiTest { 38 private static final String BATTERY_INTENT = "android.intent.action.POWER_USAGE_SUMMARY"; 39 40 @Before 41 public void SetUp() { 42 Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); 43 instrumentation.startActivitySync(new Intent(BATTERY_INTENT)); 44 } 45 46 @Test 47 public void testClickLastFullCharge_shouldNotCrash() { 48 onView(withText(R.string.battery_last_full_charge)).perform(click()); 49 } 50 51 @Test 52 public void testClickScreenUsage_shouldNotCrash() { 53 onView(withText(R.string.device_screen_usage)).perform(click()); 54 } 55 56 } 57