mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 07:57:03 +05:30
Add test to check item add dialog is shown
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
48b3b83cae
commit
e0e28b5e35
1 changed files with 6 additions and 5 deletions
|
@ -2,7 +2,8 @@ package dev.msfjarvis.todo
|
||||||
|
|
||||||
import androidx.ui.test.assertIsDisplayed
|
import androidx.ui.test.assertIsDisplayed
|
||||||
import androidx.ui.test.createComposeRule
|
import androidx.ui.test.createComposeRule
|
||||||
import androidx.ui.test.onNodeWithText
|
import androidx.ui.test.onNodeWithTag
|
||||||
|
import androidx.ui.test.performClick
|
||||||
import dev.msfjarvis.todo.data.model.TodoItem
|
import dev.msfjarvis.todo.data.model.TodoItem
|
||||||
import dev.msfjarvis.todo.ui.TodoTheme
|
import dev.msfjarvis.todo.ui.TodoTheme
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
|
@ -14,10 +15,10 @@ class MainActivityTest {
|
||||||
val composeTestRule = createComposeRule()
|
val composeTestRule = createComposeRule()
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun test_item_addition() {
|
fun item_add_dialog_shows_on_fab_click() {
|
||||||
composeTestRule.setContent {
|
composeTestRule.setContent {
|
||||||
TodoTheme {
|
TodoTheme {
|
||||||
val items = arrayListOf(TodoItem("Item 1"))
|
val items = arrayListOf<TodoItem>()
|
||||||
TodoApp(
|
TodoApp(
|
||||||
items,
|
items,
|
||||||
items::add,
|
items::add,
|
||||||
|
@ -25,7 +26,7 @@ class MainActivityTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//onNode(hasTestTag("fab")).performClick()
|
onNodeWithTag("fab").performClick()
|
||||||
onNodeWithText("Item 1").assertIsDisplayed()
|
onNodeWithTag("item_dialog").assertIsDisplayed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue