Skip to content

Commit

Permalink
Merging HomeScreenTest and TopBarTest into HomeScreenTest and cleanin…
Browse files Browse the repository at this point in the history
…g duplicate tests in TopBarTest
  • Loading branch information
ntissieres authored and violoncelloCH committed Apr 12, 2024
1 parent 715c814 commit ef5c60d
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MainActivityTest {
composeTestRule.onNodeWithTag("action-button").performClick()

// The map screen should be displayed
composeTestRule.onNodeWithTag("mapScreen").assertIsDisplayed()
composeTestRule.onNodeWithTag("home_screen").assertIsDisplayed()
}

@Test
Expand All @@ -67,6 +67,6 @@ class MainActivityTest {
composeTestRule.onNodeWithTag("google-sign-in-button").performClick()

// The map screen should be displayed
composeTestRule.onNodeWithTag("mapScreen").assertIsDisplayed()
composeTestRule.onNodeWithTag("home_screen").assertIsDisplayed()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.github.swent.echo.compose.components

import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import com.github.swent.echo.compose.map.MAP_CENTER
import com.github.swent.echo.data.model.Event
Expand Down Expand Up @@ -75,7 +76,78 @@ class HomeScreenTest {
startDate = Date.from(Instant.now()),
endDate = Date.from(Instant.now()),
tags = emptySet(),
creatorId = "d"
)
val obj = DisplayEventInfo(event, 0, 0, 0, "")
}

@Test
fun shouldShowEcho() {
composeTestRule.onNodeWithText("Echo").assertExists()
}

@Test
fun shouldOpenHamburgerMenuWhenMenuButtonClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
composeTestRule.onNodeWithTag("hamburger_menu").assertExists()
}

@Test
fun shouldShowProfileBoxWhenMenuButtonClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
composeTestRule.onNodeWithTag("profile_box").assertExists()
}

@Test
fun shouldShowProfileSheetWhenMenuButtonClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
composeTestRule.onNodeWithTag("profile_sheet").assertExists()
}

@Test
fun shouldShowProfilePictureWhenMenuButtonClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
composeTestRule.onNodeWithTag("profile_picture").assertExists()
}

@Test
fun shouldShowProfileInfoWhenMenuButtonClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
composeTestRule.onNodeWithTag("profile_info").assertExists()
}

@Test
fun shouldShowProfileNameWhenMenuButtonClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
composeTestRule.onNodeWithTag("profile_name").assertExists()
}

@Test
fun shouldShowProfileClassWhenMenuButtonClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
composeTestRule.onNodeWithTag("profile_class").assertExists()
}

@Test
fun shouldShowCloseButtonWhenMenuButtonClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
composeTestRule.onNodeWithTag("close_button_hamburger_menu").assertExists()
}

@Test
fun shouldShowAllItemsWhenMenuButtonClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
for (i in 0..6) {
composeTestRule.onNodeWithTag("navigation_item_$i").assertExists()
}
}

@Test
fun shouldCloseHamburgerMenuWhenNavigationItemClicked() {
composeTestRule.onNodeWithTag("menu_button").performClick()
for (i in 0..6) {
composeTestRule.onNodeWithTag("navigation_item_$i").performClick()
composeTestRule.onNodeWithTag("mapViewWrapper").assertExists()
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NavigationTest {
@Test
fun shouldShowTheMapScreenWhenNavigatingToTheMapRoute() {
setUp(Routes.MAP)
composeTestRule.onNodeWithTag("mapScreen").assertIsDisplayed()
composeTestRule.onNodeWithTag("home_screen").assertIsDisplayed()
}

@Test
Expand Down

0 comments on commit ef5c60d

Please sign in to comment.