File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
app/src/androidTest/java/com/rishirajput/weather/presentation/ui/compose Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import androidx.compose.ui.test.junit4.createComposeRule
2+ import androidx.compose.ui.test.onNodeWithText
3+ import androidx.compose.ui.test.assertIsDisplayed
4+ import com.rishirajput.domain.model.WeatherData
5+ import com.rishirajput.weather.presentation.ui.compose.WeatherInfo
6+ import org.junit.Rule
7+ import org.junit.Test
8+
9+ class WeatherInfoTest {
10+
11+ @get:Rule
12+ val composeTestRule = createComposeRule()
13+
14+ @Test
15+ fun weatherInfo_displaysCorrectData () {
16+ val dummyWeatherData = WeatherData (
17+ locationName = " Hyderabad" ,
18+ temperature = 31.0 ,
19+ condition = " Patchy rain nearby" ,
20+ icon = " //cdn.weatherapi.com/weather/64x64/night/176.png" ,
21+ humidity = 76 ,
22+ uvIndex = 4.0 ,
23+ feelsLike = 30.4
24+ )
25+
26+ composeTestRule.setContent {
27+ WeatherInfo (weatherData = dummyWeatherData)
28+ }
29+
30+ composeTestRule.onNodeWithText(" Humidity" ).assertIsDisplayed()
31+ composeTestRule.onNodeWithText(" 76%" ).assertIsDisplayed()
32+ composeTestRule.onNodeWithText(" UV" ).assertIsDisplayed()
33+ composeTestRule.onNodeWithText(" 4.0" ).assertIsDisplayed()
34+ composeTestRule.onNodeWithText(" Feels Like" ).assertIsDisplayed()
35+ composeTestRule.onNodeWithText(" 30.4°" ).assertIsDisplayed()
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments