From a7decdcff2fedcf9e4b6a40a0b9cf3750369adbe Mon Sep 17 00:00:00 2001 From: taghizadlaura Date: Wed, 16 Oct 2024 10:34:19 +0200 Subject: [PATCH] fix: change tests with assertTextEquals --- .../ui/profile/ProfileScreenTest.kt | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/src/androidTest/java/com/android/periodpals/ui/profile/ProfileScreenTest.kt b/app/src/androidTest/java/com/android/periodpals/ui/profile/ProfileScreenTest.kt index 5df614c48..d276d439a 100644 --- a/app/src/androidTest/java/com/android/periodpals/ui/profile/ProfileScreenTest.kt +++ b/app/src/androidTest/java/com/android/periodpals/ui/profile/ProfileScreenTest.kt @@ -1,28 +1,30 @@ package com.android.periodpals.ui.profile import androidx.compose.ui.test.assertIsDisplayed +import androidx.compose.ui.test.assertTextEquals import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag import org.junit.Rule import org.junit.Test class ProfileScreenTest { - @get:Rule val composeTestRule = createComposeRule() + @get:Rule + val composeTestRule = createComposeRule() - @Test - fun displayAllComponents() { - composeTestRule.setContent { ProfileScreen() } - composeTestRule.onNodeWithTag("profileAvatar").assertIsDisplayed() - composeTestRule.onNodeWithTag("profileName").assertIsDisplayed() - composeTestRule.onNodeWithTag("Description").assertIsDisplayed() - composeTestRule.onNodeWithTag("reviewOne").assertIsDisplayed() - composeTestRule.onNodeWithTag("reviewTwo").assertIsDisplayed() - } + @Test + fun displayAllComponents() { + composeTestRule.setContent { ProfileScreen() } + composeTestRule.onNodeWithTag("profileAvatar").assertIsDisplayed() + composeTestRule.onNodeWithTag("profileName").assertIsDisplayed() + composeTestRule.onNodeWithTag("Description").assertIsDisplayed() + composeTestRule.onNodeWithTag("reviewOne").assertIsDisplayed() + composeTestRule.onNodeWithTag("reviewTwo").assertIsDisplayed() + } - @Test - fun profileScreen_hasCorrectContent() { - composeTestRule.setContent { ProfileScreen() } - composeTestRule.onNodeWithTag("profileName").assertExists("Displayed Name") - composeTestRule.onNodeWithTag("Description").assertExists("Description") - } + @Test + fun profileScreen_hasCorrectContent() { + composeTestRule.setContent { ProfileScreen() } + composeTestRule.onNodeWithTag("profileName").assertTextEquals("Name") + composeTestRule.onNodeWithTag("Description").assertTextEquals("Description") + } }