sanity test now reads properties value to determine app layout feature status + small fix for tests

This commit is contained in:
NIkita Fedrunov 2022-09-08 12:37:25 +02:00
parent 6badbe738d
commit 2ab0343e4f
2 changed files with 11 additions and 4 deletions

View File

@ -21,6 +21,7 @@ import androidx.test.espresso.IdlingPolicies
import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.GrantPermissionRule import androidx.test.rule.GrantPermissionRule
import im.vector.app.R import im.vector.app.R
import im.vector.app.espresso.tools.ScreenshotFailureRule import im.vector.app.espresso.tools.ScreenshotFailureRule
@ -28,6 +29,7 @@ import im.vector.app.features.MainActivity
import im.vector.app.getString import im.vector.app.getString
import im.vector.app.ui.robot.ElementRobot import im.vector.app.ui.robot.ElementRobot
import im.vector.app.ui.robot.settings.labs.LabFeature import im.vector.app.ui.robot.settings.labs.LabFeature
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
import im.vector.app.ui.robot.withDeveloperMode import im.vector.app.ui.robot.withDeveloperMode
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
@ -49,7 +51,14 @@ class UiAllScreensSanityTest {
.around(GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE)) .around(GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE))
.around(ScreenshotFailureRule()) .around(ScreenshotFailureRule())
private val elementRobot = ElementRobot() private val elementRobot = ElementRobot(
LabFeaturesPreferences(
InstrumentationRegistry.getInstrumentation()
.targetContext
.resources
.getBoolean(R.bool.settings_labs_new_app_layout_default)
)
)
// Last passing: // Last passing:
// 2020-11-09 // 2020-11-09

View File

@ -32,9 +32,7 @@ class NewRoomRobot(
private val features: VectorFeatures = DefaultVectorFeatures() private val features: VectorFeatures = DefaultVectorFeatures()
fun createNewRoom(block: CreateNewRoomRobot.() -> Unit) { fun createNewRoom(block: CreateNewRoomRobot.() -> Unit) {
if (labsPreferences.isNewAppLayoutEnabled) { clickOn(R.string.create_new_room)
clickOn(R.string.create_new_room)
}
waitUntilViewVisible(withId(R.id.createRoomForm)) waitUntilViewVisible(withId(R.id.createRoomForm))
val createNewRoomRobot = CreateNewRoomRobot() val createNewRoomRobot = CreateNewRoomRobot()
block(createNewRoomRobot) block(createNewRoomRobot)