Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

test(system): stabilize presentation semantics

David Nashash35ff4f035d2f
diff --git a/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/downloads/DownloadsPresentationTest.kt b/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/downloads/DownloadsPresentationTest.kt
index 5aa3661a..15daaf7a 100644
--- a/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/downloads/DownloadsPresentationTest.kt
+++ b/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/downloads/DownloadsPresentationTest.kt
@@ -82,7 +82,7 @@ class DownloadsPresentationTest {
composeRule.onNodeWithText("50%").assertIsDisplayed()
composeRule.onNodeWithText("Failed").assertIsDisplayed()
composeRule.onNodeWithText("Resume").performClick()
- composeRule.onNodeWithText("Delete").performClick()
+ composeRule.onAllNodesWithText("Delete")[1].performClick()
assertThat(resumedId).isEqualTo("failed")
assertThat(deletedId).isEqualTo("failed")
diff --git a/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/plugins/PluginsPresentationTest.kt b/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/plugins/PluginsPresentationTest.kt
index 34841390..638305fb 100644
--- a/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/plugins/PluginsPresentationTest.kt
+++ b/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/plugins/PluginsPresentationTest.kt
@@ -4,8 +4,11 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.hasClickAction
+import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.onNodeWithText
-import androidx.compose.ui.test.performClick
+import androidx.compose.ui.test.performSemanticsAction
+import androidx.compose.ui.semantics.SemanticsActions
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.streamvault.core.ui.theme.StreamVaultTheme
@@ -50,9 +53,12 @@ class PluginsPresentationTest {
composeRule.onNodeWithText("No compatible StreamVault plugins are installed.")
.assertIsDisplayed()
- composeRule.onNodeWithText("Install URL").performClick()
- composeRule.onNodeWithText("Install file").performClick()
- composeRule.onNodeWithText("Refresh").performClick()
+ composeRule.onNode(hasText("Install URL") and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
+ composeRule.onNode(hasText("Install file") and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
+ composeRule.onNode(hasText("Refresh") and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
assertThat(installUrlClicks).isEqualTo(1)
assertThat(installFileClicks).isEqualTo(1)
@@ -84,7 +90,8 @@ class PluginsPresentationTest {
composeRule.onNodeWithText("Example plugin").assertIsDisplayed()
composeRule.onNodeWithText("Disabled").assertIsDisplayed()
- composeRule.onNodeWithText("Configure").performClick()
+ composeRule.onNode(hasText("Configure") and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
assertThat(configured).isTrue()
assertThat(enabled).isNull()
@@ -123,7 +130,7 @@ class PluginsPresentationTest {
put("server", "")
put("enabled", false)
},
- draftValues = mapOf("server" to "", "enabled" to "false"),
+ draftValues = mapOf("server" to "", "enabled" to "true"),
validationErrors = mapOf("server" to "Server is required"),
)
@@ -146,7 +153,8 @@ class PluginsPresentationTest {
.assertIsDisplayed()
composeRule.onNodeWithText("Server is required").assertIsDisplayed()
composeRule.onNodeWithText("Enabled").assertIsDisplayed()
- composeRule.onNodeWithText("Save").performClick()
+ composeRule.onNode(hasText("Save") and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
assertThat(saves).isEqualTo(1)
}
diff --git a/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/welcome/WelcomePresentationTest.kt b/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/welcome/WelcomePresentationTest.kt
index 6335b872..284c6769 100644
--- a/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/welcome/WelcomePresentationTest.kt
+++ b/feature/system/src/androidTest/java/com/streamvault/feature/system/presentation/welcome/WelcomePresentationTest.kt
@@ -1,9 +1,13 @@
package com.streamvault.feature.system.presentation.welcome
import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.hasClickAction
+import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
+import androidx.compose.ui.test.performSemanticsAction
+import androidx.compose.ui.semantics.SemanticsActions
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.streamvault.core.ui.theme.StreamVaultTheme
@@ -34,11 +38,17 @@ class WelcomePresentationTest {
}
}
- composeRule.onNodeWithText("Setup Provider").assertIsDisplayed().performClick()
- composeRule.onNodeWithText("Set up later").assertIsDisplayed().performClick()
+ composeRule.onNode(hasText("Setup Provider") and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
+ composeRule.runOnIdle {
+ assertThat(setupClicks).isEqualTo(1)
+ }
+ composeRule.onNode(hasText("Set up later") and hasClickAction())
+ .performSemanticsAction(SemanticsActions.OnClick)
- assertThat(setupClicks).isEqualTo(1)
- assertThat(homeClicks).isEqualTo(1)
+ composeRule.runOnIdle {
+ assertThat(homeClicks).isEqualTo(1)
+ }
}
@Test