Skip to content

Commit

Permalink
fix: change tests with assertTextEquals
Browse files Browse the repository at this point in the history
  • Loading branch information
taghizadlaura committed Oct 16, 2024
1 parent 29b24bb commit a7decdc
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -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")
}
}

0 comments on commit a7decdc

Please sign in to comment.