Fix more SettingsUITests

Also add SettingsUITests to postsubmit.

Bug: 290381395
Test: ui test
Change-Id: Ib1dd35bf7823290bf77deb31366e9cb6ae9f65f7
This commit is contained in:
Chaohui Wang
2023-09-08 21:26:59 +08:00
parent f1a1439d2b
commit a35c6bc139
26 changed files with 346 additions and 549 deletions

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.ui
import android.provider.Settings
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import com.android.settings.ui.testutils.SettingsTestUtils.startMainActivityFromHomeScreen
import com.android.settings.ui.testutils.SettingsTestUtils.waitObject
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class DataSaverSettingsTest {
private lateinit var device: UiDevice
@Before
fun setUp() {
device = startMainActivityFromHomeScreen(Settings.ACTION_DATA_SAVER_SETTINGS)
}
@Test
fun hasSwitchBar() {
assertThat(device.waitObject(By.text("Use Data Saver"))).isNotNull()
}
}