Skip to content

Commit

Permalink
fix: added missing navigation bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Polymeth committed Apr 8, 2024
1 parent 70d74ad commit 6eb1729
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 59 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.github.se.assocify.navigation.NavigationActions
import com.github.se.assocify.ui.screens.TreasuryScreen
import com.github.se.assocify.ui.screens.treasury.TreasuryScreen
import com.kaspersky.components.composesupport.config.withComposeSupport
import com.kaspersky.kaspresso.kaspresso.Kaspresso
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase
import io.github.kakaocup.compose.node.element.ComposeScreen
import io.mockk.every
import io.mockk.mockk
import org.junit.Before
Expand Down Expand Up @@ -42,4 +44,34 @@ class TreasuryScreenTest : TestCase(kaspressoBuilder = Kaspresso.Builder.withCom
assert(tabSelected)
}
}

@Test
fun testTabSwitching() {
ComposeScreen.onComposeScreen<TreasuryScreen>(composeTestRule) {
budgetTab.assertIsDisplayed()
budgetTab.performClick()
budgetTab.assertIsSelected()

balanceTab.assertIsDisplayed()
balanceTab.performClick()
balanceTab.assertIsSelected()

myReceiptsTab.assertIsDisplayed()
myReceiptsTab.performClick()
myReceiptsTab.assertIsSelected()
}
}

@Test
fun testTodoListItem() = run {
ComposeScreen.onComposeScreen<TreasuryScreen>(composeTestRule) { receiptItemBox.assertIsDisplayed() }
}

@Test
fun createTodo() = run {
ComposeScreen.onComposeScreen<TreasuryScreen>(composeTestRule) {
createReceiptFab.assertIsDisplayed()
createReceiptFab.performClick()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.github.se.assocify.navigation.Destination
import com.github.se.assocify.navigation.MAIN_TABS_LIST
import com.github.se.assocify.navigation.NavigationActions
import com.github.se.assocify.ui.composables.MainNavigationBar
import kotlinx.coroutines.launch

// Number of tabs at the top
Expand All @@ -60,10 +63,17 @@ const val PAGE_BALANCE_INDEX: Int = 2
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
@Composable
fun TreasuryScreen(navigationActions: NavigationActions) {
fun TreasuryScreen(navActions: NavigationActions) {
Scaffold(
modifier = Modifier.testTag("treasuryScreen"),
topBar = { TreasuryTopBar({}, {}) },
bottomBar = {
MainNavigationBar(
onTabSelect = { navActions.navigateToMainTab(it) },
tabList = MAIN_TABS_LIST,
selectedTab = Destination.Profile
)
},
floatingActionButton = {
FloatingActionButton(
modifier = Modifier.testTag("createReceipt"),
Expand Down

0 comments on commit 6eb1729

Please sign in to comment.