1 /*
2  * Copyright (C) 2023 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.remoteauth.enrolling
18 
19 import android.os.Bundle
20 import androidx.fragment.app.testing.launchFragmentInContainer
21 import androidx.test.espresso.Espresso.onView
22 import androidx.test.espresso.assertion.ViewAssertions.matches
23 import androidx.test.espresso.matcher.ViewMatchers.*
24 import com.android.settings.R
25 import org.junit.Before
26 import org.junit.Test
27 import org.junit.runner.RunWith
28 import org.robolectric.RobolectricTestRunner
29 
30 @RunWith(RobolectricTestRunner::class)
31 class RemoteAuthEnrollEnrollingTest {
32     @Before
setupnull33     fun setup() {
34         launchFragmentInContainer<RemoteAuthEnrollEnrolling>(Bundle(), R.style.SudThemeGlif)
35     }
36 
37     @Test
testRemoteAuthenticatorEnrollEnrolling_headerVisiblenull38     fun testRemoteAuthenticatorEnrollEnrolling_headerVisible() {
39         onView(withText(R.string.security_settings_remoteauth_enroll_enrolling_title)).check(
40             matches(
41                 withEffectiveVisibility(Visibility.VISIBLE)
42             )
43         )
44     }
45 
46     @Test
testRemoteAuthenticatorEnrollEnrolling_primaryButtonDisablednull47     fun testRemoteAuthenticatorEnrollEnrolling_primaryButtonDisabled() {
48         onView(withText(R.string.security_settings_remoteauth_enroll_enrolling_agree)).check(
49             matches(
50                 isNotEnabled()
51             )
52         )
53     }
54 
55     @Test
testRemoteAuthenticatorEnrollEnrolling_progressBarNotVisiblenull56     fun testRemoteAuthenticatorEnrollEnrolling_progressBarNotVisible() {
57         onView(withId(R.id.enrolling_list_progress_bar)).check(
58             matches(
59                 withEffectiveVisibility(
60                     Visibility.INVISIBLE
61                 )
62             )
63         )
64     }
65 
66     @Test
testRemoteAuthenticatorEnrollEnrolling_errorTextNotVisiblenull67     fun testRemoteAuthenticatorEnrollEnrolling_errorTextNotVisible() {
68         onView(withId(R.id.error_text)).check(matches(withEffectiveVisibility(Visibility.INVISIBLE)))
69     }
70 }