Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8371c57 authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Fix infoPage_whenNotChangeableAndClick flaky

By wait switch exists before click.

Fix: 384011082
Flag: EXEMPT test only
Test: atest TogglePermissionAppInfoPageTest
Change-Id: I3f9e79ad8b11d988ce586186bc702804ab7a43b1
parent 2f8b519d
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -160,23 +160,25 @@ class TogglePermissionAppInfoPageTest {
    @Test
    fun infoPage_whenChangeableAndClick() {
        val listModel = TestTogglePermissionAppListModel(isAllowed = false, isChangeable = true)
        val switchTitle = context.getString(listModel.switchTitleResId)

        setTogglePermissionAppInfoPage(listModel)
        composeTestRule.onNodeWithText(context.getString(listModel.switchTitleResId)).performClick()
        composeTestRule.waitUntilExists(hasText(switchTitle))
        composeTestRule.onNodeWithText(switchTitle).performClick()

        composeTestRule.waitUntilExists(
            hasText(context.getString(listModel.switchTitleResId)) and isOn())
        composeTestRule.waitUntilExists(hasText(switchTitle) and isOn())
    }

    @Test
    fun infoPage_whenNotChangeableAndClick() {
        val listModel = TestTogglePermissionAppListModel(isAllowed = false, isChangeable = false)
        val switchTitle = context.getString(listModel.switchTitleResId)

        setTogglePermissionAppInfoPage(listModel)
        composeTestRule.onNodeWithText(context.getString(listModel.switchTitleResId)).performClick()
        composeTestRule.waitUntilExists(hasText(switchTitle))
        composeTestRule.onNodeWithText(switchTitle).performClick()

        composeTestRule.waitUntilExists(
            hasText(context.getString(listModel.switchTitleResId)) and isOff())
        composeTestRule.waitUntilExists(hasText(switchTitle) and isOff())
    }

    @Test