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 */
16package com.android.storagemanager.deletionhelper.apptests;
17
18import static android.support.test.espresso.Espresso.onView;
19import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
20import static android.support.test.espresso.assertion.ViewAssertions.matches;
21import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
22import static android.support.test.espresso.matcher.ViewMatchers.withText;
23
24import android.support.test.rule.ActivityTestRule;
25import android.support.test.runner.AndroidJUnit4;
26import com.android.storagemanager.R;
27import com.android.storagemanager.deletionhelper.DeletionHelperActivity;
28import org.junit.Rule;
29import org.junit.Test;
30import org.junit.runner.RunWith;
31
32@RunWith(AndroidJUnit4.class)
33public class DeletionHelperActivityTest {
34
35    @Rule
36    public ActivityTestRule<DeletionHelperActivity> mActivityRule =
37            new ActivityTestRule<>(DeletionHelperActivity.class, true, true);
38
39    @Test
40    public void testPhotosPreferenceNotVisible() {
41        // Match the apps preference to make sure we don't just pass because we are on the
42        // wrong screen
43        onView(withText(R.string.deletion_helper_apps_group_title)).check(matches(isDisplayed()));
44
45        // Check that the photos preference does not exist
46        onView(withText(R.string.deletion_helper_photos_title)).check(doesNotExist());
47    }
48}
49